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