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 * InventoryDispositionAdjustmentDetailValue.java
021 */
022
023package com.echothree.model.data.inventory.server.value;
024
025import com.echothree.model.data.inventory.common.pk.InventoryDispositionAdjustmentDetailPK;
026
027import com.echothree.model.data.inventory.server.factory.InventoryDispositionAdjustmentDetailFactory;
028
029import com.echothree.model.data.inventory.common.pk.InventoryDispositionAdjustmentPK;
030import com.echothree.model.data.inventory.common.pk.InventoryDispositionPK;
031import com.echothree.model.data.inventory.common.pk.InventoryAdjustmentTypePK;
032import com.echothree.model.data.inventory.common.pk.InventoryBucketTypePK;
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 InventoryDispositionAdjustmentDetailValue
045        extends BaseValue<InventoryDispositionAdjustmentDetailPK>
046        implements Cloneable, Serializable {
047    
048    private InventoryDispositionAdjustmentPK inventoryDispositionAdjustmentPK;
049    private boolean inventoryDispositionAdjustmentPKHasBeenModified = false;
050    private InventoryDispositionPK inventoryDispositionPK;
051    private boolean inventoryDispositionPKHasBeenModified = false;
052    private String inventoryDispositionAdjustmentName;
053    private boolean inventoryDispositionAdjustmentNameHasBeenModified = false;
054    private InventoryAdjustmentTypePK inventoryAdjustmentTypePK;
055    private boolean inventoryAdjustmentTypePKHasBeenModified = false;
056    private InventoryBucketTypePK inventoryBucketTypePK;
057    private boolean inventoryBucketTypePKHasBeenModified = false;
058    private Boolean isDefault;
059    private boolean isDefaultHasBeenModified = false;
060    private Integer sortOrder;
061    private boolean sortOrderHasBeenModified = false;
062    private Long fromTime;
063    private boolean fromTimeHasBeenModified = false;
064    private Long thruTime;
065    private boolean thruTimeHasBeenModified = false;
066    
067    private transient Integer _hashCode = null;
068    private transient String _stringValue = null;
069    
070    private void constructFields(InventoryDispositionAdjustmentPK inventoryDispositionAdjustmentPK, InventoryDispositionPK inventoryDispositionPK, String inventoryDispositionAdjustmentName, InventoryAdjustmentTypePK inventoryAdjustmentTypePK, InventoryBucketTypePK inventoryBucketTypePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
071            throws PersistenceNotNullException {
072        checkForNull(inventoryDispositionAdjustmentPK);
073        this.inventoryDispositionAdjustmentPK = inventoryDispositionAdjustmentPK;
074        checkForNull(inventoryDispositionPK);
075        this.inventoryDispositionPK = inventoryDispositionPK;
076        checkForNull(inventoryDispositionAdjustmentName);
077        this.inventoryDispositionAdjustmentName = inventoryDispositionAdjustmentName;
078        checkForNull(inventoryAdjustmentTypePK);
079        this.inventoryAdjustmentTypePK = inventoryAdjustmentTypePK;
080        checkForNull(inventoryBucketTypePK);
081        this.inventoryBucketTypePK = inventoryBucketTypePK;
082        checkForNull(isDefault);
083        this.isDefault = isDefault;
084        checkForNull(sortOrder);
085        this.sortOrder = sortOrder;
086        checkForNull(fromTime);
087        this.fromTime = fromTime;
088        checkForNull(thruTime);
089        this.thruTime = thruTime;
090    }
091    
092    /** Creates a new instance of InventoryDispositionAdjustmentDetailValue */
093    public InventoryDispositionAdjustmentDetailValue(InventoryDispositionAdjustmentDetailPK inventoryDispositionAdjustmentDetailPK, InventoryDispositionAdjustmentPK inventoryDispositionAdjustmentPK, InventoryDispositionPK inventoryDispositionPK, String inventoryDispositionAdjustmentName, InventoryAdjustmentTypePK inventoryAdjustmentTypePK, InventoryBucketTypePK inventoryBucketTypePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
094            throws PersistenceNotNullException {
095        super(inventoryDispositionAdjustmentDetailPK);
096        constructFields(inventoryDispositionAdjustmentPK, inventoryDispositionPK, inventoryDispositionAdjustmentName, inventoryAdjustmentTypePK, inventoryBucketTypePK, isDefault, sortOrder, fromTime, thruTime);
097    }
098    
099    /** Creates a new instance of InventoryDispositionAdjustmentDetailValue */
100    public InventoryDispositionAdjustmentDetailValue(InventoryDispositionAdjustmentPK inventoryDispositionAdjustmentPK, InventoryDispositionPK inventoryDispositionPK, String inventoryDispositionAdjustmentName, InventoryAdjustmentTypePK inventoryAdjustmentTypePK, InventoryBucketTypePK inventoryBucketTypePK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
101            throws PersistenceNotNullException {
102        super();
103        constructFields(inventoryDispositionAdjustmentPK, inventoryDispositionPK, inventoryDispositionAdjustmentName, inventoryAdjustmentTypePK, inventoryBucketTypePK, isDefault, sortOrder, fromTime, thruTime);
104    }
105    
106    @Override
107    @Nonnull
108    public InventoryDispositionAdjustmentDetailFactory getBaseFactoryInstance() {
109        return InventoryDispositionAdjustmentDetailFactory.getInstance();
110    }
111    
112    @Override
113    @Nonnull
114    public InventoryDispositionAdjustmentDetailValue clone() {
115        Object result;
116        
117        try {
118            result = super.clone();
119        } catch (CloneNotSupportedException cnse) {
120            // This shouldn't happen, fail when it does.
121            throw new PersistenceCloneException(cnse);
122        }
123        
124        return (InventoryDispositionAdjustmentDetailValue)result;
125    }
126    
127    @Override
128    @Nonnull
129    public InventoryDispositionAdjustmentDetailPK getPrimaryKey() {
130        if(_primaryKey == null) {
131            _primaryKey = new InventoryDispositionAdjustmentDetailPK(entityId);
132        }
133        
134        return _primaryKey;
135    }
136    
137    private void clearHashAndString() {
138        _hashCode = null;
139        _stringValue = null;
140    }
141    
142    @Override
143    public int hashCode() {
144        if(_hashCode == null) {
145            int hashCode = 17;
146            
147            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
148            
149            hashCode = 37 * hashCode + ((inventoryDispositionAdjustmentPK != null) ? inventoryDispositionAdjustmentPK.hashCode() : 0);
150            hashCode = 37 * hashCode + ((inventoryDispositionPK != null) ? inventoryDispositionPK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((inventoryDispositionAdjustmentName != null) ? inventoryDispositionAdjustmentName.hashCode() : 0);
152            hashCode = 37 * hashCode + ((inventoryAdjustmentTypePK != null) ? inventoryAdjustmentTypePK.hashCode() : 0);
153            hashCode = 37 * hashCode + ((inventoryBucketTypePK != null) ? inventoryBucketTypePK.hashCode() : 0);
154            hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0);
155            hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0);
156            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
157            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
158            
159            _hashCode = hashCode;
160        }
161        
162        return _hashCode;
163    }
164    
165    @Override
166    @Nonnull
167    public String toString() {
168        if(_stringValue == null) {
169            _stringValue = "{" + 
170                    "entityId=" + getEntityId() +
171                    ", inventoryDispositionAdjustmentPK=" + getInventoryDispositionAdjustmentPK() +
172                    ", inventoryDispositionPK=" + getInventoryDispositionPK() +
173                    ", inventoryDispositionAdjustmentName=" + getInventoryDispositionAdjustmentName() +
174                    ", inventoryAdjustmentTypePK=" + getInventoryAdjustmentTypePK() +
175                    ", inventoryBucketTypePK=" + getInventoryBucketTypePK() +
176                    ", isDefault=" + getIsDefault() +
177                    ", sortOrder=" + getSortOrder() +
178                    ", fromTime=" + getFromTime() +
179                    ", thruTime=" + getThruTime() +
180                    "}";
181        }
182        return _stringValue;
183    }
184    
185    @Override
186    public boolean equals(Object other) {
187        if(this == other)
188            return true;
189        
190        if(!hasIdentity())
191            return false;
192        
193        if(other instanceof  InventoryDispositionAdjustmentDetailValue that) {
194            if(!that.hasIdentity())
195                return false;
196            
197            Long thisEntityId = getEntityId();
198            Long thatEntityId = that.getEntityId();
199            
200            boolean objectsEqual = thisEntityId.equals(thatEntityId);
201            if(objectsEqual)
202                objectsEqual = isIdentical(that);
203            
204            return objectsEqual;
205        } else {
206            return false;
207        }
208    }
209    
210    public boolean isIdentical(Object other) {
211        if(other instanceof InventoryDispositionAdjustmentDetailValue that) {
212            boolean objectsEqual = true;
213            
214            
215            if(objectsEqual) {
216                InventoryDispositionAdjustmentPK thisInventoryDispositionAdjustmentPK = getInventoryDispositionAdjustmentPK();
217                InventoryDispositionAdjustmentPK thatInventoryDispositionAdjustmentPK = that.getInventoryDispositionAdjustmentPK();
218                
219                if(thisInventoryDispositionAdjustmentPK == null) {
220                    objectsEqual = objectsEqual && (thatInventoryDispositionAdjustmentPK == null);
221                } else {
222                    objectsEqual = objectsEqual && thisInventoryDispositionAdjustmentPK.equals(thatInventoryDispositionAdjustmentPK);
223                }
224            }
225            
226            if(objectsEqual) {
227                InventoryDispositionPK thisInventoryDispositionPK = getInventoryDispositionPK();
228                InventoryDispositionPK thatInventoryDispositionPK = that.getInventoryDispositionPK();
229                
230                if(thisInventoryDispositionPK == null) {
231                    objectsEqual = objectsEqual && (thatInventoryDispositionPK == null);
232                } else {
233                    objectsEqual = objectsEqual && thisInventoryDispositionPK.equals(thatInventoryDispositionPK);
234                }
235            }
236            
237            if(objectsEqual) {
238                String thisInventoryDispositionAdjustmentName = getInventoryDispositionAdjustmentName();
239                String thatInventoryDispositionAdjustmentName = that.getInventoryDispositionAdjustmentName();
240                
241                if(thisInventoryDispositionAdjustmentName == null) {
242                    objectsEqual = objectsEqual && (thatInventoryDispositionAdjustmentName == null);
243                } else {
244                    objectsEqual = objectsEqual && thisInventoryDispositionAdjustmentName.equals(thatInventoryDispositionAdjustmentName);
245                }
246            }
247            
248            if(objectsEqual) {
249                InventoryAdjustmentTypePK thisInventoryAdjustmentTypePK = getInventoryAdjustmentTypePK();
250                InventoryAdjustmentTypePK thatInventoryAdjustmentTypePK = that.getInventoryAdjustmentTypePK();
251                
252                if(thisInventoryAdjustmentTypePK == null) {
253                    objectsEqual = objectsEqual && (thatInventoryAdjustmentTypePK == null);
254                } else {
255                    objectsEqual = objectsEqual && thisInventoryAdjustmentTypePK.equals(thatInventoryAdjustmentTypePK);
256                }
257            }
258            
259            if(objectsEqual) {
260                InventoryBucketTypePK thisInventoryBucketTypePK = getInventoryBucketTypePK();
261                InventoryBucketTypePK thatInventoryBucketTypePK = that.getInventoryBucketTypePK();
262                
263                if(thisInventoryBucketTypePK == null) {
264                    objectsEqual = objectsEqual && (thatInventoryBucketTypePK == null);
265                } else {
266                    objectsEqual = objectsEqual && thisInventoryBucketTypePK.equals(thatInventoryBucketTypePK);
267                }
268            }
269            
270            if(objectsEqual) {
271                Boolean thisIsDefault = getIsDefault();
272                Boolean thatIsDefault = that.getIsDefault();
273                
274                if(thisIsDefault == null) {
275                    objectsEqual = objectsEqual && (thatIsDefault == null);
276                } else {
277                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
278                }
279            }
280            
281            if(objectsEqual) {
282                Integer thisSortOrder = getSortOrder();
283                Integer thatSortOrder = that.getSortOrder();
284                
285                if(thisSortOrder == null) {
286                    objectsEqual = objectsEqual && (thatSortOrder == null);
287                } else {
288                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
289                }
290            }
291            
292            if(objectsEqual) {
293                Long thisFromTime = getFromTime();
294                Long thatFromTime = that.getFromTime();
295                
296                if(thisFromTime == null) {
297                    objectsEqual = objectsEqual && (thatFromTime == null);
298                } else {
299                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
300                }
301            }
302            
303            if(objectsEqual) {
304                Long thisThruTime = getThruTime();
305                Long thatThruTime = that.getThruTime();
306                
307                if(thisThruTime == null) {
308                    objectsEqual = objectsEqual && (thatThruTime == null);
309                } else {
310                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
311                }
312            }
313            
314            return objectsEqual;
315        } else {
316            return false;
317        }
318    }
319    
320    @Override
321    public boolean hasBeenModified() {
322        return inventoryDispositionAdjustmentPKHasBeenModified || inventoryDispositionPKHasBeenModified || inventoryDispositionAdjustmentNameHasBeenModified || inventoryAdjustmentTypePKHasBeenModified || inventoryBucketTypePKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
323    }
324    
325    @Override
326    public void clearHasBeenModified() {
327        inventoryDispositionAdjustmentPKHasBeenModified = false;
328        inventoryDispositionPKHasBeenModified = false;
329        inventoryDispositionAdjustmentNameHasBeenModified = false;
330        inventoryAdjustmentTypePKHasBeenModified = false;
331        inventoryBucketTypePKHasBeenModified = false;
332        isDefaultHasBeenModified = false;
333        sortOrderHasBeenModified = false;
334        fromTimeHasBeenModified = false;
335        thruTimeHasBeenModified = false;
336    }
337    
338    @Nonnull
339    public InventoryDispositionAdjustmentPK getInventoryDispositionAdjustmentPK() {
340        return inventoryDispositionAdjustmentPK;
341    }
342    
343    public void setInventoryDispositionAdjustmentPK(@Nonnull InventoryDispositionAdjustmentPK inventoryDispositionAdjustmentPK)
344            throws PersistenceNotNullException {
345        checkForNull(inventoryDispositionAdjustmentPK);
346        
347        boolean update = true;
348        
349        if(this.inventoryDispositionAdjustmentPK != null) {
350            if(this.inventoryDispositionAdjustmentPK.equals(inventoryDispositionAdjustmentPK)) {
351                update = false;
352            }
353        } else if(inventoryDispositionAdjustmentPK == null) {
354            update = false;
355        }
356        
357        if(update) {
358            this.inventoryDispositionAdjustmentPK = inventoryDispositionAdjustmentPK;
359            inventoryDispositionAdjustmentPKHasBeenModified = true;
360            clearHashAndString();
361        }
362    }
363    
364    public boolean getInventoryDispositionAdjustmentPKHasBeenModified() {
365        return inventoryDispositionAdjustmentPKHasBeenModified;
366    }
367    
368    @Nonnull
369    public InventoryDispositionPK getInventoryDispositionPK() {
370        return inventoryDispositionPK;
371    }
372    
373    public void setInventoryDispositionPK(@Nonnull InventoryDispositionPK inventoryDispositionPK)
374            throws PersistenceNotNullException {
375        checkForNull(inventoryDispositionPK);
376        
377        boolean update = true;
378        
379        if(this.inventoryDispositionPK != null) {
380            if(this.inventoryDispositionPK.equals(inventoryDispositionPK)) {
381                update = false;
382            }
383        } else if(inventoryDispositionPK == null) {
384            update = false;
385        }
386        
387        if(update) {
388            this.inventoryDispositionPK = inventoryDispositionPK;
389            inventoryDispositionPKHasBeenModified = true;
390            clearHashAndString();
391        }
392    }
393    
394    public boolean getInventoryDispositionPKHasBeenModified() {
395        return inventoryDispositionPKHasBeenModified;
396    }
397    
398    @Nonnull
399    public String getInventoryDispositionAdjustmentName() {
400        return inventoryDispositionAdjustmentName;
401    }
402    
403    public void setInventoryDispositionAdjustmentName(@Nonnull String inventoryDispositionAdjustmentName)
404            throws PersistenceNotNullException {
405        checkForNull(inventoryDispositionAdjustmentName);
406        
407        boolean update = true;
408        
409        if(this.inventoryDispositionAdjustmentName != null) {
410            if(this.inventoryDispositionAdjustmentName.equals(inventoryDispositionAdjustmentName)) {
411                update = false;
412            }
413        } else if(inventoryDispositionAdjustmentName == null) {
414            update = false;
415        }
416        
417        if(update) {
418            this.inventoryDispositionAdjustmentName = inventoryDispositionAdjustmentName;
419            inventoryDispositionAdjustmentNameHasBeenModified = true;
420            clearHashAndString();
421        }
422    }
423    
424    public boolean getInventoryDispositionAdjustmentNameHasBeenModified() {
425        return inventoryDispositionAdjustmentNameHasBeenModified;
426    }
427    
428    @Nonnull
429    public InventoryAdjustmentTypePK getInventoryAdjustmentTypePK() {
430        return inventoryAdjustmentTypePK;
431    }
432    
433    public void setInventoryAdjustmentTypePK(@Nonnull InventoryAdjustmentTypePK inventoryAdjustmentTypePK)
434            throws PersistenceNotNullException {
435        checkForNull(inventoryAdjustmentTypePK);
436        
437        boolean update = true;
438        
439        if(this.inventoryAdjustmentTypePK != null) {
440            if(this.inventoryAdjustmentTypePK.equals(inventoryAdjustmentTypePK)) {
441                update = false;
442            }
443        } else if(inventoryAdjustmentTypePK == null) {
444            update = false;
445        }
446        
447        if(update) {
448            this.inventoryAdjustmentTypePK = inventoryAdjustmentTypePK;
449            inventoryAdjustmentTypePKHasBeenModified = true;
450            clearHashAndString();
451        }
452    }
453    
454    public boolean getInventoryAdjustmentTypePKHasBeenModified() {
455        return inventoryAdjustmentTypePKHasBeenModified;
456    }
457    
458    @Nonnull
459    public InventoryBucketTypePK getInventoryBucketTypePK() {
460        return inventoryBucketTypePK;
461    }
462    
463    public void setInventoryBucketTypePK(@Nonnull InventoryBucketTypePK inventoryBucketTypePK)
464            throws PersistenceNotNullException {
465        checkForNull(inventoryBucketTypePK);
466        
467        boolean update = true;
468        
469        if(this.inventoryBucketTypePK != null) {
470            if(this.inventoryBucketTypePK.equals(inventoryBucketTypePK)) {
471                update = false;
472            }
473        } else if(inventoryBucketTypePK == null) {
474            update = false;
475        }
476        
477        if(update) {
478            this.inventoryBucketTypePK = inventoryBucketTypePK;
479            inventoryBucketTypePKHasBeenModified = true;
480            clearHashAndString();
481        }
482    }
483    
484    public boolean getInventoryBucketTypePKHasBeenModified() {
485        return inventoryBucketTypePKHasBeenModified;
486    }
487    
488    @Nonnull
489    public Boolean getIsDefault() {
490        return isDefault;
491    }
492    
493    public void setIsDefault(@Nonnull Boolean isDefault)
494            throws PersistenceNotNullException {
495        checkForNull(isDefault);
496        
497        boolean update = true;
498        
499        if(this.isDefault != null) {
500            if(this.isDefault.equals(isDefault)) {
501                update = false;
502            }
503        } else if(isDefault == null) {
504            update = false;
505        }
506        
507        if(update) {
508            this.isDefault = isDefault;
509            isDefaultHasBeenModified = true;
510            clearHashAndString();
511        }
512    }
513    
514    public boolean getIsDefaultHasBeenModified() {
515        return isDefaultHasBeenModified;
516    }
517    
518    @Nonnull
519    public Integer getSortOrder() {
520        return sortOrder;
521    }
522    
523    public void setSortOrder(@Nonnull Integer sortOrder)
524            throws PersistenceNotNullException {
525        checkForNull(sortOrder);
526        
527        boolean update = true;
528        
529        if(this.sortOrder != null) {
530            if(this.sortOrder.equals(sortOrder)) {
531                update = false;
532            }
533        } else if(sortOrder == null) {
534            update = false;
535        }
536        
537        if(update) {
538            this.sortOrder = sortOrder;
539            sortOrderHasBeenModified = true;
540            clearHashAndString();
541        }
542    }
543    
544    public boolean getSortOrderHasBeenModified() {
545        return sortOrderHasBeenModified;
546    }
547    
548    @Nonnull
549    public Long getFromTime() {
550        return fromTime;
551    }
552    
553    public void setFromTime(@Nonnull Long fromTime)
554            throws PersistenceNotNullException {
555        checkForNull(fromTime);
556        
557        boolean update = true;
558        
559        if(this.fromTime != null) {
560            if(this.fromTime.equals(fromTime)) {
561                update = false;
562            }
563        } else if(fromTime == null) {
564            update = false;
565        }
566        
567        if(update) {
568            this.fromTime = fromTime;
569            fromTimeHasBeenModified = true;
570            clearHashAndString();
571        }
572    }
573    
574    public boolean getFromTimeHasBeenModified() {
575        return fromTimeHasBeenModified;
576    }
577    
578    @Nonnull
579    public Long getThruTime() {
580        return thruTime;
581    }
582    
583    public void setThruTime(@Nonnull Long thruTime)
584            throws PersistenceNotNullException {
585        checkForNull(thruTime);
586        
587        boolean update = true;
588        
589        if(this.thruTime != null) {
590            if(this.thruTime.equals(thruTime)) {
591                update = false;
592            }
593        } else if(thruTime == null) {
594            update = false;
595        }
596        
597        if(update) {
598            this.thruTime = thruTime;
599            thruTimeHasBeenModified = true;
600            clearHashAndString();
601        }
602    }
603    
604    public boolean getThruTimeHasBeenModified() {
605        return thruTimeHasBeenModified;
606    }
607    
608}