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 * 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
039public class SequenceDetailValue
040        extends BaseValue<SequenceDetailPK>
041        implements Cloneable, Serializable {
042    
043    private SequencePK sequencePK;
044    private boolean sequencePKHasBeenModified = false;
045    private SequenceTypePK sequenceTypePK;
046    private boolean sequenceTypePKHasBeenModified = false;
047    private String sequenceName;
048    private boolean sequenceNameHasBeenModified = false;
049    private String mask;
050    private boolean maskHasBeenModified = false;
051    private Integer chunkSize;
052    private boolean chunkSizeHasBeenModified = 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(SequencePK sequencePK, SequenceTypePK sequenceTypePK, String sequenceName, String mask, Integer chunkSize, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
066            throws PersistenceNotNullException {
067        checkForNull(sequencePK);
068        this.sequencePK = sequencePK;
069        checkForNull(sequenceTypePK);
070        this.sequenceTypePK = sequenceTypePK;
071        checkForNull(sequenceName);
072        this.sequenceName = sequenceName;
073        checkForNull(mask);
074        this.mask = mask;
075        this.chunkSize = chunkSize;
076        checkForNull(isDefault);
077        this.isDefault = isDefault;
078        checkForNull(sortOrder);
079        this.sortOrder = sortOrder;
080        checkForNull(fromTime);
081        this.fromTime = fromTime;
082        checkForNull(thruTime);
083        this.thruTime = thruTime;
084    }
085    
086    /** Creates a new instance of SequenceDetailValue */
087    public SequenceDetailValue(SequenceDetailPK sequenceDetailPK, SequencePK sequencePK, SequenceTypePK sequenceTypePK, String sequenceName, String mask, Integer chunkSize, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
088            throws PersistenceNotNullException {
089        super(sequenceDetailPK);
090        constructFields(sequencePK, sequenceTypePK, sequenceName, mask, chunkSize, isDefault, sortOrder, fromTime, thruTime);
091    }
092    
093    /** Creates a new instance of SequenceDetailValue */
094    public SequenceDetailValue(SequencePK sequencePK, SequenceTypePK sequenceTypePK, String sequenceName, String mask, Integer chunkSize, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
095            throws PersistenceNotNullException {
096        super();
097        constructFields(sequencePK, sequenceTypePK, sequenceName, mask, chunkSize, isDefault, sortOrder, fromTime, thruTime);
098    }
099    
100   @Override
101   public SequenceDetailFactory getBaseFactoryInstance() {
102        return SequenceDetailFactory.getInstance();
103    }
104    
105    @Override
106    public SequenceDetailValue clone() {
107        Object result;
108        
109        try {
110            result = super.clone();
111        } catch (CloneNotSupportedException cnse) {
112            // This shouldn't happen, fail when it does.
113            throw new PersistenceCloneException(cnse);
114        }
115        
116        return (SequenceDetailValue)result;
117    }
118    
119   @Override
120    public SequenceDetailPK getPrimaryKey() {
121        if(_primaryKey == null) {
122            _primaryKey = new SequenceDetailPK(entityId);
123        }
124        
125        return _primaryKey;
126    }
127    
128    private void clearHashAndString() {
129        _hashCode = null;
130        _stringValue = null;
131    }
132    
133    @Override
134    public int hashCode() {
135        if(_hashCode == null) {
136            int hashCode = 17;
137            
138            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
139            
140            hashCode = 37 * hashCode + ((sequencePK != null) ? sequencePK.hashCode() : 0);
141            hashCode = 37 * hashCode + ((sequenceTypePK != null) ? sequenceTypePK.hashCode() : 0);
142            hashCode = 37 * hashCode + ((sequenceName != null) ? sequenceName.hashCode() : 0);
143            hashCode = 37 * hashCode + ((mask != null) ? mask.hashCode() : 0);
144            hashCode = 37 * hashCode + ((chunkSize != null) ? chunkSize.hashCode() : 0);
145            hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0);
146            hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0);
147            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
148            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
149            
150            _hashCode = hashCode;
151        }
152        
153        return _hashCode;
154    }
155    
156    @Override
157    public String toString() {
158        if(_stringValue == null) {
159            StringBuilder stringValue = new StringBuilder("{");
160            
161            stringValue.append("entityId=").append(getEntityId());
162            
163            stringValue.append(", sequencePK=").append(getSequencePK());
164            stringValue.append(", sequenceTypePK=").append(getSequenceTypePK());
165            stringValue.append(", sequenceName=").append(getSequenceName());
166            stringValue.append(", mask=").append(getMask());
167            stringValue.append(", chunkSize=").append(getChunkSize());
168            stringValue.append(", isDefault=").append(getIsDefault());
169            stringValue.append(", sortOrder=").append(getSortOrder());
170            stringValue.append(", fromTime=").append(getFromTime());
171            stringValue.append(", thruTime=").append(getThruTime());
172            
173            stringValue.append('}');
174            
175            _stringValue = stringValue.toString();
176        }
177        return _stringValue;
178    }
179    
180    @Override
181    public boolean equals(Object other) {
182        if(this == other)
183            return true;
184        
185        if(!hasIdentity())
186            return false;
187        
188        if(other instanceof  SequenceDetailValue) {
189            SequenceDetailValue that = (SequenceDetailValue)other;
190            
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 = 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) {
209            SequenceDetailValue that = (SequenceDetailValue)other;
210            boolean objectsEqual = true;
211            
212            
213            if(objectsEqual) {
214                SequencePK thisSequencePK = getSequencePK();
215                SequencePK thatSequencePK = that.getSequencePK();
216                
217                if(thisSequencePK == null) {
218                    objectsEqual = objectsEqual && (thatSequencePK == null);
219                } else {
220                    objectsEqual = objectsEqual && thisSequencePK.equals(thatSequencePK);
221                }
222            }
223            
224            if(objectsEqual) {
225                SequenceTypePK thisSequenceTypePK = getSequenceTypePK();
226                SequenceTypePK thatSequenceTypePK = that.getSequenceTypePK();
227                
228                if(thisSequenceTypePK == null) {
229                    objectsEqual = objectsEqual && (thatSequenceTypePK == null);
230                } else {
231                    objectsEqual = objectsEqual && thisSequenceTypePK.equals(thatSequenceTypePK);
232                }
233            }
234            
235            if(objectsEqual) {
236                String thisSequenceName = getSequenceName();
237                String thatSequenceName = that.getSequenceName();
238                
239                if(thisSequenceName == null) {
240                    objectsEqual = objectsEqual && (thatSequenceName == null);
241                } else {
242                    objectsEqual = objectsEqual && thisSequenceName.equals(thatSequenceName);
243                }
244            }
245            
246            if(objectsEqual) {
247                String thisMask = getMask();
248                String thatMask = that.getMask();
249                
250                if(thisMask == null) {
251                    objectsEqual = objectsEqual && (thatMask == null);
252                } else {
253                    objectsEqual = objectsEqual && thisMask.equals(thatMask);
254                }
255            }
256            
257            if(objectsEqual) {
258                Integer thisChunkSize = getChunkSize();
259                Integer thatChunkSize = that.getChunkSize();
260                
261                if(thisChunkSize == null) {
262                    objectsEqual = objectsEqual && (thatChunkSize == null);
263                } else {
264                    objectsEqual = objectsEqual && thisChunkSize.equals(thatChunkSize);
265                }
266            }
267            
268            if(objectsEqual) {
269                Boolean thisIsDefault = getIsDefault();
270                Boolean thatIsDefault = that.getIsDefault();
271                
272                if(thisIsDefault == null) {
273                    objectsEqual = objectsEqual && (thatIsDefault == null);
274                } else {
275                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
276                }
277            }
278            
279            if(objectsEqual) {
280                Integer thisSortOrder = getSortOrder();
281                Integer thatSortOrder = that.getSortOrder();
282                
283                if(thisSortOrder == null) {
284                    objectsEqual = objectsEqual && (thatSortOrder == null);
285                } else {
286                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
287                }
288            }
289            
290            if(objectsEqual) {
291                Long thisFromTime = getFromTime();
292                Long thatFromTime = that.getFromTime();
293                
294                if(thisFromTime == null) {
295                    objectsEqual = objectsEqual && (thatFromTime == null);
296                } else {
297                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
298                }
299            }
300            
301            if(objectsEqual) {
302                Long thisThruTime = getThruTime();
303                Long thatThruTime = that.getThruTime();
304                
305                if(thisThruTime == null) {
306                    objectsEqual = objectsEqual && (thatThruTime == null);
307                } else {
308                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
309                }
310            }
311            
312            return objectsEqual;
313        } else {
314            return false;
315        }
316    }
317    
318    @Override
319    public boolean hasBeenModified() {
320        return sequencePKHasBeenModified || sequenceTypePKHasBeenModified || sequenceNameHasBeenModified || maskHasBeenModified || chunkSizeHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
321    }
322    
323    @Override
324    public void clearHasBeenModified() {
325        sequencePKHasBeenModified = false;
326        sequenceTypePKHasBeenModified = false;
327        sequenceNameHasBeenModified = false;
328        maskHasBeenModified = false;
329        chunkSizeHasBeenModified = false;
330        isDefaultHasBeenModified = false;
331        sortOrderHasBeenModified = false;
332        fromTimeHasBeenModified = false;
333        thruTimeHasBeenModified = false;
334    }
335    
336    public SequencePK getSequencePK() {
337        return sequencePK;
338    }
339    
340    public void setSequencePK(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    public SequenceTypePK getSequenceTypePK() {
366        return sequenceTypePK;
367    }
368    
369    public void setSequenceTypePK(SequenceTypePK sequenceTypePK)
370            throws PersistenceNotNullException {
371        checkForNull(sequenceTypePK);
372        
373        boolean update = true;
374        
375        if(this.sequenceTypePK != null) {
376            if(this.sequenceTypePK.equals(sequenceTypePK)) {
377                update = false;
378            }
379        } else if(sequenceTypePK == null) {
380            update = false;
381        }
382        
383        if(update) {
384            this.sequenceTypePK = sequenceTypePK;
385            sequenceTypePKHasBeenModified = true;
386            clearHashAndString();
387        }
388    }
389    
390    public boolean getSequenceTypePKHasBeenModified() {
391        return sequenceTypePKHasBeenModified;
392    }
393    
394    public String getSequenceName() {
395        return sequenceName;
396    }
397    
398    public void setSequenceName(String sequenceName)
399            throws PersistenceNotNullException {
400        checkForNull(sequenceName);
401        
402        boolean update = true;
403        
404        if(this.sequenceName != null) {
405            if(this.sequenceName.equals(sequenceName)) {
406                update = false;
407            }
408        } else if(sequenceName == null) {
409            update = false;
410        }
411        
412        if(update) {
413            this.sequenceName = sequenceName;
414            sequenceNameHasBeenModified = true;
415            clearHashAndString();
416        }
417    }
418    
419    public boolean getSequenceNameHasBeenModified() {
420        return sequenceNameHasBeenModified;
421    }
422    
423    public String getMask() {
424        return mask;
425    }
426    
427    public void setMask(String mask)
428            throws PersistenceNotNullException {
429        checkForNull(mask);
430        
431        boolean update = true;
432        
433        if(this.mask != null) {
434            if(this.mask.equals(mask)) {
435                update = false;
436            }
437        } else if(mask == null) {
438            update = false;
439        }
440        
441        if(update) {
442            this.mask = mask;
443            maskHasBeenModified = true;
444            clearHashAndString();
445        }
446    }
447    
448    public boolean getMaskHasBeenModified() {
449        return maskHasBeenModified;
450    }
451    
452    public Integer getChunkSize() {
453        return chunkSize;
454    }
455    
456    public void setChunkSize(Integer chunkSize) {
457        boolean update = true;
458        
459        if(this.chunkSize != null) {
460            if(this.chunkSize.equals(chunkSize)) {
461                update = false;
462            }
463        } else if(chunkSize == null) {
464            update = false;
465        }
466        
467        if(update) {
468            this.chunkSize = chunkSize;
469            chunkSizeHasBeenModified = true;
470            clearHashAndString();
471        }
472    }
473    
474    public boolean getChunkSizeHasBeenModified() {
475        return chunkSizeHasBeenModified;
476    }
477    
478    public Boolean getIsDefault() {
479        return isDefault;
480    }
481    
482    public void setIsDefault(Boolean isDefault)
483            throws PersistenceNotNullException {
484        checkForNull(isDefault);
485        
486        boolean update = true;
487        
488        if(this.isDefault != null) {
489            if(this.isDefault.equals(isDefault)) {
490                update = false;
491            }
492        } else if(isDefault == null) {
493            update = false;
494        }
495        
496        if(update) {
497            this.isDefault = isDefault;
498            isDefaultHasBeenModified = true;
499            clearHashAndString();
500        }
501    }
502    
503    public boolean getIsDefaultHasBeenModified() {
504        return isDefaultHasBeenModified;
505    }
506    
507    public Integer getSortOrder() {
508        return sortOrder;
509    }
510    
511    public void setSortOrder(Integer sortOrder)
512            throws PersistenceNotNullException {
513        checkForNull(sortOrder);
514        
515        boolean update = true;
516        
517        if(this.sortOrder != null) {
518            if(this.sortOrder.equals(sortOrder)) {
519                update = false;
520            }
521        } else if(sortOrder == null) {
522            update = false;
523        }
524        
525        if(update) {
526            this.sortOrder = sortOrder;
527            sortOrderHasBeenModified = true;
528            clearHashAndString();
529        }
530    }
531    
532    public boolean getSortOrderHasBeenModified() {
533        return sortOrderHasBeenModified;
534    }
535    
536    public Long getFromTime() {
537        return fromTime;
538    }
539    
540    public void setFromTime(Long fromTime)
541            throws PersistenceNotNullException {
542        checkForNull(fromTime);
543        
544        boolean update = true;
545        
546        if(this.fromTime != null) {
547            if(this.fromTime.equals(fromTime)) {
548                update = false;
549            }
550        } else if(fromTime == null) {
551            update = false;
552        }
553        
554        if(update) {
555            this.fromTime = fromTime;
556            fromTimeHasBeenModified = true;
557            clearHashAndString();
558        }
559    }
560    
561    public boolean getFromTimeHasBeenModified() {
562        return fromTimeHasBeenModified;
563    }
564    
565    public Long getThruTime() {
566        return thruTime;
567    }
568    
569    public void setThruTime(Long thruTime)
570            throws PersistenceNotNullException {
571        checkForNull(thruTime);
572        
573        boolean update = true;
574        
575        if(this.thruTime != null) {
576            if(this.thruTime.equals(thruTime)) {
577                update = false;
578            }
579        } else if(thruTime == null) {
580            update = false;
581        }
582        
583        if(update) {
584            this.thruTime = thruTime;
585            thruTimeHasBeenModified = true;
586            clearHashAndString();
587        }
588    }
589    
590    public boolean getThruTimeHasBeenModified() {
591        return thruTimeHasBeenModified;
592    }
593    
594}