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