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 * EntityAttributeIntegerValue.java
021 */
022
023package com.echothree.model.data.core.server.value;
024
025import com.echothree.model.data.core.common.pk.EntityAttributeIntegerPK;
026
027import com.echothree.model.data.core.server.factory.EntityAttributeIntegerFactory;
028
029import com.echothree.model.data.core.common.pk.EntityAttributePK;
030
031import com.echothree.util.common.exception.PersistenceCloneException;
032import com.echothree.util.common.exception.PersistenceNotNullException;
033
034import com.echothree.util.server.persistence.BaseValue;
035
036import java.io.Serializable;
037
038public class EntityAttributeIntegerValue
039        extends BaseValue<EntityAttributeIntegerPK>
040        implements Cloneable, Serializable {
041    
042    private EntityAttributePK entityAttributePK;
043    private boolean entityAttributePKHasBeenModified = false;
044    private Integer upperRangeIntegerValue;
045    private boolean upperRangeIntegerValueHasBeenModified = false;
046    private Integer upperLimitIntegerValue;
047    private boolean upperLimitIntegerValueHasBeenModified = false;
048    private Integer lowerLimitIntegerValue;
049    private boolean lowerLimitIntegerValueHasBeenModified = false;
050    private Integer lowerRangeIntegerValue;
051    private boolean lowerRangeIntegerValueHasBeenModified = false;
052    private Long fromTime;
053    private boolean fromTimeHasBeenModified = false;
054    private Long thruTime;
055    private boolean thruTimeHasBeenModified = false;
056    
057    private transient Integer _hashCode = null;
058    private transient String _stringValue = null;
059    
060    private void constructFields(EntityAttributePK entityAttributePK, Integer upperRangeIntegerValue, Integer upperLimitIntegerValue, Integer lowerLimitIntegerValue, Integer lowerRangeIntegerValue, Long fromTime, Long thruTime)
061            throws PersistenceNotNullException {
062        checkForNull(entityAttributePK);
063        this.entityAttributePK = entityAttributePK;
064        this.upperRangeIntegerValue = upperRangeIntegerValue;
065        this.upperLimitIntegerValue = upperLimitIntegerValue;
066        this.lowerLimitIntegerValue = lowerLimitIntegerValue;
067        this.lowerRangeIntegerValue = lowerRangeIntegerValue;
068        checkForNull(fromTime);
069        this.fromTime = fromTime;
070        checkForNull(thruTime);
071        this.thruTime = thruTime;
072    }
073    
074    /** Creates a new instance of EntityAttributeIntegerValue */
075    public EntityAttributeIntegerValue(EntityAttributeIntegerPK entityAttributeIntegerPK, EntityAttributePK entityAttributePK, Integer upperRangeIntegerValue, Integer upperLimitIntegerValue, Integer lowerLimitIntegerValue, Integer lowerRangeIntegerValue, Long fromTime, Long thruTime)
076            throws PersistenceNotNullException {
077        super(entityAttributeIntegerPK);
078        constructFields(entityAttributePK, upperRangeIntegerValue, upperLimitIntegerValue, lowerLimitIntegerValue, lowerRangeIntegerValue, fromTime, thruTime);
079    }
080    
081    /** Creates a new instance of EntityAttributeIntegerValue */
082    public EntityAttributeIntegerValue(EntityAttributePK entityAttributePK, Integer upperRangeIntegerValue, Integer upperLimitIntegerValue, Integer lowerLimitIntegerValue, Integer lowerRangeIntegerValue, Long fromTime, Long thruTime)
083            throws PersistenceNotNullException {
084        super();
085        constructFields(entityAttributePK, upperRangeIntegerValue, upperLimitIntegerValue, lowerLimitIntegerValue, lowerRangeIntegerValue, fromTime, thruTime);
086    }
087    
088   @Override
089   public EntityAttributeIntegerFactory getBaseFactoryInstance() {
090        return EntityAttributeIntegerFactory.getInstance();
091    }
092    
093    @Override
094    public EntityAttributeIntegerValue clone() {
095        Object result;
096        
097        try {
098            result = super.clone();
099        } catch (CloneNotSupportedException cnse) {
100            // This shouldn't happen, fail when it does.
101            throw new PersistenceCloneException(cnse);
102        }
103        
104        return (EntityAttributeIntegerValue)result;
105    }
106    
107   @Override
108    public EntityAttributeIntegerPK getPrimaryKey() {
109        if(_primaryKey == null) {
110            _primaryKey = new EntityAttributeIntegerPK(entityId);
111        }
112        
113        return _primaryKey;
114    }
115    
116    private void clearHashAndString() {
117        _hashCode = null;
118        _stringValue = null;
119    }
120    
121    @Override
122    public int hashCode() {
123        if(_hashCode == null) {
124            int hashCode = 17;
125            
126            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
127            
128            hashCode = 37 * hashCode + ((entityAttributePK != null) ? entityAttributePK.hashCode() : 0);
129            hashCode = 37 * hashCode + ((upperRangeIntegerValue != null) ? upperRangeIntegerValue.hashCode() : 0);
130            hashCode = 37 * hashCode + ((upperLimitIntegerValue != null) ? upperLimitIntegerValue.hashCode() : 0);
131            hashCode = 37 * hashCode + ((lowerLimitIntegerValue != null) ? lowerLimitIntegerValue.hashCode() : 0);
132            hashCode = 37 * hashCode + ((lowerRangeIntegerValue != null) ? lowerRangeIntegerValue.hashCode() : 0);
133            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
134            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
135            
136            _hashCode = hashCode;
137        }
138        
139        return _hashCode;
140    }
141    
142    @Override
143    public String toString() {
144        if(_stringValue == null) {
145            _stringValue = "{" + 
146                    "entityId=" + getEntityId() +
147                    ", entityAttributePK=" + getEntityAttributePK() +
148                    ", upperRangeIntegerValue=" + getUpperRangeIntegerValue() +
149                    ", upperLimitIntegerValue=" + getUpperLimitIntegerValue() +
150                    ", lowerLimitIntegerValue=" + getLowerLimitIntegerValue() +
151                    ", lowerRangeIntegerValue=" + getLowerRangeIntegerValue() +
152                    ", fromTime=" + getFromTime() +
153                    ", thruTime=" + getThruTime() +
154                    "}";
155        }
156        return _stringValue;
157    }
158    
159    @Override
160    public boolean equals(Object other) {
161        if(this == other)
162            return true;
163        
164        if(!hasIdentity())
165            return false;
166        
167        if(other instanceof  EntityAttributeIntegerValue that) {
168            if(!that.hasIdentity())
169                return false;
170            
171            Long thisEntityId = getEntityId();
172            Long thatEntityId = that.getEntityId();
173            
174            boolean objectsEqual = thisEntityId.equals(thatEntityId);
175            if(objectsEqual)
176                objectsEqual = isIdentical(that);
177            
178            return objectsEqual;
179        } else {
180            return false;
181        }
182    }
183    
184    public boolean isIdentical(Object other) {
185        if(other instanceof EntityAttributeIntegerValue that) {
186            boolean objectsEqual = true;
187            
188            
189            if(objectsEqual) {
190                EntityAttributePK thisEntityAttributePK = getEntityAttributePK();
191                EntityAttributePK thatEntityAttributePK = that.getEntityAttributePK();
192                
193                if(thisEntityAttributePK == null) {
194                    objectsEqual = objectsEqual && (thatEntityAttributePK == null);
195                } else {
196                    objectsEqual = objectsEqual && thisEntityAttributePK.equals(thatEntityAttributePK);
197                }
198            }
199            
200            if(objectsEqual) {
201                Integer thisUpperRangeIntegerValue = getUpperRangeIntegerValue();
202                Integer thatUpperRangeIntegerValue = that.getUpperRangeIntegerValue();
203                
204                if(thisUpperRangeIntegerValue == null) {
205                    objectsEqual = objectsEqual && (thatUpperRangeIntegerValue == null);
206                } else {
207                    objectsEqual = objectsEqual && thisUpperRangeIntegerValue.equals(thatUpperRangeIntegerValue);
208                }
209            }
210            
211            if(objectsEqual) {
212                Integer thisUpperLimitIntegerValue = getUpperLimitIntegerValue();
213                Integer thatUpperLimitIntegerValue = that.getUpperLimitIntegerValue();
214                
215                if(thisUpperLimitIntegerValue == null) {
216                    objectsEqual = objectsEqual && (thatUpperLimitIntegerValue == null);
217                } else {
218                    objectsEqual = objectsEqual && thisUpperLimitIntegerValue.equals(thatUpperLimitIntegerValue);
219                }
220            }
221            
222            if(objectsEqual) {
223                Integer thisLowerLimitIntegerValue = getLowerLimitIntegerValue();
224                Integer thatLowerLimitIntegerValue = that.getLowerLimitIntegerValue();
225                
226                if(thisLowerLimitIntegerValue == null) {
227                    objectsEqual = objectsEqual && (thatLowerLimitIntegerValue == null);
228                } else {
229                    objectsEqual = objectsEqual && thisLowerLimitIntegerValue.equals(thatLowerLimitIntegerValue);
230                }
231            }
232            
233            if(objectsEqual) {
234                Integer thisLowerRangeIntegerValue = getLowerRangeIntegerValue();
235                Integer thatLowerRangeIntegerValue = that.getLowerRangeIntegerValue();
236                
237                if(thisLowerRangeIntegerValue == null) {
238                    objectsEqual = objectsEqual && (thatLowerRangeIntegerValue == null);
239                } else {
240                    objectsEqual = objectsEqual && thisLowerRangeIntegerValue.equals(thatLowerRangeIntegerValue);
241                }
242            }
243            
244            if(objectsEqual) {
245                Long thisFromTime = getFromTime();
246                Long thatFromTime = that.getFromTime();
247                
248                if(thisFromTime == null) {
249                    objectsEqual = objectsEqual && (thatFromTime == null);
250                } else {
251                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
252                }
253            }
254            
255            if(objectsEqual) {
256                Long thisThruTime = getThruTime();
257                Long thatThruTime = that.getThruTime();
258                
259                if(thisThruTime == null) {
260                    objectsEqual = objectsEqual && (thatThruTime == null);
261                } else {
262                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
263                }
264            }
265            
266            return objectsEqual;
267        } else {
268            return false;
269        }
270    }
271    
272    @Override
273    public boolean hasBeenModified() {
274        return entityAttributePKHasBeenModified || upperRangeIntegerValueHasBeenModified || upperLimitIntegerValueHasBeenModified || lowerLimitIntegerValueHasBeenModified || lowerRangeIntegerValueHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
275    }
276    
277    @Override
278    public void clearHasBeenModified() {
279        entityAttributePKHasBeenModified = false;
280        upperRangeIntegerValueHasBeenModified = false;
281        upperLimitIntegerValueHasBeenModified = false;
282        lowerLimitIntegerValueHasBeenModified = false;
283        lowerRangeIntegerValueHasBeenModified = false;
284        fromTimeHasBeenModified = false;
285        thruTimeHasBeenModified = false;
286    }
287    
288    public EntityAttributePK getEntityAttributePK() {
289        return entityAttributePK;
290    }
291    
292    public void setEntityAttributePK(EntityAttributePK entityAttributePK)
293            throws PersistenceNotNullException {
294        checkForNull(entityAttributePK);
295        
296        boolean update = true;
297        
298        if(this.entityAttributePK != null) {
299            if(this.entityAttributePK.equals(entityAttributePK)) {
300                update = false;
301            }
302        } else if(entityAttributePK == null) {
303            update = false;
304        }
305        
306        if(update) {
307            this.entityAttributePK = entityAttributePK;
308            entityAttributePKHasBeenModified = true;
309            clearHashAndString();
310        }
311    }
312    
313    public boolean getEntityAttributePKHasBeenModified() {
314        return entityAttributePKHasBeenModified;
315    }
316    
317    public Integer getUpperRangeIntegerValue() {
318        return upperRangeIntegerValue;
319    }
320    
321    public void setUpperRangeIntegerValue(Integer upperRangeIntegerValue) {
322        boolean update = true;
323        
324        if(this.upperRangeIntegerValue != null) {
325            if(this.upperRangeIntegerValue.equals(upperRangeIntegerValue)) {
326                update = false;
327            }
328        } else if(upperRangeIntegerValue == null) {
329            update = false;
330        }
331        
332        if(update) {
333            this.upperRangeIntegerValue = upperRangeIntegerValue;
334            upperRangeIntegerValueHasBeenModified = true;
335            clearHashAndString();
336        }
337    }
338    
339    public boolean getUpperRangeIntegerValueHasBeenModified() {
340        return upperRangeIntegerValueHasBeenModified;
341    }
342    
343    public Integer getUpperLimitIntegerValue() {
344        return upperLimitIntegerValue;
345    }
346    
347    public void setUpperLimitIntegerValue(Integer upperLimitIntegerValue) {
348        boolean update = true;
349        
350        if(this.upperLimitIntegerValue != null) {
351            if(this.upperLimitIntegerValue.equals(upperLimitIntegerValue)) {
352                update = false;
353            }
354        } else if(upperLimitIntegerValue == null) {
355            update = false;
356        }
357        
358        if(update) {
359            this.upperLimitIntegerValue = upperLimitIntegerValue;
360            upperLimitIntegerValueHasBeenModified = true;
361            clearHashAndString();
362        }
363    }
364    
365    public boolean getUpperLimitIntegerValueHasBeenModified() {
366        return upperLimitIntegerValueHasBeenModified;
367    }
368    
369    public Integer getLowerLimitIntegerValue() {
370        return lowerLimitIntegerValue;
371    }
372    
373    public void setLowerLimitIntegerValue(Integer lowerLimitIntegerValue) {
374        boolean update = true;
375        
376        if(this.lowerLimitIntegerValue != null) {
377            if(this.lowerLimitIntegerValue.equals(lowerLimitIntegerValue)) {
378                update = false;
379            }
380        } else if(lowerLimitIntegerValue == null) {
381            update = false;
382        }
383        
384        if(update) {
385            this.lowerLimitIntegerValue = lowerLimitIntegerValue;
386            lowerLimitIntegerValueHasBeenModified = true;
387            clearHashAndString();
388        }
389    }
390    
391    public boolean getLowerLimitIntegerValueHasBeenModified() {
392        return lowerLimitIntegerValueHasBeenModified;
393    }
394    
395    public Integer getLowerRangeIntegerValue() {
396        return lowerRangeIntegerValue;
397    }
398    
399    public void setLowerRangeIntegerValue(Integer lowerRangeIntegerValue) {
400        boolean update = true;
401        
402        if(this.lowerRangeIntegerValue != null) {
403            if(this.lowerRangeIntegerValue.equals(lowerRangeIntegerValue)) {
404                update = false;
405            }
406        } else if(lowerRangeIntegerValue == null) {
407            update = false;
408        }
409        
410        if(update) {
411            this.lowerRangeIntegerValue = lowerRangeIntegerValue;
412            lowerRangeIntegerValueHasBeenModified = true;
413            clearHashAndString();
414        }
415    }
416    
417    public boolean getLowerRangeIntegerValueHasBeenModified() {
418        return lowerRangeIntegerValueHasBeenModified;
419    }
420    
421    public Long getFromTime() {
422        return fromTime;
423    }
424    
425    public void setFromTime(Long fromTime)
426            throws PersistenceNotNullException {
427        checkForNull(fromTime);
428        
429        boolean update = true;
430        
431        if(this.fromTime != null) {
432            if(this.fromTime.equals(fromTime)) {
433                update = false;
434            }
435        } else if(fromTime == null) {
436            update = false;
437        }
438        
439        if(update) {
440            this.fromTime = fromTime;
441            fromTimeHasBeenModified = true;
442            clearHashAndString();
443        }
444    }
445    
446    public boolean getFromTimeHasBeenModified() {
447        return fromTimeHasBeenModified;
448    }
449    
450    public Long getThruTime() {
451        return thruTime;
452    }
453    
454    public void setThruTime(Long thruTime)
455            throws PersistenceNotNullException {
456        checkForNull(thruTime);
457        
458        boolean update = true;
459        
460        if(this.thruTime != null) {
461            if(this.thruTime.equals(thruTime)) {
462                update = false;
463            }
464        } else if(thruTime == null) {
465            update = false;
466        }
467        
468        if(update) {
469            this.thruTime = thruTime;
470            thruTimeHasBeenModified = true;
471            clearHashAndString();
472        }
473    }
474    
475    public boolean getThruTimeHasBeenModified() {
476        return thruTimeHasBeenModified;
477    }
478    
479}