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