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