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 * SequenceDetailValue.java
021 */
022
023package com.echothree.model.data.sequence.server.value;
024
025import com.echothree.model.data.sequence.common.pk.SequenceDetailPK;
026
027import com.echothree.model.data.sequence.server.factory.SequenceDetailFactory;
028
029import com.echothree.model.data.sequence.common.pk.SequencePK;
030import com.echothree.model.data.sequence.common.pk.SequenceTypePK;
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
039import javax.annotation.Nonnull;
040import javax.annotation.Nullable;
041
042public class SequenceDetailValue
043        extends BaseValue<SequenceDetailPK>
044        implements Cloneable, Serializable {
045    
046    private SequencePK sequencePK;
047    private boolean sequencePKHasBeenModified = false;
048    private SequenceTypePK sequenceTypePK;
049    private boolean sequenceTypePKHasBeenModified = false;
050    private String sequenceName;
051    private boolean sequenceNameHasBeenModified = false;
052    private String mask;
053    private boolean maskHasBeenModified = false;
054    private Integer chunkSize;
055    private boolean chunkSizeHasBeenModified = false;
056    private Boolean isDefault;
057    private boolean isDefaultHasBeenModified = false;
058    private Integer sortOrder;
059    private boolean sortOrderHasBeenModified = false;
060    private Long fromTime;
061    private boolean fromTimeHasBeenModified = false;
062    private Long thruTime;
063    private boolean thruTimeHasBeenModified = false;
064    
065    private transient Integer _hashCode = null;
066    private transient String _stringValue = null;
067    
068    private void constructFields(SequencePK sequencePK, SequenceTypePK sequenceTypePK, String sequenceName, String mask, Integer chunkSize, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
069            throws PersistenceNotNullException {
070        checkForNull(sequencePK);
071        this.sequencePK = sequencePK;
072        checkForNull(sequenceTypePK);
073        this.sequenceTypePK = sequenceTypePK;
074        checkForNull(sequenceName);
075        this.sequenceName = sequenceName;
076        checkForNull(mask);
077        this.mask = mask;
078        this.chunkSize = chunkSize;
079        checkForNull(isDefault);
080        this.isDefault = isDefault;
081        checkForNull(sortOrder);
082        this.sortOrder = sortOrder;
083        checkForNull(fromTime);
084        this.fromTime = fromTime;
085        checkForNull(thruTime);
086        this.thruTime = thruTime;
087    }
088    
089    /** Creates a new instance of SequenceDetailValue */
090    public SequenceDetailValue(SequenceDetailPK sequenceDetailPK, SequencePK sequencePK, SequenceTypePK sequenceTypePK, String sequenceName, String mask, Integer chunkSize, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
091            throws PersistenceNotNullException {
092        super(sequenceDetailPK);
093        constructFields(sequencePK, sequenceTypePK, sequenceName, mask, chunkSize, isDefault, sortOrder, fromTime, thruTime);
094    }
095    
096    /** Creates a new instance of SequenceDetailValue */
097    public SequenceDetailValue(SequencePK sequencePK, SequenceTypePK sequenceTypePK, String sequenceName, String mask, Integer chunkSize, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
098            throws PersistenceNotNullException {
099        super();
100        constructFields(sequencePK, sequenceTypePK, sequenceName, mask, chunkSize, isDefault, sortOrder, fromTime, thruTime);
101    }
102    
103    @Override
104    @Nonnull
105    public SequenceDetailFactory getBaseFactoryInstance() {
106        return SequenceDetailFactory.getInstance();
107    }
108    
109    @Override
110    @Nonnull
111    public SequenceDetailValue clone() {
112        Object result;
113        
114        try {
115            result = super.clone();
116        } catch (CloneNotSupportedException cnse) {
117            // This shouldn't happen, fail when it does.
118            throw new PersistenceCloneException(cnse);
119        }
120        
121        return (SequenceDetailValue)result;
122    }
123    
124    @Override
125    @Nonnull
126    public SequenceDetailPK getPrimaryKey() {
127        if(_primaryKey == null) {
128            _primaryKey = new SequenceDetailPK(entityId);
129        }
130        
131        return _primaryKey;
132    }
133    
134    private void clearHashAndString() {
135        _hashCode = null;
136        _stringValue = null;
137    }
138    
139    @Override
140    public int hashCode() {
141        if(_hashCode == null) {
142            int hashCode = 17;
143            
144            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
145            
146            hashCode = 37 * hashCode + ((sequencePK != null) ? sequencePK.hashCode() : 0);
147            hashCode = 37 * hashCode + ((sequenceTypePK != null) ? sequenceTypePK.hashCode() : 0);
148            hashCode = 37 * hashCode + ((sequenceName != null) ? sequenceName.hashCode() : 0);
149            hashCode = 37 * hashCode + ((mask != null) ? mask.hashCode() : 0);
150            hashCode = 37 * hashCode + ((chunkSize != null) ? chunkSize.hashCode() : 0);
151            hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0);
152            hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0);
153            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
154            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
155            
156            _hashCode = hashCode;
157        }
158        
159        return _hashCode;
160    }
161    
162    @Override
163    @Nonnull
164    public String toString() {
165        if(_stringValue == null) {
166            _stringValue = "{" + 
167                    "entityId=" + getEntityId() +
168                    ", sequencePK=" + getSequencePK() +
169                    ", sequenceTypePK=" + getSequenceTypePK() +
170                    ", sequenceName=" + getSequenceName() +
171                    ", mask=" + getMask() +
172                    ", chunkSize=" + getChunkSize() +
173                    ", isDefault=" + getIsDefault() +
174                    ", sortOrder=" + getSortOrder() +
175                    ", fromTime=" + getFromTime() +
176                    ", thruTime=" + getThruTime() +
177                    "}";
178        }
179        return _stringValue;
180    }
181    
182    @Override
183    public boolean equals(Object other) {
184        if(this == other)
185            return true;
186        
187        if(!hasIdentity())
188            return false;
189        
190        if(other instanceof  SequenceDetailValue that) {
191            if(!that.hasIdentity())
192                return false;
193            
194            Long thisEntityId = getEntityId();
195            Long thatEntityId = that.getEntityId();
196            
197            boolean objectsEqual = thisEntityId.equals(thatEntityId);
198            if(objectsEqual)
199                objectsEqual = isIdentical(that);
200            
201            return objectsEqual;
202        } else {
203            return false;
204        }
205    }
206    
207    public boolean isIdentical(Object other) {
208        if(other instanceof SequenceDetailValue that) {
209            boolean objectsEqual = true;
210            
211            
212            if(objectsEqual) {
213                SequencePK thisSequencePK = getSequencePK();
214                SequencePK thatSequencePK = that.getSequencePK();
215                
216                if(thisSequencePK == null) {
217                    objectsEqual = objectsEqual && (thatSequencePK == null);
218                } else {
219                    objectsEqual = objectsEqual && thisSequencePK.equals(thatSequencePK);
220                }
221            }
222            
223            if(objectsEqual) {
224                SequenceTypePK thisSequenceTypePK = getSequenceTypePK();
225                SequenceTypePK thatSequenceTypePK = that.getSequenceTypePK();
226                
227                if(thisSequenceTypePK == null) {
228                    objectsEqual = objectsEqual && (thatSequenceTypePK == null);
229                } else {
230                    objectsEqual = objectsEqual && thisSequenceTypePK.equals(thatSequenceTypePK);
231                }
232            }
233            
234            if(objectsEqual) {
235                String thisSequenceName = getSequenceName();
236                String thatSequenceName = that.getSequenceName();
237                
238                if(thisSequenceName == null) {
239                    objectsEqual = objectsEqual && (thatSequenceName == null);
240                } else {
241                    objectsEqual = objectsEqual && thisSequenceName.equals(thatSequenceName);
242                }
243            }
244            
245            if(objectsEqual) {
246                String thisMask = getMask();
247                String thatMask = that.getMask();
248                
249                if(thisMask == null) {
250                    objectsEqual = objectsEqual && (thatMask == null);
251                } else {
252                    objectsEqual = objectsEqual && thisMask.equals(thatMask);
253                }
254            }
255            
256            if(objectsEqual) {
257                Integer thisChunkSize = getChunkSize();
258                Integer thatChunkSize = that.getChunkSize();
259                
260                if(thisChunkSize == null) {
261                    objectsEqual = objectsEqual && (thatChunkSize == null);
262                } else {
263                    objectsEqual = objectsEqual && thisChunkSize.equals(thatChunkSize);
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 sequencePKHasBeenModified || sequenceTypePKHasBeenModified || sequenceNameHasBeenModified || maskHasBeenModified || chunkSizeHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
320    }
321    
322    @Override
323    public void clearHasBeenModified() {
324        sequencePKHasBeenModified = false;
325        sequenceTypePKHasBeenModified = false;
326        sequenceNameHasBeenModified = false;
327        maskHasBeenModified = false;
328        chunkSizeHasBeenModified = false;
329        isDefaultHasBeenModified = false;
330        sortOrderHasBeenModified = false;
331        fromTimeHasBeenModified = false;
332        thruTimeHasBeenModified = false;
333    }
334    
335    @Nonnull
336    public SequencePK getSequencePK() {
337        return sequencePK;
338    }
339    
340    public void setSequencePK(@Nonnull SequencePK sequencePK)
341            throws PersistenceNotNullException {
342        checkForNull(sequencePK);
343        
344        boolean update = true;
345        
346        if(this.sequencePK != null) {
347            if(this.sequencePK.equals(sequencePK)) {
348                update = false;
349            }
350        } else if(sequencePK == null) {
351            update = false;
352        }
353        
354        if(update) {
355            this.sequencePK = sequencePK;
356            sequencePKHasBeenModified = true;
357            clearHashAndString();
358        }
359    }
360    
361    public boolean getSequencePKHasBeenModified() {
362        return sequencePKHasBeenModified;
363    }
364    
365    @Nonnull
366    public SequenceTypePK getSequenceTypePK() {
367        return sequenceTypePK;
368    }
369    
370    public void setSequenceTypePK(@Nonnull SequenceTypePK sequenceTypePK)
371            throws PersistenceNotNullException {
372        checkForNull(sequenceTypePK);
373        
374        boolean update = true;
375        
376        if(this.sequenceTypePK != null) {
377            if(this.sequenceTypePK.equals(sequenceTypePK)) {
378                update = false;
379            }
380        } else if(sequenceTypePK == null) {
381            update = false;
382        }
383        
384        if(update) {
385            this.sequenceTypePK = sequenceTypePK;
386            sequenceTypePKHasBeenModified = true;
387            clearHashAndString();
388        }
389    }
390    
391    public boolean getSequenceTypePKHasBeenModified() {
392        return sequenceTypePKHasBeenModified;
393    }
394    
395    @Nonnull
396    public String getSequenceName() {
397        return sequenceName;
398    }
399    
400    public void setSequenceName(@Nonnull String sequenceName)
401            throws PersistenceNotNullException {
402        checkForNull(sequenceName);
403        
404        boolean update = true;
405        
406        if(this.sequenceName != null) {
407            if(this.sequenceName.equals(sequenceName)) {
408                update = false;
409            }
410        } else if(sequenceName == null) {
411            update = false;
412        }
413        
414        if(update) {
415            this.sequenceName = sequenceName;
416            sequenceNameHasBeenModified = true;
417            clearHashAndString();
418        }
419    }
420    
421    public boolean getSequenceNameHasBeenModified() {
422        return sequenceNameHasBeenModified;
423    }
424    
425    @Nonnull
426    public String getMask() {
427        return mask;
428    }
429    
430    public void setMask(@Nonnull String mask)
431            throws PersistenceNotNullException {
432        checkForNull(mask);
433        
434        boolean update = true;
435        
436        if(this.mask != null) {
437            if(this.mask.equals(mask)) {
438                update = false;
439            }
440        } else if(mask == null) {
441            update = false;
442        }
443        
444        if(update) {
445            this.mask = mask;
446            maskHasBeenModified = true;
447            clearHashAndString();
448        }
449    }
450    
451    public boolean getMaskHasBeenModified() {
452        return maskHasBeenModified;
453    }
454    
455    @Nullable
456    public Integer getChunkSize() {
457        return chunkSize;
458    }
459    
460    public void setChunkSize(@Nullable Integer chunkSize) {
461        boolean update = true;
462        
463        if(this.chunkSize != null) {
464            if(this.chunkSize.equals(chunkSize)) {
465                update = false;
466            }
467        } else if(chunkSize == null) {
468            update = false;
469        }
470        
471        if(update) {
472            this.chunkSize = chunkSize;
473            chunkSizeHasBeenModified = true;
474            clearHashAndString();
475        }
476    }
477    
478    public boolean getChunkSizeHasBeenModified() {
479        return chunkSizeHasBeenModified;
480    }
481    
482    @Nonnull
483    public Boolean getIsDefault() {
484        return isDefault;
485    }
486    
487    public void setIsDefault(@Nonnull Boolean isDefault)
488            throws PersistenceNotNullException {
489        checkForNull(isDefault);
490        
491        boolean update = true;
492        
493        if(this.isDefault != null) {
494            if(this.isDefault.equals(isDefault)) {
495                update = false;
496            }
497        } else if(isDefault == null) {
498            update = false;
499        }
500        
501        if(update) {
502            this.isDefault = isDefault;
503            isDefaultHasBeenModified = true;
504            clearHashAndString();
505        }
506    }
507    
508    public boolean getIsDefaultHasBeenModified() {
509        return isDefaultHasBeenModified;
510    }
511    
512    @Nonnull
513    public Integer getSortOrder() {
514        return sortOrder;
515    }
516    
517    public void setSortOrder(@Nonnull Integer sortOrder)
518            throws PersistenceNotNullException {
519        checkForNull(sortOrder);
520        
521        boolean update = true;
522        
523        if(this.sortOrder != null) {
524            if(this.sortOrder.equals(sortOrder)) {
525                update = false;
526            }
527        } else if(sortOrder == null) {
528            update = false;
529        }
530        
531        if(update) {
532            this.sortOrder = sortOrder;
533            sortOrderHasBeenModified = true;
534            clearHashAndString();
535        }
536    }
537    
538    public boolean getSortOrderHasBeenModified() {
539        return sortOrderHasBeenModified;
540    }
541    
542    @Nonnull
543    public Long getFromTime() {
544        return fromTime;
545    }
546    
547    public void setFromTime(@Nonnull Long fromTime)
548            throws PersistenceNotNullException {
549        checkForNull(fromTime);
550        
551        boolean update = true;
552        
553        if(this.fromTime != null) {
554            if(this.fromTime.equals(fromTime)) {
555                update = false;
556            }
557        } else if(fromTime == null) {
558            update = false;
559        }
560        
561        if(update) {
562            this.fromTime = fromTime;
563            fromTimeHasBeenModified = true;
564            clearHashAndString();
565        }
566    }
567    
568    public boolean getFromTimeHasBeenModified() {
569        return fromTimeHasBeenModified;
570    }
571    
572    @Nonnull
573    public Long getThruTime() {
574        return thruTime;
575    }
576    
577    public void setThruTime(@Nonnull Long thruTime)
578            throws PersistenceNotNullException {
579        checkForNull(thruTime);
580        
581        boolean update = true;
582        
583        if(this.thruTime != null) {
584            if(this.thruTime.equals(thruTime)) {
585                update = false;
586            }
587        } else if(thruTime == null) {
588            update = false;
589        }
590        
591        if(update) {
592            this.thruTime = thruTime;
593            thruTimeHasBeenModified = true;
594            clearHashAndString();
595        }
596    }
597    
598    public boolean getThruTimeHasBeenModified() {
599        return thruTimeHasBeenModified;
600    }
601    
602}