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