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 * InventoryTransactionLineDestinationValue.java
021 */
022
023package com.echothree.model.data.inventory.server.value;
024
025import com.echothree.model.data.inventory.common.pk.InventoryTransactionLineDestinationPK;
026
027import com.echothree.model.data.inventory.server.factory.InventoryTransactionLineDestinationFactory;
028
029import com.echothree.model.data.inventory.common.pk.InventoryTransactionLinePK;
030import com.echothree.model.data.party.common.pk.PartyPK;
031import com.echothree.model.data.warehouse.common.pk.LocationPK;
032import com.echothree.model.data.inventory.common.pk.InventoryConditionPK;
033import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK;
034
035import com.echothree.util.common.exception.PersistenceCloneException;
036import com.echothree.util.common.exception.PersistenceNotNullException;
037
038import com.echothree.util.server.persistence.BaseValue;
039
040import java.io.Serializable;
041
042import javax.annotation.Nonnull;
043import javax.annotation.Nullable;
044
045public class InventoryTransactionLineDestinationValue
046        extends BaseValue<InventoryTransactionLineDestinationPK>
047        implements Cloneable, Serializable {
048    
049    private InventoryTransactionLinePK inventoryTransactionLinePK;
050    private boolean inventoryTransactionLinePKHasBeenModified = false;
051    private PartyPK destinationOwnerPartyPK;
052    private boolean destinationOwnerPartyPKHasBeenModified = false;
053    private LocationPK destinationLocationPK;
054    private boolean destinationLocationPKHasBeenModified = false;
055    private InventoryConditionPK destinationInventoryConditionPK;
056    private boolean destinationInventoryConditionPKHasBeenModified = false;
057    private UnitOfMeasureTypePK destinationUnitOfMeasureTypePK;
058    private boolean destinationUnitOfMeasureTypePKHasBeenModified = false;
059    private Long fromTime;
060    private boolean fromTimeHasBeenModified = false;
061    private Long thruTime;
062    private boolean thruTimeHasBeenModified = false;
063    
064    private transient Integer _hashCode = null;
065    private transient String _stringValue = null;
066    
067    private void constructFields(InventoryTransactionLinePK inventoryTransactionLinePK, PartyPK destinationOwnerPartyPK, LocationPK destinationLocationPK, InventoryConditionPK destinationInventoryConditionPK, UnitOfMeasureTypePK destinationUnitOfMeasureTypePK, Long fromTime, Long thruTime)
068            throws PersistenceNotNullException {
069        checkForNull(inventoryTransactionLinePK);
070        this.inventoryTransactionLinePK = inventoryTransactionLinePK;
071        this.destinationOwnerPartyPK = destinationOwnerPartyPK;
072        this.destinationLocationPK = destinationLocationPK;
073        this.destinationInventoryConditionPK = destinationInventoryConditionPK;
074        this.destinationUnitOfMeasureTypePK = destinationUnitOfMeasureTypePK;
075        checkForNull(fromTime);
076        this.fromTime = fromTime;
077        checkForNull(thruTime);
078        this.thruTime = thruTime;
079    }
080    
081    /** Creates a new instance of InventoryTransactionLineDestinationValue */
082    public InventoryTransactionLineDestinationValue(InventoryTransactionLineDestinationPK inventoryTransactionLineDestinationPK, InventoryTransactionLinePK inventoryTransactionLinePK, PartyPK destinationOwnerPartyPK, LocationPK destinationLocationPK, InventoryConditionPK destinationInventoryConditionPK, UnitOfMeasureTypePK destinationUnitOfMeasureTypePK, Long fromTime, Long thruTime)
083            throws PersistenceNotNullException {
084        super(inventoryTransactionLineDestinationPK);
085        constructFields(inventoryTransactionLinePK, destinationOwnerPartyPK, destinationLocationPK, destinationInventoryConditionPK, destinationUnitOfMeasureTypePK, fromTime, thruTime);
086    }
087    
088    /** Creates a new instance of InventoryTransactionLineDestinationValue */
089    public InventoryTransactionLineDestinationValue(InventoryTransactionLinePK inventoryTransactionLinePK, PartyPK destinationOwnerPartyPK, LocationPK destinationLocationPK, InventoryConditionPK destinationInventoryConditionPK, UnitOfMeasureTypePK destinationUnitOfMeasureTypePK, Long fromTime, Long thruTime)
090            throws PersistenceNotNullException {
091        super();
092        constructFields(inventoryTransactionLinePK, destinationOwnerPartyPK, destinationLocationPK, destinationInventoryConditionPK, destinationUnitOfMeasureTypePK, fromTime, thruTime);
093    }
094    
095    @Override
096    @Nonnull
097    public InventoryTransactionLineDestinationFactory getBaseFactoryInstance() {
098        return InventoryTransactionLineDestinationFactory.getInstance();
099    }
100    
101    @Override
102    @Nonnull
103    public InventoryTransactionLineDestinationValue clone() {
104        Object result;
105        
106        try {
107            result = super.clone();
108        } catch (CloneNotSupportedException cnse) {
109            // This shouldn't happen, fail when it does.
110            throw new PersistenceCloneException(cnse);
111        }
112        
113        return (InventoryTransactionLineDestinationValue)result;
114    }
115    
116    @Override
117    @Nonnull
118    public InventoryTransactionLineDestinationPK getPrimaryKey() {
119        if(_primaryKey == null) {
120            _primaryKey = new InventoryTransactionLineDestinationPK(entityId);
121        }
122        
123        return _primaryKey;
124    }
125    
126    private void clearHashAndString() {
127        _hashCode = null;
128        _stringValue = null;
129    }
130    
131    @Override
132    public int hashCode() {
133        if(_hashCode == null) {
134            int hashCode = 17;
135            
136            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
137            
138            hashCode = 37 * hashCode + ((inventoryTransactionLinePK != null) ? inventoryTransactionLinePK.hashCode() : 0);
139            hashCode = 37 * hashCode + ((destinationOwnerPartyPK != null) ? destinationOwnerPartyPK.hashCode() : 0);
140            hashCode = 37 * hashCode + ((destinationLocationPK != null) ? destinationLocationPK.hashCode() : 0);
141            hashCode = 37 * hashCode + ((destinationInventoryConditionPK != null) ? destinationInventoryConditionPK.hashCode() : 0);
142            hashCode = 37 * hashCode + ((destinationUnitOfMeasureTypePK != null) ? destinationUnitOfMeasureTypePK.hashCode() : 0);
143            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
144            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
145            
146            _hashCode = hashCode;
147        }
148        
149        return _hashCode;
150    }
151    
152    @Override
153    @Nonnull
154    public String toString() {
155        if(_stringValue == null) {
156            _stringValue = "{" + 
157                    "entityId=" + getEntityId() +
158                    ", inventoryTransactionLinePK=" + getInventoryTransactionLinePK() +
159                    ", destinationOwnerPartyPK=" + getDestinationOwnerPartyPK() +
160                    ", destinationLocationPK=" + getDestinationLocationPK() +
161                    ", destinationInventoryConditionPK=" + getDestinationInventoryConditionPK() +
162                    ", destinationUnitOfMeasureTypePK=" + getDestinationUnitOfMeasureTypePK() +
163                    ", fromTime=" + getFromTime() +
164                    ", thruTime=" + getThruTime() +
165                    "}";
166        }
167        return _stringValue;
168    }
169    
170    @Override
171    public boolean equals(Object other) {
172        if(this == other)
173            return true;
174        
175        if(!hasIdentity())
176            return false;
177        
178        if(other instanceof  InventoryTransactionLineDestinationValue that) {
179            if(!that.hasIdentity())
180                return false;
181            
182            Long thisEntityId = getEntityId();
183            Long thatEntityId = that.getEntityId();
184            
185            boolean objectsEqual = thisEntityId.equals(thatEntityId);
186            if(objectsEqual)
187                objectsEqual = isIdentical(that);
188            
189            return objectsEqual;
190        } else {
191            return false;
192        }
193    }
194    
195    public boolean isIdentical(Object other) {
196        if(other instanceof InventoryTransactionLineDestinationValue that) {
197            boolean objectsEqual = true;
198            
199            
200            if(objectsEqual) {
201                InventoryTransactionLinePK thisInventoryTransactionLinePK = getInventoryTransactionLinePK();
202                InventoryTransactionLinePK thatInventoryTransactionLinePK = that.getInventoryTransactionLinePK();
203                
204                if(thisInventoryTransactionLinePK == null) {
205                    objectsEqual = objectsEqual && (thatInventoryTransactionLinePK == null);
206                } else {
207                    objectsEqual = objectsEqual && thisInventoryTransactionLinePK.equals(thatInventoryTransactionLinePK);
208                }
209            }
210            
211            if(objectsEqual) {
212                PartyPK thisDestinationOwnerPartyPK = getDestinationOwnerPartyPK();
213                PartyPK thatDestinationOwnerPartyPK = that.getDestinationOwnerPartyPK();
214                
215                if(thisDestinationOwnerPartyPK == null) {
216                    objectsEqual = objectsEqual && (thatDestinationOwnerPartyPK == null);
217                } else {
218                    objectsEqual = objectsEqual && thisDestinationOwnerPartyPK.equals(thatDestinationOwnerPartyPK);
219                }
220            }
221            
222            if(objectsEqual) {
223                LocationPK thisDestinationLocationPK = getDestinationLocationPK();
224                LocationPK thatDestinationLocationPK = that.getDestinationLocationPK();
225                
226                if(thisDestinationLocationPK == null) {
227                    objectsEqual = objectsEqual && (thatDestinationLocationPK == null);
228                } else {
229                    objectsEqual = objectsEqual && thisDestinationLocationPK.equals(thatDestinationLocationPK);
230                }
231            }
232            
233            if(objectsEqual) {
234                InventoryConditionPK thisDestinationInventoryConditionPK = getDestinationInventoryConditionPK();
235                InventoryConditionPK thatDestinationInventoryConditionPK = that.getDestinationInventoryConditionPK();
236                
237                if(thisDestinationInventoryConditionPK == null) {
238                    objectsEqual = objectsEqual && (thatDestinationInventoryConditionPK == null);
239                } else {
240                    objectsEqual = objectsEqual && thisDestinationInventoryConditionPK.equals(thatDestinationInventoryConditionPK);
241                }
242            }
243            
244            if(objectsEqual) {
245                UnitOfMeasureTypePK thisDestinationUnitOfMeasureTypePK = getDestinationUnitOfMeasureTypePK();
246                UnitOfMeasureTypePK thatDestinationUnitOfMeasureTypePK = that.getDestinationUnitOfMeasureTypePK();
247                
248                if(thisDestinationUnitOfMeasureTypePK == null) {
249                    objectsEqual = objectsEqual && (thatDestinationUnitOfMeasureTypePK == null);
250                } else {
251                    objectsEqual = objectsEqual && thisDestinationUnitOfMeasureTypePK.equals(thatDestinationUnitOfMeasureTypePK);
252                }
253            }
254            
255            if(objectsEqual) {
256                Long thisFromTime = getFromTime();
257                Long thatFromTime = that.getFromTime();
258                
259                if(thisFromTime == null) {
260                    objectsEqual = objectsEqual && (thatFromTime == null);
261                } else {
262                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
263                }
264            }
265            
266            if(objectsEqual) {
267                Long thisThruTime = getThruTime();
268                Long thatThruTime = that.getThruTime();
269                
270                if(thisThruTime == null) {
271                    objectsEqual = objectsEqual && (thatThruTime == null);
272                } else {
273                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
274                }
275            }
276            
277            return objectsEqual;
278        } else {
279            return false;
280        }
281    }
282    
283    @Override
284    public boolean hasBeenModified() {
285        return inventoryTransactionLinePKHasBeenModified || destinationOwnerPartyPKHasBeenModified || destinationLocationPKHasBeenModified || destinationInventoryConditionPKHasBeenModified || destinationUnitOfMeasureTypePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
286    }
287    
288    @Override
289    public void clearHasBeenModified() {
290        inventoryTransactionLinePKHasBeenModified = false;
291        destinationOwnerPartyPKHasBeenModified = false;
292        destinationLocationPKHasBeenModified = false;
293        destinationInventoryConditionPKHasBeenModified = false;
294        destinationUnitOfMeasureTypePKHasBeenModified = false;
295        fromTimeHasBeenModified = false;
296        thruTimeHasBeenModified = false;
297    }
298    
299    @Nonnull
300    public InventoryTransactionLinePK getInventoryTransactionLinePK() {
301        return inventoryTransactionLinePK;
302    }
303    
304    public void setInventoryTransactionLinePK(@Nonnull InventoryTransactionLinePK inventoryTransactionLinePK)
305            throws PersistenceNotNullException {
306        checkForNull(inventoryTransactionLinePK);
307        
308        boolean update = true;
309        
310        if(this.inventoryTransactionLinePK != null) {
311            if(this.inventoryTransactionLinePK.equals(inventoryTransactionLinePK)) {
312                update = false;
313            }
314        } else if(inventoryTransactionLinePK == null) {
315            update = false;
316        }
317        
318        if(update) {
319            this.inventoryTransactionLinePK = inventoryTransactionLinePK;
320            inventoryTransactionLinePKHasBeenModified = true;
321            clearHashAndString();
322        }
323    }
324    
325    public boolean getInventoryTransactionLinePKHasBeenModified() {
326        return inventoryTransactionLinePKHasBeenModified;
327    }
328    
329    @Nullable
330    public PartyPK getDestinationOwnerPartyPK() {
331        return destinationOwnerPartyPK;
332    }
333    
334    public void setDestinationOwnerPartyPK(@Nullable PartyPK destinationOwnerPartyPK) {
335        boolean update = true;
336        
337        if(this.destinationOwnerPartyPK != null) {
338            if(this.destinationOwnerPartyPK.equals(destinationOwnerPartyPK)) {
339                update = false;
340            }
341        } else if(destinationOwnerPartyPK == null) {
342            update = false;
343        }
344        
345        if(update) {
346            this.destinationOwnerPartyPK = destinationOwnerPartyPK;
347            destinationOwnerPartyPKHasBeenModified = true;
348            clearHashAndString();
349        }
350    }
351    
352    public boolean getDestinationOwnerPartyPKHasBeenModified() {
353        return destinationOwnerPartyPKHasBeenModified;
354    }
355    
356    @Nullable
357    public LocationPK getDestinationLocationPK() {
358        return destinationLocationPK;
359    }
360    
361    public void setDestinationLocationPK(@Nullable LocationPK destinationLocationPK) {
362        boolean update = true;
363        
364        if(this.destinationLocationPK != null) {
365            if(this.destinationLocationPK.equals(destinationLocationPK)) {
366                update = false;
367            }
368        } else if(destinationLocationPK == null) {
369            update = false;
370        }
371        
372        if(update) {
373            this.destinationLocationPK = destinationLocationPK;
374            destinationLocationPKHasBeenModified = true;
375            clearHashAndString();
376        }
377    }
378    
379    public boolean getDestinationLocationPKHasBeenModified() {
380        return destinationLocationPKHasBeenModified;
381    }
382    
383    @Nullable
384    public InventoryConditionPK getDestinationInventoryConditionPK() {
385        return destinationInventoryConditionPK;
386    }
387    
388    public void setDestinationInventoryConditionPK(@Nullable InventoryConditionPK destinationInventoryConditionPK) {
389        boolean update = true;
390        
391        if(this.destinationInventoryConditionPK != null) {
392            if(this.destinationInventoryConditionPK.equals(destinationInventoryConditionPK)) {
393                update = false;
394            }
395        } else if(destinationInventoryConditionPK == null) {
396            update = false;
397        }
398        
399        if(update) {
400            this.destinationInventoryConditionPK = destinationInventoryConditionPK;
401            destinationInventoryConditionPKHasBeenModified = true;
402            clearHashAndString();
403        }
404    }
405    
406    public boolean getDestinationInventoryConditionPKHasBeenModified() {
407        return destinationInventoryConditionPKHasBeenModified;
408    }
409    
410    @Nullable
411    public UnitOfMeasureTypePK getDestinationUnitOfMeasureTypePK() {
412        return destinationUnitOfMeasureTypePK;
413    }
414    
415    public void setDestinationUnitOfMeasureTypePK(@Nullable UnitOfMeasureTypePK destinationUnitOfMeasureTypePK) {
416        boolean update = true;
417        
418        if(this.destinationUnitOfMeasureTypePK != null) {
419            if(this.destinationUnitOfMeasureTypePK.equals(destinationUnitOfMeasureTypePK)) {
420                update = false;
421            }
422        } else if(destinationUnitOfMeasureTypePK == null) {
423            update = false;
424        }
425        
426        if(update) {
427            this.destinationUnitOfMeasureTypePK = destinationUnitOfMeasureTypePK;
428            destinationUnitOfMeasureTypePKHasBeenModified = true;
429            clearHashAndString();
430        }
431    }
432    
433    public boolean getDestinationUnitOfMeasureTypePKHasBeenModified() {
434        return destinationUnitOfMeasureTypePKHasBeenModified;
435    }
436    
437    @Nonnull
438    public Long getFromTime() {
439        return fromTime;
440    }
441    
442    public void setFromTime(@Nonnull Long fromTime)
443            throws PersistenceNotNullException {
444        checkForNull(fromTime);
445        
446        boolean update = true;
447        
448        if(this.fromTime != null) {
449            if(this.fromTime.equals(fromTime)) {
450                update = false;
451            }
452        } else if(fromTime == null) {
453            update = false;
454        }
455        
456        if(update) {
457            this.fromTime = fromTime;
458            fromTimeHasBeenModified = true;
459            clearHashAndString();
460        }
461    }
462    
463    public boolean getFromTimeHasBeenModified() {
464        return fromTimeHasBeenModified;
465    }
466    
467    @Nonnull
468    public Long getThruTime() {
469        return thruTime;
470    }
471    
472    public void setThruTime(@Nonnull Long thruTime)
473            throws PersistenceNotNullException {
474        checkForNull(thruTime);
475        
476        boolean update = true;
477        
478        if(this.thruTime != null) {
479            if(this.thruTime.equals(thruTime)) {
480                update = false;
481            }
482        } else if(thruTime == null) {
483            update = false;
484        }
485        
486        if(update) {
487            this.thruTime = thruTime;
488            thruTimeHasBeenModified = true;
489            clearHashAndString();
490        }
491    }
492    
493    public boolean getThruTimeHasBeenModified() {
494        return thruTimeHasBeenModified;
495    }
496    
497}