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