001// --------------------------------------------------------------------------------
002// Copyright 2002-2024 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            StringBuilder stringValue = new StringBuilder("{");
159            
160            stringValue.append("entityId=").append(getEntityId());
161            
162            stringValue.append(", entityLongRangePK=").append(getEntityLongRangePK());
163            stringValue.append(", entityAttributePK=").append(getEntityAttributePK());
164            stringValue.append(", entityLongRangeName=").append(getEntityLongRangeName());
165            stringValue.append(", minimumLongValue=").append(getMinimumLongValue());
166            stringValue.append(", maximumLongValue=").append(getMaximumLongValue());
167            stringValue.append(", isDefault=").append(getIsDefault());
168            stringValue.append(", sortOrder=").append(getSortOrder());
169            stringValue.append(", fromTime=").append(getFromTime());
170            stringValue.append(", thruTime=").append(getThruTime());
171            
172            stringValue.append('}');
173            
174            _stringValue = stringValue.toString();
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  EntityLongRangeDetailValue) {
188            EntityLongRangeDetailValue that = (EntityLongRangeDetailValue)other;
189            
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 = 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) {
208            EntityLongRangeDetailValue that = (EntityLongRangeDetailValue)other;
209            boolean objectsEqual = true;
210            
211            
212            if(objectsEqual) {
213                EntityLongRangePK thisEntityLongRangePK = getEntityLongRangePK();
214                EntityLongRangePK thatEntityLongRangePK = that.getEntityLongRangePK();
215                
216                if(thisEntityLongRangePK == null) {
217                    objectsEqual = objectsEqual && (thatEntityLongRangePK == null);
218                } else {
219                    objectsEqual = objectsEqual && thisEntityLongRangePK.equals(thatEntityLongRangePK);
220                }
221            }
222            
223            if(objectsEqual) {
224                EntityAttributePK thisEntityAttributePK = getEntityAttributePK();
225                EntityAttributePK thatEntityAttributePK = that.getEntityAttributePK();
226                
227                if(thisEntityAttributePK == null) {
228                    objectsEqual = objectsEqual && (thatEntityAttributePK == null);
229                } else {
230                    objectsEqual = objectsEqual && thisEntityAttributePK.equals(thatEntityAttributePK);
231                }
232            }
233            
234            if(objectsEqual) {
235                String thisEntityLongRangeName = getEntityLongRangeName();
236                String thatEntityLongRangeName = that.getEntityLongRangeName();
237                
238                if(thisEntityLongRangeName == null) {
239                    objectsEqual = objectsEqual && (thatEntityLongRangeName == null);
240                } else {
241                    objectsEqual = objectsEqual && thisEntityLongRangeName.equals(thatEntityLongRangeName);
242                }
243            }
244            
245            if(objectsEqual) {
246                Long thisMinimumLongValue = getMinimumLongValue();
247                Long thatMinimumLongValue = that.getMinimumLongValue();
248                
249                if(thisMinimumLongValue == null) {
250                    objectsEqual = objectsEqual && (thatMinimumLongValue == null);
251                } else {
252                    objectsEqual = objectsEqual && thisMinimumLongValue.equals(thatMinimumLongValue);
253                }
254            }
255            
256            if(objectsEqual) {
257                Long thisMaximumLongValue = getMaximumLongValue();
258                Long thatMaximumLongValue = that.getMaximumLongValue();
259                
260                if(thisMaximumLongValue == null) {
261                    objectsEqual = objectsEqual && (thatMaximumLongValue == null);
262                } else {
263                    objectsEqual = objectsEqual && thisMaximumLongValue.equals(thatMaximumLongValue);
264                }
265            }
266            
267            if(objectsEqual) {
268                Boolean thisIsDefault = getIsDefault();
269                Boolean thatIsDefault = that.getIsDefault();
270                
271                if(thisIsDefault == null) {
272                    objectsEqual = objectsEqual && (thatIsDefault == null);
273                } else {
274                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
275                }
276            }
277            
278            if(objectsEqual) {
279                Integer thisSortOrder = getSortOrder();
280                Integer thatSortOrder = that.getSortOrder();
281                
282                if(thisSortOrder == null) {
283                    objectsEqual = objectsEqual && (thatSortOrder == null);
284                } else {
285                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
286                }
287            }
288            
289            if(objectsEqual) {
290                Long thisFromTime = getFromTime();
291                Long thatFromTime = that.getFromTime();
292                
293                if(thisFromTime == null) {
294                    objectsEqual = objectsEqual && (thatFromTime == null);
295                } else {
296                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
297                }
298            }
299            
300            if(objectsEqual) {
301                Long thisThruTime = getThruTime();
302                Long thatThruTime = that.getThruTime();
303                
304                if(thisThruTime == null) {
305                    objectsEqual = objectsEqual && (thatThruTime == null);
306                } else {
307                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
308                }
309            }
310            
311            return objectsEqual;
312        } else {
313            return false;
314        }
315    }
316    
317    @Override
318    public boolean hasBeenModified() {
319        return entityLongRangePKHasBeenModified || entityAttributePKHasBeenModified || entityLongRangeNameHasBeenModified || minimumLongValueHasBeenModified || maximumLongValueHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
320    }
321    
322    @Override
323    public void clearHasBeenModified() {
324        entityLongRangePKHasBeenModified = false;
325        entityAttributePKHasBeenModified = false;
326        entityLongRangeNameHasBeenModified = false;
327        minimumLongValueHasBeenModified = false;
328        maximumLongValueHasBeenModified = false;
329        isDefaultHasBeenModified = false;
330        sortOrderHasBeenModified = false;
331        fromTimeHasBeenModified = false;
332        thruTimeHasBeenModified = false;
333    }
334    
335    public EntityLongRangePK getEntityLongRangePK() {
336        return entityLongRangePK;
337    }
338    
339    public void setEntityLongRangePK(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    public EntityAttributePK getEntityAttributePK() {
365        return entityAttributePK;
366    }
367    
368    public void setEntityAttributePK(EntityAttributePK entityAttributePK)
369            throws PersistenceNotNullException {
370        checkForNull(entityAttributePK);
371        
372        boolean update = true;
373        
374        if(this.entityAttributePK != null) {
375            if(this.entityAttributePK.equals(entityAttributePK)) {
376                update = false;
377            }
378        } else if(entityAttributePK == null) {
379            update = false;
380        }
381        
382        if(update) {
383            this.entityAttributePK = entityAttributePK;
384            entityAttributePKHasBeenModified = true;
385            clearHashAndString();
386        }
387    }
388    
389    public boolean getEntityAttributePKHasBeenModified() {
390        return entityAttributePKHasBeenModified;
391    }
392    
393    public String getEntityLongRangeName() {
394        return entityLongRangeName;
395    }
396    
397    public void setEntityLongRangeName(String entityLongRangeName)
398            throws PersistenceNotNullException {
399        checkForNull(entityLongRangeName);
400        
401        boolean update = true;
402        
403        if(this.entityLongRangeName != null) {
404            if(this.entityLongRangeName.equals(entityLongRangeName)) {
405                update = false;
406            }
407        } else if(entityLongRangeName == null) {
408            update = false;
409        }
410        
411        if(update) {
412            this.entityLongRangeName = entityLongRangeName;
413            entityLongRangeNameHasBeenModified = true;
414            clearHashAndString();
415        }
416    }
417    
418    public boolean getEntityLongRangeNameHasBeenModified() {
419        return entityLongRangeNameHasBeenModified;
420    }
421    
422    public Long getMinimumLongValue() {
423        return minimumLongValue;
424    }
425    
426    public void setMinimumLongValue(Long minimumLongValue) {
427        boolean update = true;
428        
429        if(this.minimumLongValue != null) {
430            if(this.minimumLongValue.equals(minimumLongValue)) {
431                update = false;
432            }
433        } else if(minimumLongValue == null) {
434            update = false;
435        }
436        
437        if(update) {
438            this.minimumLongValue = minimumLongValue;
439            minimumLongValueHasBeenModified = true;
440            clearHashAndString();
441        }
442    }
443    
444    public boolean getMinimumLongValueHasBeenModified() {
445        return minimumLongValueHasBeenModified;
446    }
447    
448    public Long getMaximumLongValue() {
449        return maximumLongValue;
450    }
451    
452    public void setMaximumLongValue(Long maximumLongValue) {
453        boolean update = true;
454        
455        if(this.maximumLongValue != null) {
456            if(this.maximumLongValue.equals(maximumLongValue)) {
457                update = false;
458            }
459        } else if(maximumLongValue == null) {
460            update = false;
461        }
462        
463        if(update) {
464            this.maximumLongValue = maximumLongValue;
465            maximumLongValueHasBeenModified = true;
466            clearHashAndString();
467        }
468    }
469    
470    public boolean getMaximumLongValueHasBeenModified() {
471        return maximumLongValueHasBeenModified;
472    }
473    
474    public Boolean getIsDefault() {
475        return isDefault;
476    }
477    
478    public void setIsDefault(Boolean isDefault)
479            throws PersistenceNotNullException {
480        checkForNull(isDefault);
481        
482        boolean update = true;
483        
484        if(this.isDefault != null) {
485            if(this.isDefault.equals(isDefault)) {
486                update = false;
487            }
488        } else if(isDefault == null) {
489            update = false;
490        }
491        
492        if(update) {
493            this.isDefault = isDefault;
494            isDefaultHasBeenModified = true;
495            clearHashAndString();
496        }
497    }
498    
499    public boolean getIsDefaultHasBeenModified() {
500        return isDefaultHasBeenModified;
501    }
502    
503    public Integer getSortOrder() {
504        return sortOrder;
505    }
506    
507    public void setSortOrder(Integer sortOrder)
508            throws PersistenceNotNullException {
509        checkForNull(sortOrder);
510        
511        boolean update = true;
512        
513        if(this.sortOrder != null) {
514            if(this.sortOrder.equals(sortOrder)) {
515                update = false;
516            }
517        } else if(sortOrder == null) {
518            update = false;
519        }
520        
521        if(update) {
522            this.sortOrder = sortOrder;
523            sortOrderHasBeenModified = true;
524            clearHashAndString();
525        }
526    }
527    
528    public boolean getSortOrderHasBeenModified() {
529        return sortOrderHasBeenModified;
530    }
531    
532    public Long getFromTime() {
533        return fromTime;
534    }
535    
536    public void setFromTime(Long fromTime)
537            throws PersistenceNotNullException {
538        checkForNull(fromTime);
539        
540        boolean update = true;
541        
542        if(this.fromTime != null) {
543            if(this.fromTime.equals(fromTime)) {
544                update = false;
545            }
546        } else if(fromTime == null) {
547            update = false;
548        }
549        
550        if(update) {
551            this.fromTime = fromTime;
552            fromTimeHasBeenModified = true;
553            clearHashAndString();
554        }
555    }
556    
557    public boolean getFromTimeHasBeenModified() {
558        return fromTimeHasBeenModified;
559    }
560    
561    public Long getThruTime() {
562        return thruTime;
563    }
564    
565    public void setThruTime(Long thruTime)
566            throws PersistenceNotNullException {
567        checkForNull(thruTime);
568        
569        boolean update = true;
570        
571        if(this.thruTime != null) {
572            if(this.thruTime.equals(thruTime)) {
573                update = false;
574            }
575        } else if(thruTime == null) {
576            update = false;
577        }
578        
579        if(update) {
580            this.thruTime = thruTime;
581            thruTimeHasBeenModified = true;
582            clearHashAndString();
583        }
584    }
585    
586    public boolean getThruTimeHasBeenModified() {
587        return thruTimeHasBeenModified;
588    }
589    
590}