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