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 * 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
039public class EntityLongRangeDetailValue
040        extends BaseValue<EntityLongRangeDetailPK>
041        implements Cloneable, Serializable {
042    
043    private EntityLongRangePK entityLongRangePK;
044    private boolean entityLongRangePKHasBeenModified = false;
045    private EntityAttributePK entityAttributePK;
046    private boolean entityAttributePKHasBeenModified = false;
047    private String entityLongRangeName;
048    private boolean entityLongRangeNameHasBeenModified = false;
049    private Long minimumLongValue;
050    private boolean minimumLongValueHasBeenModified = false;
051    private Long maximumLongValue;
052    private boolean maximumLongValueHasBeenModified = 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(EntityLongRangePK entityLongRangePK, EntityAttributePK entityAttributePK, String entityLongRangeName, Long minimumLongValue, Long maximumLongValue, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
066            throws PersistenceNotNullException {
067        checkForNull(entityLongRangePK);
068        this.entityLongRangePK = entityLongRangePK;
069        checkForNull(entityAttributePK);
070        this.entityAttributePK = entityAttributePK;
071        checkForNull(entityLongRangeName);
072        this.entityLongRangeName = entityLongRangeName;
073        this.minimumLongValue = minimumLongValue;
074        this.maximumLongValue = maximumLongValue;
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 EntityLongRangeDetailValue */
086    public EntityLongRangeDetailValue(EntityLongRangeDetailPK entityLongRangeDetailPK, EntityLongRangePK entityLongRangePK, EntityAttributePK entityAttributePK, String entityLongRangeName, Long minimumLongValue, Long maximumLongValue, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
087            throws PersistenceNotNullException {
088        super(entityLongRangeDetailPK);
089        constructFields(entityLongRangePK, entityAttributePK, entityLongRangeName, minimumLongValue, maximumLongValue, isDefault, sortOrder, fromTime, thruTime);
090    }
091    
092    /** Creates a new instance of EntityLongRangeDetailValue */
093    public EntityLongRangeDetailValue(EntityLongRangePK entityLongRangePK, EntityAttributePK entityAttributePK, String entityLongRangeName, Long minimumLongValue, Long maximumLongValue, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
094            throws PersistenceNotNullException {
095        super();
096        constructFields(entityLongRangePK, entityAttributePK, entityLongRangeName, minimumLongValue, maximumLongValue, isDefault, sortOrder, fromTime, thruTime);
097    }
098    
099   @Override
100   public EntityLongRangeDetailFactory getBaseFactoryInstance() {
101        return EntityLongRangeDetailFactory.getInstance();
102    }
103    
104    @Override
105    public EntityLongRangeDetailValue 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 (EntityLongRangeDetailValue)result;
116    }
117    
118   @Override
119    public EntityLongRangeDetailPK getPrimaryKey() {
120        if(_primaryKey == null) {
121            _primaryKey = new EntityLongRangeDetailPK(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 + ((entityLongRangePK != null) ? entityLongRangePK.hashCode() : 0);
140            hashCode = 37 * hashCode + ((entityAttributePK != null) ? entityAttributePK.hashCode() : 0);
141            hashCode = 37 * hashCode + ((entityLongRangeName != null) ? entityLongRangeName.hashCode() : 0);
142            hashCode = 37 * hashCode + ((minimumLongValue != null) ? minimumLongValue.hashCode() : 0);
143            hashCode = 37 * hashCode + ((maximumLongValue != null) ? maximumLongValue.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                    ", entityLongRangePK=" + getEntityLongRangePK() +
161                    ", entityAttributePK=" + getEntityAttributePK() +
162                    ", entityLongRangeName=" + getEntityLongRangeName() +
163                    ", minimumLongValue=" + getMinimumLongValue() +
164                    ", maximumLongValue=" + getMaximumLongValue() +
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  EntityLongRangeDetailValue 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 EntityLongRangeDetailValue that) {
201            boolean objectsEqual = true;
202            
203            
204            if(objectsEqual) {
205                EntityLongRangePK thisEntityLongRangePK = getEntityLongRangePK();
206                EntityLongRangePK thatEntityLongRangePK = that.getEntityLongRangePK();
207                
208                if(thisEntityLongRangePK == null) {
209                    objectsEqual = objectsEqual && (thatEntityLongRangePK == null);
210                } else {
211                    objectsEqual = objectsEqual && thisEntityLongRangePK.equals(thatEntityLongRangePK);
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 thisEntityLongRangeName = getEntityLongRangeName();
228                String thatEntityLongRangeName = that.getEntityLongRangeName();
229                
230                if(thisEntityLongRangeName == null) {
231                    objectsEqual = objectsEqual && (thatEntityLongRangeName == null);
232                } else {
233                    objectsEqual = objectsEqual && thisEntityLongRangeName.equals(thatEntityLongRangeName);
234                }
235            }
236            
237            if(objectsEqual) {
238                Long thisMinimumLongValue = getMinimumLongValue();
239                Long thatMinimumLongValue = that.getMinimumLongValue();
240                
241                if(thisMinimumLongValue == null) {
242                    objectsEqual = objectsEqual && (thatMinimumLongValue == null);
243                } else {
244                    objectsEqual = objectsEqual && thisMinimumLongValue.equals(thatMinimumLongValue);
245                }
246            }
247            
248            if(objectsEqual) {
249                Long thisMaximumLongValue = getMaximumLongValue();
250                Long thatMaximumLongValue = that.getMaximumLongValue();
251                
252                if(thisMaximumLongValue == null) {
253                    objectsEqual = objectsEqual && (thatMaximumLongValue == null);
254                } else {
255                    objectsEqual = objectsEqual && thisMaximumLongValue.equals(thatMaximumLongValue);
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 entityLongRangePKHasBeenModified || entityAttributePKHasBeenModified || entityLongRangeNameHasBeenModified || minimumLongValueHasBeenModified || maximumLongValueHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
312    }
313    
314    @Override
315    public void clearHasBeenModified() {
316        entityLongRangePKHasBeenModified = false;
317        entityAttributePKHasBeenModified = false;
318        entityLongRangeNameHasBeenModified = false;
319        minimumLongValueHasBeenModified = false;
320        maximumLongValueHasBeenModified = false;
321        isDefaultHasBeenModified = false;
322        sortOrderHasBeenModified = false;
323        fromTimeHasBeenModified = false;
324        thruTimeHasBeenModified = false;
325    }
326    
327    public EntityLongRangePK getEntityLongRangePK() {
328        return entityLongRangePK;
329    }
330    
331    public void setEntityLongRangePK(EntityLongRangePK entityLongRangePK)
332            throws PersistenceNotNullException {
333        checkForNull(entityLongRangePK);
334        
335        boolean update = true;
336        
337        if(this.entityLongRangePK != null) {
338            if(this.entityLongRangePK.equals(entityLongRangePK)) {
339                update = false;
340            }
341        } else if(entityLongRangePK == null) {
342            update = false;
343        }
344        
345        if(update) {
346            this.entityLongRangePK = entityLongRangePK;
347            entityLongRangePKHasBeenModified = true;
348            clearHashAndString();
349        }
350    }
351    
352    public boolean getEntityLongRangePKHasBeenModified() {
353        return entityLongRangePKHasBeenModified;
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 getEntityLongRangeName() {
386        return entityLongRangeName;
387    }
388    
389    public void setEntityLongRangeName(String entityLongRangeName)
390            throws PersistenceNotNullException {
391        checkForNull(entityLongRangeName);
392        
393        boolean update = true;
394        
395        if(this.entityLongRangeName != null) {
396            if(this.entityLongRangeName.equals(entityLongRangeName)) {
397                update = false;
398            }
399        } else if(entityLongRangeName == null) {
400            update = false;
401        }
402        
403        if(update) {
404            this.entityLongRangeName = entityLongRangeName;
405            entityLongRangeNameHasBeenModified = true;
406            clearHashAndString();
407        }
408    }
409    
410    public boolean getEntityLongRangeNameHasBeenModified() {
411        return entityLongRangeNameHasBeenModified;
412    }
413    
414    public Long getMinimumLongValue() {
415        return minimumLongValue;
416    }
417    
418    public void setMinimumLongValue(Long minimumLongValue) {
419        boolean update = true;
420        
421        if(this.minimumLongValue != null) {
422            if(this.minimumLongValue.equals(minimumLongValue)) {
423                update = false;
424            }
425        } else if(minimumLongValue == null) {
426            update = false;
427        }
428        
429        if(update) {
430            this.minimumLongValue = minimumLongValue;
431            minimumLongValueHasBeenModified = true;
432            clearHashAndString();
433        }
434    }
435    
436    public boolean getMinimumLongValueHasBeenModified() {
437        return minimumLongValueHasBeenModified;
438    }
439    
440    public Long getMaximumLongValue() {
441        return maximumLongValue;
442    }
443    
444    public void setMaximumLongValue(Long maximumLongValue) {
445        boolean update = true;
446        
447        if(this.maximumLongValue != null) {
448            if(this.maximumLongValue.equals(maximumLongValue)) {
449                update = false;
450            }
451        } else if(maximumLongValue == null) {
452            update = false;
453        }
454        
455        if(update) {
456            this.maximumLongValue = maximumLongValue;
457            maximumLongValueHasBeenModified = true;
458            clearHashAndString();
459        }
460    }
461    
462    public boolean getMaximumLongValueHasBeenModified() {
463        return maximumLongValueHasBeenModified;
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}