001// --------------------------------------------------------------------------------
002// Copyright 2002-2024 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            StringBuilder stringValue = new StringBuilder("{");
169            
170            stringValue.append("entityId=").append(getEntityId());
171            
172            stringValue.append(", shipmentPackageLinePK=").append(getShipmentPackageLinePK());
173            stringValue.append(", shipmentPackagePK=").append(getShipmentPackagePK());
174            stringValue.append(", shipmentPackageLineSequence=").append(getShipmentPackageLineSequence());
175            stringValue.append(", shipmentLinePK=").append(getShipmentLinePK());
176            stringValue.append(", itemPK=").append(getItemPK());
177            stringValue.append(", inventoryConditionPK=").append(getInventoryConditionPK());
178            stringValue.append(", unitOfMeasureTypePK=").append(getUnitOfMeasureTypePK());
179            stringValue.append(", quantity=").append(getQuantity());
180            stringValue.append(", fromTime=").append(getFromTime());
181            stringValue.append(", thruTime=").append(getThruTime());
182            
183            stringValue.append('}');
184            
185            _stringValue = stringValue.toString();
186        }
187        return _stringValue;
188    }
189    
190    @Override
191    public boolean equals(Object other) {
192        if(this == other)
193            return true;
194        
195        if(!hasIdentity())
196            return false;
197        
198        if(other instanceof  ShipmentPackageLineDetailValue) {
199            ShipmentPackageLineDetailValue that = (ShipmentPackageLineDetailValue)other;
200            
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 = 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) {
219            ShipmentPackageLineDetailValue that = (ShipmentPackageLineDetailValue)other;
220            boolean objectsEqual = true;
221            
222            
223            if(objectsEqual) {
224                ShipmentPackageLinePK thisShipmentPackageLinePK = getShipmentPackageLinePK();
225                ShipmentPackageLinePK thatShipmentPackageLinePK = that.getShipmentPackageLinePK();
226                
227                if(thisShipmentPackageLinePK == null) {
228                    objectsEqual = objectsEqual && (thatShipmentPackageLinePK == null);
229                } else {
230                    objectsEqual = objectsEqual && thisShipmentPackageLinePK.equals(thatShipmentPackageLinePK);
231                }
232            }
233            
234            if(objectsEqual) {
235                ShipmentPackagePK thisShipmentPackagePK = getShipmentPackagePK();
236                ShipmentPackagePK thatShipmentPackagePK = that.getShipmentPackagePK();
237                
238                if(thisShipmentPackagePK == null) {
239                    objectsEqual = objectsEqual && (thatShipmentPackagePK == null);
240                } else {
241                    objectsEqual = objectsEqual && thisShipmentPackagePK.equals(thatShipmentPackagePK);
242                }
243            }
244            
245            if(objectsEqual) {
246                Integer thisShipmentPackageLineSequence = getShipmentPackageLineSequence();
247                Integer thatShipmentPackageLineSequence = that.getShipmentPackageLineSequence();
248                
249                if(thisShipmentPackageLineSequence == null) {
250                    objectsEqual = objectsEqual && (thatShipmentPackageLineSequence == null);
251                } else {
252                    objectsEqual = objectsEqual && thisShipmentPackageLineSequence.equals(thatShipmentPackageLineSequence);
253                }
254            }
255            
256            if(objectsEqual) {
257                ShipmentLinePK thisShipmentLinePK = getShipmentLinePK();
258                ShipmentLinePK thatShipmentLinePK = that.getShipmentLinePK();
259                
260                if(thisShipmentLinePK == null) {
261                    objectsEqual = objectsEqual && (thatShipmentLinePK == null);
262                } else {
263                    objectsEqual = objectsEqual && thisShipmentLinePK.equals(thatShipmentLinePK);
264                }
265            }
266            
267            if(objectsEqual) {
268                ItemPK thisItemPK = getItemPK();
269                ItemPK thatItemPK = that.getItemPK();
270                
271                if(thisItemPK == null) {
272                    objectsEqual = objectsEqual && (thatItemPK == null);
273                } else {
274                    objectsEqual = objectsEqual && thisItemPK.equals(thatItemPK);
275                }
276            }
277            
278            if(objectsEqual) {
279                InventoryConditionPK thisInventoryConditionPK = getInventoryConditionPK();
280                InventoryConditionPK thatInventoryConditionPK = that.getInventoryConditionPK();
281                
282                if(thisInventoryConditionPK == null) {
283                    objectsEqual = objectsEqual && (thatInventoryConditionPK == null);
284                } else {
285                    objectsEqual = objectsEqual && thisInventoryConditionPK.equals(thatInventoryConditionPK);
286                }
287            }
288            
289            if(objectsEqual) {
290                UnitOfMeasureTypePK thisUnitOfMeasureTypePK = getUnitOfMeasureTypePK();
291                UnitOfMeasureTypePK thatUnitOfMeasureTypePK = that.getUnitOfMeasureTypePK();
292                
293                if(thisUnitOfMeasureTypePK == null) {
294                    objectsEqual = objectsEqual && (thatUnitOfMeasureTypePK == null);
295                } else {
296                    objectsEqual = objectsEqual && thisUnitOfMeasureTypePK.equals(thatUnitOfMeasureTypePK);
297                }
298            }
299            
300            if(objectsEqual) {
301                Long thisQuantity = getQuantity();
302                Long thatQuantity = that.getQuantity();
303                
304                if(thisQuantity == null) {
305                    objectsEqual = objectsEqual && (thatQuantity == null);
306                } else {
307                    objectsEqual = objectsEqual && thisQuantity.equals(thatQuantity);
308                }
309            }
310            
311            if(objectsEqual) {
312                Long thisFromTime = getFromTime();
313                Long thatFromTime = that.getFromTime();
314                
315                if(thisFromTime == null) {
316                    objectsEqual = objectsEqual && (thatFromTime == null);
317                } else {
318                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
319                }
320            }
321            
322            if(objectsEqual) {
323                Long thisThruTime = getThruTime();
324                Long thatThruTime = that.getThruTime();
325                
326                if(thisThruTime == null) {
327                    objectsEqual = objectsEqual && (thatThruTime == null);
328                } else {
329                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
330                }
331            }
332            
333            return objectsEqual;
334        } else {
335            return false;
336        }
337    }
338    
339    @Override
340    public boolean hasBeenModified() {
341        return shipmentPackageLinePKHasBeenModified || shipmentPackagePKHasBeenModified || shipmentPackageLineSequenceHasBeenModified || shipmentLinePKHasBeenModified || itemPKHasBeenModified || inventoryConditionPKHasBeenModified || unitOfMeasureTypePKHasBeenModified || quantityHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
342    }
343    
344    @Override
345    public void clearHasBeenModified() {
346        shipmentPackageLinePKHasBeenModified = false;
347        shipmentPackagePKHasBeenModified = false;
348        shipmentPackageLineSequenceHasBeenModified = false;
349        shipmentLinePKHasBeenModified = false;
350        itemPKHasBeenModified = false;
351        inventoryConditionPKHasBeenModified = false;
352        unitOfMeasureTypePKHasBeenModified = false;
353        quantityHasBeenModified = false;
354        fromTimeHasBeenModified = false;
355        thruTimeHasBeenModified = false;
356    }
357    
358    public ShipmentPackageLinePK getShipmentPackageLinePK() {
359        return shipmentPackageLinePK;
360    }
361    
362    public void setShipmentPackageLinePK(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    public ShipmentPackagePK getShipmentPackagePK() {
388        return shipmentPackagePK;
389    }
390    
391    public void setShipmentPackagePK(ShipmentPackagePK shipmentPackagePK)
392            throws PersistenceNotNullException {
393        checkForNull(shipmentPackagePK);
394        
395        boolean update = true;
396        
397        if(this.shipmentPackagePK != null) {
398            if(this.shipmentPackagePK.equals(shipmentPackagePK)) {
399                update = false;
400            }
401        } else if(shipmentPackagePK == null) {
402            update = false;
403        }
404        
405        if(update) {
406            this.shipmentPackagePK = shipmentPackagePK;
407            shipmentPackagePKHasBeenModified = true;
408            clearHashAndString();
409        }
410    }
411    
412    public boolean getShipmentPackagePKHasBeenModified() {
413        return shipmentPackagePKHasBeenModified;
414    }
415    
416    public Integer getShipmentPackageLineSequence() {
417        return shipmentPackageLineSequence;
418    }
419    
420    public void setShipmentPackageLineSequence(Integer shipmentPackageLineSequence)
421            throws PersistenceNotNullException {
422        checkForNull(shipmentPackageLineSequence);
423        
424        boolean update = true;
425        
426        if(this.shipmentPackageLineSequence != null) {
427            if(this.shipmentPackageLineSequence.equals(shipmentPackageLineSequence)) {
428                update = false;
429            }
430        } else if(shipmentPackageLineSequence == null) {
431            update = false;
432        }
433        
434        if(update) {
435            this.shipmentPackageLineSequence = shipmentPackageLineSequence;
436            shipmentPackageLineSequenceHasBeenModified = true;
437            clearHashAndString();
438        }
439    }
440    
441    public boolean getShipmentPackageLineSequenceHasBeenModified() {
442        return shipmentPackageLineSequenceHasBeenModified;
443    }
444    
445    public ShipmentLinePK getShipmentLinePK() {
446        return shipmentLinePK;
447    }
448    
449    public void setShipmentLinePK(ShipmentLinePK shipmentLinePK) {
450        boolean update = true;
451        
452        if(this.shipmentLinePK != null) {
453            if(this.shipmentLinePK.equals(shipmentLinePK)) {
454                update = false;
455            }
456        } else if(shipmentLinePK == null) {
457            update = false;
458        }
459        
460        if(update) {
461            this.shipmentLinePK = shipmentLinePK;
462            shipmentLinePKHasBeenModified = true;
463            clearHashAndString();
464        }
465    }
466    
467    public boolean getShipmentLinePKHasBeenModified() {
468        return shipmentLinePKHasBeenModified;
469    }
470    
471    public ItemPK getItemPK() {
472        return itemPK;
473    }
474    
475    public void setItemPK(ItemPK itemPK)
476            throws PersistenceNotNullException {
477        checkForNull(itemPK);
478        
479        boolean update = true;
480        
481        if(this.itemPK != null) {
482            if(this.itemPK.equals(itemPK)) {
483                update = false;
484            }
485        } else if(itemPK == null) {
486            update = false;
487        }
488        
489        if(update) {
490            this.itemPK = itemPK;
491            itemPKHasBeenModified = true;
492            clearHashAndString();
493        }
494    }
495    
496    public boolean getItemPKHasBeenModified() {
497        return itemPKHasBeenModified;
498    }
499    
500    public InventoryConditionPK getInventoryConditionPK() {
501        return inventoryConditionPK;
502    }
503    
504    public void setInventoryConditionPK(InventoryConditionPK inventoryConditionPK)
505            throws PersistenceNotNullException {
506        checkForNull(inventoryConditionPK);
507        
508        boolean update = true;
509        
510        if(this.inventoryConditionPK != null) {
511            if(this.inventoryConditionPK.equals(inventoryConditionPK)) {
512                update = false;
513            }
514        } else if(inventoryConditionPK == null) {
515            update = false;
516        }
517        
518        if(update) {
519            this.inventoryConditionPK = inventoryConditionPK;
520            inventoryConditionPKHasBeenModified = true;
521            clearHashAndString();
522        }
523    }
524    
525    public boolean getInventoryConditionPKHasBeenModified() {
526        return inventoryConditionPKHasBeenModified;
527    }
528    
529    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
530        return unitOfMeasureTypePK;
531    }
532    
533    public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK)
534            throws PersistenceNotNullException {
535        checkForNull(unitOfMeasureTypePK);
536        
537        boolean update = true;
538        
539        if(this.unitOfMeasureTypePK != null) {
540            if(this.unitOfMeasureTypePK.equals(unitOfMeasureTypePK)) {
541                update = false;
542            }
543        } else if(unitOfMeasureTypePK == null) {
544            update = false;
545        }
546        
547        if(update) {
548            this.unitOfMeasureTypePK = unitOfMeasureTypePK;
549            unitOfMeasureTypePKHasBeenModified = true;
550            clearHashAndString();
551        }
552    }
553    
554    public boolean getUnitOfMeasureTypePKHasBeenModified() {
555        return unitOfMeasureTypePKHasBeenModified;
556    }
557    
558    public Long getQuantity() {
559        return quantity;
560    }
561    
562    public void setQuantity(Long quantity)
563            throws PersistenceNotNullException {
564        checkForNull(quantity);
565        
566        boolean update = true;
567        
568        if(this.quantity != null) {
569            if(this.quantity.equals(quantity)) {
570                update = false;
571            }
572        } else if(quantity == null) {
573            update = false;
574        }
575        
576        if(update) {
577            this.quantity = quantity;
578            quantityHasBeenModified = true;
579            clearHashAndString();
580        }
581    }
582    
583    public boolean getQuantityHasBeenModified() {
584        return quantityHasBeenModified;
585    }
586    
587    public Long getFromTime() {
588        return fromTime;
589    }
590    
591    public void setFromTime(Long fromTime)
592            throws PersistenceNotNullException {
593        checkForNull(fromTime);
594        
595        boolean update = true;
596        
597        if(this.fromTime != null) {
598            if(this.fromTime.equals(fromTime)) {
599                update = false;
600            }
601        } else if(fromTime == null) {
602            update = false;
603        }
604        
605        if(update) {
606            this.fromTime = fromTime;
607            fromTimeHasBeenModified = true;
608            clearHashAndString();
609        }
610    }
611    
612    public boolean getFromTimeHasBeenModified() {
613        return fromTimeHasBeenModified;
614    }
615    
616    public Long getThruTime() {
617        return thruTime;
618    }
619    
620    public void setThruTime(Long thruTime)
621            throws PersistenceNotNullException {
622        checkForNull(thruTime);
623        
624        boolean update = true;
625        
626        if(this.thruTime != null) {
627            if(this.thruTime.equals(thruTime)) {
628                update = false;
629            }
630        } else if(thruTime == null) {
631            update = false;
632        }
633        
634        if(update) {
635            this.thruTime = thruTime;
636            thruTimeHasBeenModified = true;
637            clearHashAndString();
638        }
639    }
640    
641    public boolean getThruTimeHasBeenModified() {
642        return thruTimeHasBeenModified;
643    }
644    
645}