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