001// --------------------------------------------------------------------------------
002// Copyright 2002-2026 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016// Generated File -- DO NOT EDIT BY HAND
017// --------------------------------------------------------------------------------
018
019/**
020 * InventoryTransactionDetailValue.java
021 */
022
023package com.echothree.model.data.inventory.server.value;
024
025import com.echothree.model.data.inventory.common.pk.InventoryTransactionDetailPK;
026
027import com.echothree.model.data.inventory.server.factory.InventoryTransactionDetailFactory;
028
029import com.echothree.model.data.inventory.common.pk.InventoryTransactionPK;
030import com.echothree.model.data.inventory.common.pk.InventoryTransactionTypePK;
031import com.echothree.model.data.party.common.pk.PartyPK;
032import com.echothree.model.data.inventory.common.pk.InventoryTransactionReasonPK;
033
034import com.echothree.util.common.exception.PersistenceCloneException;
035import com.echothree.util.common.exception.PersistenceNotNullException;
036
037import com.echothree.util.server.persistence.BaseValue;
038
039import java.io.Serializable;
040
041import javax.annotation.Nonnull;
042import javax.annotation.Nullable;
043
044public class InventoryTransactionDetailValue
045        extends BaseValue<InventoryTransactionDetailPK>
046        implements Cloneable, Serializable {
047    
048    private InventoryTransactionPK inventoryTransactionPK;
049    private boolean inventoryTransactionPKHasBeenModified = false;
050    private InventoryTransactionTypePK inventoryTransactionTypePK;
051    private boolean inventoryTransactionTypePKHasBeenModified = false;
052    private String inventoryTransactionName;
053    private boolean inventoryTransactionNameHasBeenModified = false;
054    private PartyPK companyPartyPK;
055    private boolean companyPartyPKHasBeenModified = false;
056    private PartyPK locationPartyPK;
057    private boolean locationPartyPKHasBeenModified = false;
058    private InventoryTransactionReasonPK inventoryTransactionReasonPK;
059    private boolean inventoryTransactionReasonPKHasBeenModified = false;
060    private String reference;
061    private boolean referenceHasBeenModified = false;
062    private String description;
063    private boolean descriptionHasBeenModified = false;
064    private Long fromTime;
065    private boolean fromTimeHasBeenModified = false;
066    private Long thruTime;
067    private boolean thruTimeHasBeenModified = false;
068    
069    private transient Integer _hashCode = null;
070    private transient String _stringValue = null;
071    
072    private void constructFields(InventoryTransactionPK inventoryTransactionPK, InventoryTransactionTypePK inventoryTransactionTypePK, String inventoryTransactionName, PartyPK companyPartyPK, PartyPK locationPartyPK, InventoryTransactionReasonPK inventoryTransactionReasonPK, String reference, String description, Long fromTime, Long thruTime)
073            throws PersistenceNotNullException {
074        checkForNull(inventoryTransactionPK);
075        this.inventoryTransactionPK = inventoryTransactionPK;
076        checkForNull(inventoryTransactionTypePK);
077        this.inventoryTransactionTypePK = inventoryTransactionTypePK;
078        checkForNull(inventoryTransactionName);
079        this.inventoryTransactionName = inventoryTransactionName;
080        checkForNull(companyPartyPK);
081        this.companyPartyPK = companyPartyPK;
082        checkForNull(locationPartyPK);
083        this.locationPartyPK = locationPartyPK;
084        this.inventoryTransactionReasonPK = inventoryTransactionReasonPK;
085        this.reference = reference;
086        this.description = description;
087        checkForNull(fromTime);
088        this.fromTime = fromTime;
089        checkForNull(thruTime);
090        this.thruTime = thruTime;
091    }
092    
093    /** Creates a new instance of InventoryTransactionDetailValue */
094    public InventoryTransactionDetailValue(InventoryTransactionDetailPK inventoryTransactionDetailPK, InventoryTransactionPK inventoryTransactionPK, InventoryTransactionTypePK inventoryTransactionTypePK, String inventoryTransactionName, PartyPK companyPartyPK, PartyPK locationPartyPK, InventoryTransactionReasonPK inventoryTransactionReasonPK, String reference, String description, Long fromTime, Long thruTime)
095            throws PersistenceNotNullException {
096        super(inventoryTransactionDetailPK);
097        constructFields(inventoryTransactionPK, inventoryTransactionTypePK, inventoryTransactionName, companyPartyPK, locationPartyPK, inventoryTransactionReasonPK, reference, description, fromTime, thruTime);
098    }
099    
100    /** Creates a new instance of InventoryTransactionDetailValue */
101    public InventoryTransactionDetailValue(InventoryTransactionPK inventoryTransactionPK, InventoryTransactionTypePK inventoryTransactionTypePK, String inventoryTransactionName, PartyPK companyPartyPK, PartyPK locationPartyPK, InventoryTransactionReasonPK inventoryTransactionReasonPK, String reference, String description, Long fromTime, Long thruTime)
102            throws PersistenceNotNullException {
103        super();
104        constructFields(inventoryTransactionPK, inventoryTransactionTypePK, inventoryTransactionName, companyPartyPK, locationPartyPK, inventoryTransactionReasonPK, reference, description, fromTime, thruTime);
105    }
106    
107    @Override
108    @Nonnull
109    public InventoryTransactionDetailFactory getBaseFactoryInstance() {
110        return InventoryTransactionDetailFactory.getInstance();
111    }
112    
113    @Override
114    @Nonnull
115    public InventoryTransactionDetailValue clone() {
116        Object result;
117        
118        try {
119            result = super.clone();
120        } catch (CloneNotSupportedException cnse) {
121            // This shouldn't happen, fail when it does.
122            throw new PersistenceCloneException(cnse);
123        }
124        
125        return (InventoryTransactionDetailValue)result;
126    }
127    
128    @Override
129    @Nonnull
130    public InventoryTransactionDetailPK getPrimaryKey() {
131        if(_primaryKey == null) {
132            _primaryKey = new InventoryTransactionDetailPK(entityId);
133        }
134        
135        return _primaryKey;
136    }
137    
138    private void clearHashAndString() {
139        _hashCode = null;
140        _stringValue = null;
141    }
142    
143    @Override
144    public int hashCode() {
145        if(_hashCode == null) {
146            int hashCode = 17;
147            
148            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
149            
150            hashCode = 37 * hashCode + ((inventoryTransactionPK != null) ? inventoryTransactionPK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((inventoryTransactionTypePK != null) ? inventoryTransactionTypePK.hashCode() : 0);
152            hashCode = 37 * hashCode + ((inventoryTransactionName != null) ? inventoryTransactionName.hashCode() : 0);
153            hashCode = 37 * hashCode + ((companyPartyPK != null) ? companyPartyPK.hashCode() : 0);
154            hashCode = 37 * hashCode + ((locationPartyPK != null) ? locationPartyPK.hashCode() : 0);
155            hashCode = 37 * hashCode + ((inventoryTransactionReasonPK != null) ? inventoryTransactionReasonPK.hashCode() : 0);
156            hashCode = 37 * hashCode + ((reference != null) ? reference.hashCode() : 0);
157            hashCode = 37 * hashCode + ((description != null) ? description.hashCode() : 0);
158            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
159            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
160            
161            _hashCode = hashCode;
162        }
163        
164        return _hashCode;
165    }
166    
167    @Override
168    @Nonnull
169    public String toString() {
170        if(_stringValue == null) {
171            _stringValue = "{" + 
172                    "entityId=" + getEntityId() +
173                    ", inventoryTransactionPK=" + getInventoryTransactionPK() +
174                    ", inventoryTransactionTypePK=" + getInventoryTransactionTypePK() +
175                    ", inventoryTransactionName=" + getInventoryTransactionName() +
176                    ", companyPartyPK=" + getCompanyPartyPK() +
177                    ", locationPartyPK=" + getLocationPartyPK() +
178                    ", inventoryTransactionReasonPK=" + getInventoryTransactionReasonPK() +
179                    ", reference=" + getReference() +
180                    ", description=" + getDescription() +
181                    ", fromTime=" + getFromTime() +
182                    ", thruTime=" + getThruTime() +
183                    "}";
184        }
185        return _stringValue;
186    }
187    
188    @Override
189    public boolean equals(Object other) {
190        if(this == other)
191            return true;
192        
193        if(!hasIdentity())
194            return false;
195        
196        if(other instanceof  InventoryTransactionDetailValue that) {
197            if(!that.hasIdentity())
198                return false;
199            
200            Long thisEntityId = getEntityId();
201            Long thatEntityId = that.getEntityId();
202            
203            boolean objectsEqual = thisEntityId.equals(thatEntityId);
204            if(objectsEqual)
205                objectsEqual = isIdentical(that);
206            
207            return objectsEqual;
208        } else {
209            return false;
210        }
211    }
212    
213    public boolean isIdentical(Object other) {
214        if(other instanceof InventoryTransactionDetailValue that) {
215            boolean objectsEqual = true;
216            
217            
218            if(objectsEqual) {
219                InventoryTransactionPK thisInventoryTransactionPK = getInventoryTransactionPK();
220                InventoryTransactionPK thatInventoryTransactionPK = that.getInventoryTransactionPK();
221                
222                if(thisInventoryTransactionPK == null) {
223                    objectsEqual = objectsEqual && (thatInventoryTransactionPK == null);
224                } else {
225                    objectsEqual = objectsEqual && thisInventoryTransactionPK.equals(thatInventoryTransactionPK);
226                }
227            }
228            
229            if(objectsEqual) {
230                InventoryTransactionTypePK thisInventoryTransactionTypePK = getInventoryTransactionTypePK();
231                InventoryTransactionTypePK thatInventoryTransactionTypePK = that.getInventoryTransactionTypePK();
232                
233                if(thisInventoryTransactionTypePK == null) {
234                    objectsEqual = objectsEqual && (thatInventoryTransactionTypePK == null);
235                } else {
236                    objectsEqual = objectsEqual && thisInventoryTransactionTypePK.equals(thatInventoryTransactionTypePK);
237                }
238            }
239            
240            if(objectsEqual) {
241                String thisInventoryTransactionName = getInventoryTransactionName();
242                String thatInventoryTransactionName = that.getInventoryTransactionName();
243                
244                if(thisInventoryTransactionName == null) {
245                    objectsEqual = objectsEqual && (thatInventoryTransactionName == null);
246                } else {
247                    objectsEqual = objectsEqual && thisInventoryTransactionName.equals(thatInventoryTransactionName);
248                }
249            }
250            
251            if(objectsEqual) {
252                PartyPK thisCompanyPartyPK = getCompanyPartyPK();
253                PartyPK thatCompanyPartyPK = that.getCompanyPartyPK();
254                
255                if(thisCompanyPartyPK == null) {
256                    objectsEqual = objectsEqual && (thatCompanyPartyPK == null);
257                } else {
258                    objectsEqual = objectsEqual && thisCompanyPartyPK.equals(thatCompanyPartyPK);
259                }
260            }
261            
262            if(objectsEqual) {
263                PartyPK thisLocationPartyPK = getLocationPartyPK();
264                PartyPK thatLocationPartyPK = that.getLocationPartyPK();
265                
266                if(thisLocationPartyPK == null) {
267                    objectsEqual = objectsEqual && (thatLocationPartyPK == null);
268                } else {
269                    objectsEqual = objectsEqual && thisLocationPartyPK.equals(thatLocationPartyPK);
270                }
271            }
272            
273            if(objectsEqual) {
274                InventoryTransactionReasonPK thisInventoryTransactionReasonPK = getInventoryTransactionReasonPK();
275                InventoryTransactionReasonPK thatInventoryTransactionReasonPK = that.getInventoryTransactionReasonPK();
276                
277                if(thisInventoryTransactionReasonPK == null) {
278                    objectsEqual = objectsEqual && (thatInventoryTransactionReasonPK == null);
279                } else {
280                    objectsEqual = objectsEqual && thisInventoryTransactionReasonPK.equals(thatInventoryTransactionReasonPK);
281                }
282            }
283            
284            if(objectsEqual) {
285                String thisReference = getReference();
286                String thatReference = that.getReference();
287                
288                if(thisReference == null) {
289                    objectsEqual = objectsEqual && (thatReference == null);
290                } else {
291                    objectsEqual = objectsEqual && thisReference.equals(thatReference);
292                }
293            }
294            
295            if(objectsEqual) {
296                String thisDescription = getDescription();
297                String thatDescription = that.getDescription();
298                
299                if(thisDescription == null) {
300                    objectsEqual = objectsEqual && (thatDescription == null);
301                } else {
302                    objectsEqual = objectsEqual && thisDescription.equals(thatDescription);
303                }
304            }
305            
306            if(objectsEqual) {
307                Long thisFromTime = getFromTime();
308                Long thatFromTime = that.getFromTime();
309                
310                if(thisFromTime == null) {
311                    objectsEqual = objectsEqual && (thatFromTime == null);
312                } else {
313                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
314                }
315            }
316            
317            if(objectsEqual) {
318                Long thisThruTime = getThruTime();
319                Long thatThruTime = that.getThruTime();
320                
321                if(thisThruTime == null) {
322                    objectsEqual = objectsEqual && (thatThruTime == null);
323                } else {
324                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
325                }
326            }
327            
328            return objectsEqual;
329        } else {
330            return false;
331        }
332    }
333    
334    @Override
335    public boolean hasBeenModified() {
336        return inventoryTransactionPKHasBeenModified || inventoryTransactionTypePKHasBeenModified || inventoryTransactionNameHasBeenModified || companyPartyPKHasBeenModified || locationPartyPKHasBeenModified || inventoryTransactionReasonPKHasBeenModified || referenceHasBeenModified || descriptionHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
337    }
338    
339    @Override
340    public void clearHasBeenModified() {
341        inventoryTransactionPKHasBeenModified = false;
342        inventoryTransactionTypePKHasBeenModified = false;
343        inventoryTransactionNameHasBeenModified = false;
344        companyPartyPKHasBeenModified = false;
345        locationPartyPKHasBeenModified = false;
346        inventoryTransactionReasonPKHasBeenModified = false;
347        referenceHasBeenModified = false;
348        descriptionHasBeenModified = false;
349        fromTimeHasBeenModified = false;
350        thruTimeHasBeenModified = false;
351    }
352    
353    @Nonnull
354    public InventoryTransactionPK getInventoryTransactionPK() {
355        return inventoryTransactionPK;
356    }
357    
358    public void setInventoryTransactionPK(@Nonnull InventoryTransactionPK inventoryTransactionPK)
359            throws PersistenceNotNullException {
360        checkForNull(inventoryTransactionPK);
361        
362        boolean update = true;
363        
364        if(this.inventoryTransactionPK != null) {
365            if(this.inventoryTransactionPK.equals(inventoryTransactionPK)) {
366                update = false;
367            }
368        } else if(inventoryTransactionPK == null) {
369            update = false;
370        }
371        
372        if(update) {
373            this.inventoryTransactionPK = inventoryTransactionPK;
374            inventoryTransactionPKHasBeenModified = true;
375            clearHashAndString();
376        }
377    }
378    
379    public boolean getInventoryTransactionPKHasBeenModified() {
380        return inventoryTransactionPKHasBeenModified;
381    }
382    
383    @Nonnull
384    public InventoryTransactionTypePK getInventoryTransactionTypePK() {
385        return inventoryTransactionTypePK;
386    }
387    
388    public void setInventoryTransactionTypePK(@Nonnull InventoryTransactionTypePK inventoryTransactionTypePK)
389            throws PersistenceNotNullException {
390        checkForNull(inventoryTransactionTypePK);
391        
392        boolean update = true;
393        
394        if(this.inventoryTransactionTypePK != null) {
395            if(this.inventoryTransactionTypePK.equals(inventoryTransactionTypePK)) {
396                update = false;
397            }
398        } else if(inventoryTransactionTypePK == null) {
399            update = false;
400        }
401        
402        if(update) {
403            this.inventoryTransactionTypePK = inventoryTransactionTypePK;
404            inventoryTransactionTypePKHasBeenModified = true;
405            clearHashAndString();
406        }
407    }
408    
409    public boolean getInventoryTransactionTypePKHasBeenModified() {
410        return inventoryTransactionTypePKHasBeenModified;
411    }
412    
413    @Nonnull
414    public String getInventoryTransactionName() {
415        return inventoryTransactionName;
416    }
417    
418    public void setInventoryTransactionName(@Nonnull String inventoryTransactionName)
419            throws PersistenceNotNullException {
420        checkForNull(inventoryTransactionName);
421        
422        boolean update = true;
423        
424        if(this.inventoryTransactionName != null) {
425            if(this.inventoryTransactionName.equals(inventoryTransactionName)) {
426                update = false;
427            }
428        } else if(inventoryTransactionName == null) {
429            update = false;
430        }
431        
432        if(update) {
433            this.inventoryTransactionName = inventoryTransactionName;
434            inventoryTransactionNameHasBeenModified = true;
435            clearHashAndString();
436        }
437    }
438    
439    public boolean getInventoryTransactionNameHasBeenModified() {
440        return inventoryTransactionNameHasBeenModified;
441    }
442    
443    @Nonnull
444    public PartyPK getCompanyPartyPK() {
445        return companyPartyPK;
446    }
447    
448    public void setCompanyPartyPK(@Nonnull PartyPK companyPartyPK)
449            throws PersistenceNotNullException {
450        checkForNull(companyPartyPK);
451        
452        boolean update = true;
453        
454        if(this.companyPartyPK != null) {
455            if(this.companyPartyPK.equals(companyPartyPK)) {
456                update = false;
457            }
458        } else if(companyPartyPK == null) {
459            update = false;
460        }
461        
462        if(update) {
463            this.companyPartyPK = companyPartyPK;
464            companyPartyPKHasBeenModified = true;
465            clearHashAndString();
466        }
467    }
468    
469    public boolean getCompanyPartyPKHasBeenModified() {
470        return companyPartyPKHasBeenModified;
471    }
472    
473    @Nonnull
474    public PartyPK getLocationPartyPK() {
475        return locationPartyPK;
476    }
477    
478    public void setLocationPartyPK(@Nonnull PartyPK locationPartyPK)
479            throws PersistenceNotNullException {
480        checkForNull(locationPartyPK);
481        
482        boolean update = true;
483        
484        if(this.locationPartyPK != null) {
485            if(this.locationPartyPK.equals(locationPartyPK)) {
486                update = false;
487            }
488        } else if(locationPartyPK == null) {
489            update = false;
490        }
491        
492        if(update) {
493            this.locationPartyPK = locationPartyPK;
494            locationPartyPKHasBeenModified = true;
495            clearHashAndString();
496        }
497    }
498    
499    public boolean getLocationPartyPKHasBeenModified() {
500        return locationPartyPKHasBeenModified;
501    }
502    
503    @Nullable
504    public InventoryTransactionReasonPK getInventoryTransactionReasonPK() {
505        return inventoryTransactionReasonPK;
506    }
507    
508    public void setInventoryTransactionReasonPK(@Nullable InventoryTransactionReasonPK inventoryTransactionReasonPK) {
509        boolean update = true;
510        
511        if(this.inventoryTransactionReasonPK != null) {
512            if(this.inventoryTransactionReasonPK.equals(inventoryTransactionReasonPK)) {
513                update = false;
514            }
515        } else if(inventoryTransactionReasonPK == null) {
516            update = false;
517        }
518        
519        if(update) {
520            this.inventoryTransactionReasonPK = inventoryTransactionReasonPK;
521            inventoryTransactionReasonPKHasBeenModified = true;
522            clearHashAndString();
523        }
524    }
525    
526    public boolean getInventoryTransactionReasonPKHasBeenModified() {
527        return inventoryTransactionReasonPKHasBeenModified;
528    }
529    
530    @Nullable
531    public String getReference() {
532        return reference;
533    }
534    
535    public void setReference(@Nullable String reference) {
536        boolean update = true;
537        
538        if(this.reference != null) {
539            if(this.reference.equals(reference)) {
540                update = false;
541            }
542        } else if(reference == null) {
543            update = false;
544        }
545        
546        if(update) {
547            this.reference = reference;
548            referenceHasBeenModified = true;
549            clearHashAndString();
550        }
551    }
552    
553    public boolean getReferenceHasBeenModified() {
554        return referenceHasBeenModified;
555    }
556    
557    @Nullable
558    public String getDescription() {
559        return description;
560    }
561    
562    public void setDescription(@Nullable String description) {
563        boolean update = true;
564        
565        if(this.description != null) {
566            if(this.description.equals(description)) {
567                update = false;
568            }
569        } else if(description == null) {
570            update = false;
571        }
572        
573        if(update) {
574            this.description = description;
575            descriptionHasBeenModified = true;
576            clearHashAndString();
577        }
578    }
579    
580    public boolean getDescriptionHasBeenModified() {
581        return descriptionHasBeenModified;
582    }
583    
584    @Nonnull
585    public Long getFromTime() {
586        return fromTime;
587    }
588    
589    public void setFromTime(@Nonnull Long fromTime)
590            throws PersistenceNotNullException {
591        checkForNull(fromTime);
592        
593        boolean update = true;
594        
595        if(this.fromTime != null) {
596            if(this.fromTime.equals(fromTime)) {
597                update = false;
598            }
599        } else if(fromTime == null) {
600            update = false;
601        }
602        
603        if(update) {
604            this.fromTime = fromTime;
605            fromTimeHasBeenModified = true;
606            clearHashAndString();
607        }
608    }
609    
610    public boolean getFromTimeHasBeenModified() {
611        return fromTimeHasBeenModified;
612    }
613    
614    @Nonnull
615    public Long getThruTime() {
616        return thruTime;
617    }
618    
619    public void setThruTime(@Nonnull Long thruTime)
620            throws PersistenceNotNullException {
621        checkForNull(thruTime);
622        
623        boolean update = true;
624        
625        if(this.thruTime != null) {
626            if(this.thruTime.equals(thruTime)) {
627                update = false;
628            }
629        } else if(thruTime == null) {
630            update = false;
631        }
632        
633        if(update) {
634            this.thruTime = thruTime;
635            thruTimeHasBeenModified = true;
636            clearHashAndString();
637        }
638    }
639    
640    public boolean getThruTimeHasBeenModified() {
641        return thruTimeHasBeenModified;
642    }
643    
644}