001// --------------------------------------------------------------------------------
002// Copyright 2002-2025 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 * ShipmentPackageLineDetailValue.java
021 */
022
023package com.echothree.model.data.shipment.server.value;
024
025import com.echothree.model.data.shipment.common.pk.ShipmentPackageLineDetailPK;
026
027import com.echothree.model.data.shipment.server.factory.ShipmentPackageLineDetailFactory;
028
029import com.echothree.model.data.shipment.common.pk.ShipmentPackageLinePK;
030import com.echothree.model.data.shipment.common.pk.ShipmentPackagePK;
031import com.echothree.model.data.shipment.common.pk.ShipmentLinePK;
032import com.echothree.model.data.item.common.pk.ItemPK;
033import com.echothree.model.data.inventory.common.pk.InventoryConditionPK;
034import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK;
035
036import com.echothree.util.common.exception.PersistenceCloneException;
037import com.echothree.util.common.exception.PersistenceNotNullException;
038
039import com.echothree.util.server.persistence.BaseValue;
040
041import java.io.Serializable;
042
043public class ShipmentPackageLineDetailValue
044        extends BaseValue<ShipmentPackageLineDetailPK>
045        implements Cloneable, Serializable {
046    
047    private ShipmentPackageLinePK shipmentPackageLinePK;
048    private boolean shipmentPackageLinePKHasBeenModified = false;
049    private ShipmentPackagePK shipmentPackagePK;
050    private boolean shipmentPackagePKHasBeenModified = false;
051    private Integer shipmentPackageLineSequence;
052    private boolean shipmentPackageLineSequenceHasBeenModified = false;
053    private ShipmentLinePK shipmentLinePK;
054    private boolean shipmentLinePKHasBeenModified = false;
055    private ItemPK itemPK;
056    private boolean itemPKHasBeenModified = false;
057    private InventoryConditionPK inventoryConditionPK;
058    private boolean inventoryConditionPKHasBeenModified = false;
059    private UnitOfMeasureTypePK unitOfMeasureTypePK;
060    private boolean unitOfMeasureTypePKHasBeenModified = false;
061    private Long quantity;
062    private boolean quantityHasBeenModified = false;
063    private Long fromTime;
064    private boolean fromTimeHasBeenModified = false;
065    private Long thruTime;
066    private boolean thruTimeHasBeenModified = false;
067    
068    private transient Integer _hashCode = null;
069    private transient String _stringValue = null;
070    
071    private void constructFields(ShipmentPackageLinePK shipmentPackageLinePK, ShipmentPackagePK shipmentPackagePK, Integer shipmentPackageLineSequence, ShipmentLinePK shipmentLinePK, ItemPK itemPK, InventoryConditionPK inventoryConditionPK, UnitOfMeasureTypePK unitOfMeasureTypePK, Long quantity, Long fromTime, Long thruTime)
072            throws PersistenceNotNullException {
073        checkForNull(shipmentPackageLinePK);
074        this.shipmentPackageLinePK = shipmentPackageLinePK;
075        checkForNull(shipmentPackagePK);
076        this.shipmentPackagePK = shipmentPackagePK;
077        checkForNull(shipmentPackageLineSequence);
078        this.shipmentPackageLineSequence = shipmentPackageLineSequence;
079        this.shipmentLinePK = shipmentLinePK;
080        checkForNull(itemPK);
081        this.itemPK = itemPK;
082        checkForNull(inventoryConditionPK);
083        this.inventoryConditionPK = inventoryConditionPK;
084        checkForNull(unitOfMeasureTypePK);
085        this.unitOfMeasureTypePK = unitOfMeasureTypePK;
086        checkForNull(quantity);
087        this.quantity = quantity;
088        checkForNull(fromTime);
089        this.fromTime = fromTime;
090        checkForNull(thruTime);
091        this.thruTime = thruTime;
092    }
093    
094    /** Creates a new instance of ShipmentPackageLineDetailValue */
095    public ShipmentPackageLineDetailValue(ShipmentPackageLineDetailPK shipmentPackageLineDetailPK, ShipmentPackageLinePK shipmentPackageLinePK, ShipmentPackagePK shipmentPackagePK, Integer shipmentPackageLineSequence, ShipmentLinePK shipmentLinePK, ItemPK itemPK, InventoryConditionPK inventoryConditionPK, UnitOfMeasureTypePK unitOfMeasureTypePK, Long quantity, Long fromTime, Long thruTime)
096            throws PersistenceNotNullException {
097        super(shipmentPackageLineDetailPK);
098        constructFields(shipmentPackageLinePK, shipmentPackagePK, shipmentPackageLineSequence, shipmentLinePK, itemPK, inventoryConditionPK, unitOfMeasureTypePK, quantity, fromTime, thruTime);
099    }
100    
101    /** Creates a new instance of ShipmentPackageLineDetailValue */
102    public ShipmentPackageLineDetailValue(ShipmentPackageLinePK shipmentPackageLinePK, ShipmentPackagePK shipmentPackagePK, Integer shipmentPackageLineSequence, ShipmentLinePK shipmentLinePK, ItemPK itemPK, InventoryConditionPK inventoryConditionPK, UnitOfMeasureTypePK unitOfMeasureTypePK, Long quantity, Long fromTime, Long thruTime)
103            throws PersistenceNotNullException {
104        super();
105        constructFields(shipmentPackageLinePK, shipmentPackagePK, shipmentPackageLineSequence, shipmentLinePK, itemPK, inventoryConditionPK, unitOfMeasureTypePK, quantity, fromTime, thruTime);
106    }
107    
108   @Override
109   public ShipmentPackageLineDetailFactory getBaseFactoryInstance() {
110        return ShipmentPackageLineDetailFactory.getInstance();
111    }
112    
113    @Override
114    public ShipmentPackageLineDetailValue 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 (ShipmentPackageLineDetailValue)result;
125    }
126    
127   @Override
128    public ShipmentPackageLineDetailPK getPrimaryKey() {
129        if(_primaryKey == null) {
130            _primaryKey = new ShipmentPackageLineDetailPK(entityId);
131        }
132        
133        return _primaryKey;
134    }
135    
136    private void clearHashAndString() {
137        _hashCode = null;
138        _stringValue = null;
139    }
140    
141    @Override
142    public int hashCode() {
143        if(_hashCode == null) {
144            int hashCode = 17;
145            
146            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
147            
148            hashCode = 37 * hashCode + ((shipmentPackageLinePK != null) ? shipmentPackageLinePK.hashCode() : 0);
149            hashCode = 37 * hashCode + ((shipmentPackagePK != null) ? shipmentPackagePK.hashCode() : 0);
150            hashCode = 37 * hashCode + ((shipmentPackageLineSequence != null) ? shipmentPackageLineSequence.hashCode() : 0);
151            hashCode = 37 * hashCode + ((shipmentLinePK != null) ? shipmentLinePK.hashCode() : 0);
152            hashCode = 37 * hashCode + ((itemPK != null) ? itemPK.hashCode() : 0);
153            hashCode = 37 * hashCode + ((inventoryConditionPK != null) ? inventoryConditionPK.hashCode() : 0);
154            hashCode = 37 * hashCode + ((unitOfMeasureTypePK != null) ? unitOfMeasureTypePK.hashCode() : 0);
155            hashCode = 37 * hashCode + ((quantity != null) ? quantity.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    public String toString() {
167        if(_stringValue == null) {
168            _stringValue = "{" + 
169                    "entityId=" + getEntityId() +
170                    ", shipmentPackageLinePK=" + getShipmentPackageLinePK() +
171                    ", shipmentPackagePK=" + getShipmentPackagePK() +
172                    ", shipmentPackageLineSequence=" + getShipmentPackageLineSequence() +
173                    ", shipmentLinePK=" + getShipmentLinePK() +
174                    ", itemPK=" + getItemPK() +
175                    ", inventoryConditionPK=" + getInventoryConditionPK() +
176                    ", unitOfMeasureTypePK=" + getUnitOfMeasureTypePK() +
177                    ", quantity=" + getQuantity() +
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  ShipmentPackageLineDetailValue 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 ShipmentPackageLineDetailValue that) {
212            boolean objectsEqual = true;
213            
214            
215            if(objectsEqual) {
216                ShipmentPackageLinePK thisShipmentPackageLinePK = getShipmentPackageLinePK();
217                ShipmentPackageLinePK thatShipmentPackageLinePK = that.getShipmentPackageLinePK();
218                
219                if(thisShipmentPackageLinePK == null) {
220                    objectsEqual = objectsEqual && (thatShipmentPackageLinePK == null);
221                } else {
222                    objectsEqual = objectsEqual && thisShipmentPackageLinePK.equals(thatShipmentPackageLinePK);
223                }
224            }
225            
226            if(objectsEqual) {
227                ShipmentPackagePK thisShipmentPackagePK = getShipmentPackagePK();
228                ShipmentPackagePK thatShipmentPackagePK = that.getShipmentPackagePK();
229                
230                if(thisShipmentPackagePK == null) {
231                    objectsEqual = objectsEqual && (thatShipmentPackagePK == null);
232                } else {
233                    objectsEqual = objectsEqual && thisShipmentPackagePK.equals(thatShipmentPackagePK);
234                }
235            }
236            
237            if(objectsEqual) {
238                Integer thisShipmentPackageLineSequence = getShipmentPackageLineSequence();
239                Integer thatShipmentPackageLineSequence = that.getShipmentPackageLineSequence();
240                
241                if(thisShipmentPackageLineSequence == null) {
242                    objectsEqual = objectsEqual && (thatShipmentPackageLineSequence == null);
243                } else {
244                    objectsEqual = objectsEqual && thisShipmentPackageLineSequence.equals(thatShipmentPackageLineSequence);
245                }
246            }
247            
248            if(objectsEqual) {
249                ShipmentLinePK thisShipmentLinePK = getShipmentLinePK();
250                ShipmentLinePK thatShipmentLinePK = that.getShipmentLinePK();
251                
252                if(thisShipmentLinePK == null) {
253                    objectsEqual = objectsEqual && (thatShipmentLinePK == null);
254                } else {
255                    objectsEqual = objectsEqual && thisShipmentLinePK.equals(thatShipmentLinePK);
256                }
257            }
258            
259            if(objectsEqual) {
260                ItemPK thisItemPK = getItemPK();
261                ItemPK thatItemPK = that.getItemPK();
262                
263                if(thisItemPK == null) {
264                    objectsEqual = objectsEqual && (thatItemPK == null);
265                } else {
266                    objectsEqual = objectsEqual && thisItemPK.equals(thatItemPK);
267                }
268            }
269            
270            if(objectsEqual) {
271                InventoryConditionPK thisInventoryConditionPK = getInventoryConditionPK();
272                InventoryConditionPK thatInventoryConditionPK = that.getInventoryConditionPK();
273                
274                if(thisInventoryConditionPK == null) {
275                    objectsEqual = objectsEqual && (thatInventoryConditionPK == null);
276                } else {
277                    objectsEqual = objectsEqual && thisInventoryConditionPK.equals(thatInventoryConditionPK);
278                }
279            }
280            
281            if(objectsEqual) {
282                UnitOfMeasureTypePK thisUnitOfMeasureTypePK = getUnitOfMeasureTypePK();
283                UnitOfMeasureTypePK thatUnitOfMeasureTypePK = that.getUnitOfMeasureTypePK();
284                
285                if(thisUnitOfMeasureTypePK == null) {
286                    objectsEqual = objectsEqual && (thatUnitOfMeasureTypePK == null);
287                } else {
288                    objectsEqual = objectsEqual && thisUnitOfMeasureTypePK.equals(thatUnitOfMeasureTypePK);
289                }
290            }
291            
292            if(objectsEqual) {
293                Long thisQuantity = getQuantity();
294                Long thatQuantity = that.getQuantity();
295                
296                if(thisQuantity == null) {
297                    objectsEqual = objectsEqual && (thatQuantity == null);
298                } else {
299                    objectsEqual = objectsEqual && thisQuantity.equals(thatQuantity);
300                }
301            }
302            
303            if(objectsEqual) {
304                Long thisFromTime = getFromTime();
305                Long thatFromTime = that.getFromTime();
306                
307                if(thisFromTime == null) {
308                    objectsEqual = objectsEqual && (thatFromTime == null);
309                } else {
310                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
311                }
312            }
313            
314            if(objectsEqual) {
315                Long thisThruTime = getThruTime();
316                Long thatThruTime = that.getThruTime();
317                
318                if(thisThruTime == null) {
319                    objectsEqual = objectsEqual && (thatThruTime == null);
320                } else {
321                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
322                }
323            }
324            
325            return objectsEqual;
326        } else {
327            return false;
328        }
329    }
330    
331    @Override
332    public boolean hasBeenModified() {
333        return shipmentPackageLinePKHasBeenModified || shipmentPackagePKHasBeenModified || shipmentPackageLineSequenceHasBeenModified || shipmentLinePKHasBeenModified || itemPKHasBeenModified || inventoryConditionPKHasBeenModified || unitOfMeasureTypePKHasBeenModified || quantityHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
334    }
335    
336    @Override
337    public void clearHasBeenModified() {
338        shipmentPackageLinePKHasBeenModified = false;
339        shipmentPackagePKHasBeenModified = false;
340        shipmentPackageLineSequenceHasBeenModified = false;
341        shipmentLinePKHasBeenModified = false;
342        itemPKHasBeenModified = false;
343        inventoryConditionPKHasBeenModified = false;
344        unitOfMeasureTypePKHasBeenModified = false;
345        quantityHasBeenModified = false;
346        fromTimeHasBeenModified = false;
347        thruTimeHasBeenModified = false;
348    }
349    
350    public ShipmentPackageLinePK getShipmentPackageLinePK() {
351        return shipmentPackageLinePK;
352    }
353    
354    public void setShipmentPackageLinePK(ShipmentPackageLinePK shipmentPackageLinePK)
355            throws PersistenceNotNullException {
356        checkForNull(shipmentPackageLinePK);
357        
358        boolean update = true;
359        
360        if(this.shipmentPackageLinePK != null) {
361            if(this.shipmentPackageLinePK.equals(shipmentPackageLinePK)) {
362                update = false;
363            }
364        } else if(shipmentPackageLinePK == null) {
365            update = false;
366        }
367        
368        if(update) {
369            this.shipmentPackageLinePK = shipmentPackageLinePK;
370            shipmentPackageLinePKHasBeenModified = true;
371            clearHashAndString();
372        }
373    }
374    
375    public boolean getShipmentPackageLinePKHasBeenModified() {
376        return shipmentPackageLinePKHasBeenModified;
377    }
378    
379    public ShipmentPackagePK getShipmentPackagePK() {
380        return shipmentPackagePK;
381    }
382    
383    public void setShipmentPackagePK(ShipmentPackagePK shipmentPackagePK)
384            throws PersistenceNotNullException {
385        checkForNull(shipmentPackagePK);
386        
387        boolean update = true;
388        
389        if(this.shipmentPackagePK != null) {
390            if(this.shipmentPackagePK.equals(shipmentPackagePK)) {
391                update = false;
392            }
393        } else if(shipmentPackagePK == null) {
394            update = false;
395        }
396        
397        if(update) {
398            this.shipmentPackagePK = shipmentPackagePK;
399            shipmentPackagePKHasBeenModified = true;
400            clearHashAndString();
401        }
402    }
403    
404    public boolean getShipmentPackagePKHasBeenModified() {
405        return shipmentPackagePKHasBeenModified;
406    }
407    
408    public Integer getShipmentPackageLineSequence() {
409        return shipmentPackageLineSequence;
410    }
411    
412    public void setShipmentPackageLineSequence(Integer shipmentPackageLineSequence)
413            throws PersistenceNotNullException {
414        checkForNull(shipmentPackageLineSequence);
415        
416        boolean update = true;
417        
418        if(this.shipmentPackageLineSequence != null) {
419            if(this.shipmentPackageLineSequence.equals(shipmentPackageLineSequence)) {
420                update = false;
421            }
422        } else if(shipmentPackageLineSequence == null) {
423            update = false;
424        }
425        
426        if(update) {
427            this.shipmentPackageLineSequence = shipmentPackageLineSequence;
428            shipmentPackageLineSequenceHasBeenModified = true;
429            clearHashAndString();
430        }
431    }
432    
433    public boolean getShipmentPackageLineSequenceHasBeenModified() {
434        return shipmentPackageLineSequenceHasBeenModified;
435    }
436    
437    public ShipmentLinePK getShipmentLinePK() {
438        return shipmentLinePK;
439    }
440    
441    public void setShipmentLinePK(ShipmentLinePK shipmentLinePK) {
442        boolean update = true;
443        
444        if(this.shipmentLinePK != null) {
445            if(this.shipmentLinePK.equals(shipmentLinePK)) {
446                update = false;
447            }
448        } else if(shipmentLinePK == null) {
449            update = false;
450        }
451        
452        if(update) {
453            this.shipmentLinePK = shipmentLinePK;
454            shipmentLinePKHasBeenModified = true;
455            clearHashAndString();
456        }
457    }
458    
459    public boolean getShipmentLinePKHasBeenModified() {
460        return shipmentLinePKHasBeenModified;
461    }
462    
463    public ItemPK getItemPK() {
464        return itemPK;
465    }
466    
467    public void setItemPK(ItemPK itemPK)
468            throws PersistenceNotNullException {
469        checkForNull(itemPK);
470        
471        boolean update = true;
472        
473        if(this.itemPK != null) {
474            if(this.itemPK.equals(itemPK)) {
475                update = false;
476            }
477        } else if(itemPK == null) {
478            update = false;
479        }
480        
481        if(update) {
482            this.itemPK = itemPK;
483            itemPKHasBeenModified = true;
484            clearHashAndString();
485        }
486    }
487    
488    public boolean getItemPKHasBeenModified() {
489        return itemPKHasBeenModified;
490    }
491    
492    public InventoryConditionPK getInventoryConditionPK() {
493        return inventoryConditionPK;
494    }
495    
496    public void setInventoryConditionPK(InventoryConditionPK inventoryConditionPK)
497            throws PersistenceNotNullException {
498        checkForNull(inventoryConditionPK);
499        
500        boolean update = true;
501        
502        if(this.inventoryConditionPK != null) {
503            if(this.inventoryConditionPK.equals(inventoryConditionPK)) {
504                update = false;
505            }
506        } else if(inventoryConditionPK == null) {
507            update = false;
508        }
509        
510        if(update) {
511            this.inventoryConditionPK = inventoryConditionPK;
512            inventoryConditionPKHasBeenModified = true;
513            clearHashAndString();
514        }
515    }
516    
517    public boolean getInventoryConditionPKHasBeenModified() {
518        return inventoryConditionPKHasBeenModified;
519    }
520    
521    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
522        return unitOfMeasureTypePK;
523    }
524    
525    public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK)
526            throws PersistenceNotNullException {
527        checkForNull(unitOfMeasureTypePK);
528        
529        boolean update = true;
530        
531        if(this.unitOfMeasureTypePK != null) {
532            if(this.unitOfMeasureTypePK.equals(unitOfMeasureTypePK)) {
533                update = false;
534            }
535        } else if(unitOfMeasureTypePK == null) {
536            update = false;
537        }
538        
539        if(update) {
540            this.unitOfMeasureTypePK = unitOfMeasureTypePK;
541            unitOfMeasureTypePKHasBeenModified = true;
542            clearHashAndString();
543        }
544    }
545    
546    public boolean getUnitOfMeasureTypePKHasBeenModified() {
547        return unitOfMeasureTypePKHasBeenModified;
548    }
549    
550    public Long getQuantity() {
551        return quantity;
552    }
553    
554    public void setQuantity(Long quantity)
555            throws PersistenceNotNullException {
556        checkForNull(quantity);
557        
558        boolean update = true;
559        
560        if(this.quantity != null) {
561            if(this.quantity.equals(quantity)) {
562                update = false;
563            }
564        } else if(quantity == null) {
565            update = false;
566        }
567        
568        if(update) {
569            this.quantity = quantity;
570            quantityHasBeenModified = true;
571            clearHashAndString();
572        }
573    }
574    
575    public boolean getQuantityHasBeenModified() {
576        return quantityHasBeenModified;
577    }
578    
579    public Long getFromTime() {
580        return fromTime;
581    }
582    
583    public void setFromTime(Long fromTime)
584            throws PersistenceNotNullException {
585        checkForNull(fromTime);
586        
587        boolean update = true;
588        
589        if(this.fromTime != null) {
590            if(this.fromTime.equals(fromTime)) {
591                update = false;
592            }
593        } else if(fromTime == null) {
594            update = false;
595        }
596        
597        if(update) {
598            this.fromTime = fromTime;
599            fromTimeHasBeenModified = true;
600            clearHashAndString();
601        }
602    }
603    
604    public boolean getFromTimeHasBeenModified() {
605        return fromTimeHasBeenModified;
606    }
607    
608    public Long getThruTime() {
609        return thruTime;
610    }
611    
612    public void setThruTime(Long thruTime)
613            throws PersistenceNotNullException {
614        checkForNull(thruTime);
615        
616        boolean update = true;
617        
618        if(this.thruTime != null) {
619            if(this.thruTime.equals(thruTime)) {
620                update = false;
621            }
622        } else if(thruTime == null) {
623            update = false;
624        }
625        
626        if(update) {
627            this.thruTime = thruTime;
628            thruTimeHasBeenModified = true;
629            clearHashAndString();
630        }
631    }
632    
633    public boolean getThruTimeHasBeenModified() {
634        return thruTimeHasBeenModified;
635    }
636    
637}