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