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 * 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            StringBuilder stringValue = new StringBuilder("{");
161            
162            stringValue.append("entityId=").append(getEntityId());
163            
164            stringValue.append(", indexPK=").append(getIndexPK());
165            stringValue.append(", indexName=").append(getIndexName());
166            stringValue.append(", indexTypePK=").append(getIndexTypePK());
167            stringValue.append(", languagePK=").append(getLanguagePK());
168            stringValue.append(", directory=").append(getDirectory());
169            stringValue.append(", isDefault=").append(getIsDefault());
170            stringValue.append(", sortOrder=").append(getSortOrder());
171            stringValue.append(", fromTime=").append(getFromTime());
172            stringValue.append(", thruTime=").append(getThruTime());
173            
174            stringValue.append('}');
175            
176            _stringValue = stringValue.toString();
177        }
178        return _stringValue;
179    }
180    
181    @Override
182    public boolean equals(Object other) {
183        if(this == other)
184            return true;
185        
186        if(!hasIdentity())
187            return false;
188        
189        if(other instanceof  IndexDetailValue) {
190            IndexDetailValue that = (IndexDetailValue)other;
191            
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 = 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) {
210            IndexDetailValue that = (IndexDetailValue)other;
211            boolean objectsEqual = true;
212            
213            
214            if(objectsEqual) {
215                IndexPK thisIndexPK = getIndexPK();
216                IndexPK thatIndexPK = that.getIndexPK();
217                
218                if(thisIndexPK == null) {
219                    objectsEqual = objectsEqual && (thatIndexPK == null);
220                } else {
221                    objectsEqual = objectsEqual && thisIndexPK.equals(thatIndexPK);
222                }
223            }
224            
225            if(objectsEqual) {
226                String thisIndexName = getIndexName();
227                String thatIndexName = that.getIndexName();
228                
229                if(thisIndexName == null) {
230                    objectsEqual = objectsEqual && (thatIndexName == null);
231                } else {
232                    objectsEqual = objectsEqual && thisIndexName.equals(thatIndexName);
233                }
234            }
235            
236            if(objectsEqual) {
237                IndexTypePK thisIndexTypePK = getIndexTypePK();
238                IndexTypePK thatIndexTypePK = that.getIndexTypePK();
239                
240                if(thisIndexTypePK == null) {
241                    objectsEqual = objectsEqual && (thatIndexTypePK == null);
242                } else {
243                    objectsEqual = objectsEqual && thisIndexTypePK.equals(thatIndexTypePK);
244                }
245            }
246            
247            if(objectsEqual) {
248                LanguagePK thisLanguagePK = getLanguagePK();
249                LanguagePK thatLanguagePK = that.getLanguagePK();
250                
251                if(thisLanguagePK == null) {
252                    objectsEqual = objectsEqual && (thatLanguagePK == null);
253                } else {
254                    objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK);
255                }
256            }
257            
258            if(objectsEqual) {
259                String thisDirectory = getDirectory();
260                String thatDirectory = that.getDirectory();
261                
262                if(thisDirectory == null) {
263                    objectsEqual = objectsEqual && (thatDirectory == null);
264                } else {
265                    objectsEqual = objectsEqual && thisDirectory.equals(thatDirectory);
266                }
267            }
268            
269            if(objectsEqual) {
270                Boolean thisIsDefault = getIsDefault();
271                Boolean thatIsDefault = that.getIsDefault();
272                
273                if(thisIsDefault == null) {
274                    objectsEqual = objectsEqual && (thatIsDefault == null);
275                } else {
276                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
277                }
278            }
279            
280            if(objectsEqual) {
281                Integer thisSortOrder = getSortOrder();
282                Integer thatSortOrder = that.getSortOrder();
283                
284                if(thisSortOrder == null) {
285                    objectsEqual = objectsEqual && (thatSortOrder == null);
286                } else {
287                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
288                }
289            }
290            
291            if(objectsEqual) {
292                Long thisFromTime = getFromTime();
293                Long thatFromTime = that.getFromTime();
294                
295                if(thisFromTime == null) {
296                    objectsEqual = objectsEqual && (thatFromTime == null);
297                } else {
298                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
299                }
300            }
301            
302            if(objectsEqual) {
303                Long thisThruTime = getThruTime();
304                Long thatThruTime = that.getThruTime();
305                
306                if(thisThruTime == null) {
307                    objectsEqual = objectsEqual && (thatThruTime == null);
308                } else {
309                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
310                }
311            }
312            
313            return objectsEqual;
314        } else {
315            return false;
316        }
317    }
318    
319    @Override
320    public boolean hasBeenModified() {
321        return indexPKHasBeenModified || indexNameHasBeenModified || indexTypePKHasBeenModified || languagePKHasBeenModified || directoryHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
322    }
323    
324    @Override
325    public void clearHasBeenModified() {
326        indexPKHasBeenModified = false;
327        indexNameHasBeenModified = false;
328        indexTypePKHasBeenModified = false;
329        languagePKHasBeenModified = false;
330        directoryHasBeenModified = false;
331        isDefaultHasBeenModified = false;
332        sortOrderHasBeenModified = false;
333        fromTimeHasBeenModified = false;
334        thruTimeHasBeenModified = false;
335    }
336    
337    public IndexPK getIndexPK() {
338        return indexPK;
339    }
340    
341    public void setIndexPK(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    public String getIndexName() {
367        return indexName;
368    }
369    
370    public void setIndexName(String indexName)
371            throws PersistenceNotNullException {
372        checkForNull(indexName);
373        
374        boolean update = true;
375        
376        if(this.indexName != null) {
377            if(this.indexName.equals(indexName)) {
378                update = false;
379            }
380        } else if(indexName == null) {
381            update = false;
382        }
383        
384        if(update) {
385            this.indexName = indexName;
386            indexNameHasBeenModified = true;
387            clearHashAndString();
388        }
389    }
390    
391    public boolean getIndexNameHasBeenModified() {
392        return indexNameHasBeenModified;
393    }
394    
395    public IndexTypePK getIndexTypePK() {
396        return indexTypePK;
397    }
398    
399    public void setIndexTypePK(IndexTypePK indexTypePK)
400            throws PersistenceNotNullException {
401        checkForNull(indexTypePK);
402        
403        boolean update = true;
404        
405        if(this.indexTypePK != null) {
406            if(this.indexTypePK.equals(indexTypePK)) {
407                update = false;
408            }
409        } else if(indexTypePK == null) {
410            update = false;
411        }
412        
413        if(update) {
414            this.indexTypePK = indexTypePK;
415            indexTypePKHasBeenModified = true;
416            clearHashAndString();
417        }
418    }
419    
420    public boolean getIndexTypePKHasBeenModified() {
421        return indexTypePKHasBeenModified;
422    }
423    
424    public LanguagePK getLanguagePK() {
425        return languagePK;
426    }
427    
428    public void setLanguagePK(LanguagePK languagePK) {
429        boolean update = true;
430        
431        if(this.languagePK != null) {
432            if(this.languagePK.equals(languagePK)) {
433                update = false;
434            }
435        } else if(languagePK == null) {
436            update = false;
437        }
438        
439        if(update) {
440            this.languagePK = languagePK;
441            languagePKHasBeenModified = true;
442            clearHashAndString();
443        }
444    }
445    
446    public boolean getLanguagePKHasBeenModified() {
447        return languagePKHasBeenModified;
448    }
449    
450    public String getDirectory() {
451        return directory;
452    }
453    
454    public void setDirectory(String directory)
455            throws PersistenceNotNullException {
456        checkForNull(directory);
457        
458        boolean update = true;
459        
460        if(this.directory != null) {
461            if(this.directory.equals(directory)) {
462                update = false;
463            }
464        } else if(directory == null) {
465            update = false;
466        }
467        
468        if(update) {
469            this.directory = directory;
470            directoryHasBeenModified = true;
471            clearHashAndString();
472        }
473    }
474    
475    public boolean getDirectoryHasBeenModified() {
476        return directoryHasBeenModified;
477    }
478    
479    public Boolean getIsDefault() {
480        return isDefault;
481    }
482    
483    public void setIsDefault(Boolean isDefault)
484            throws PersistenceNotNullException {
485        checkForNull(isDefault);
486        
487        boolean update = true;
488        
489        if(this.isDefault != null) {
490            if(this.isDefault.equals(isDefault)) {
491                update = false;
492            }
493        } else if(isDefault == null) {
494            update = false;
495        }
496        
497        if(update) {
498            this.isDefault = isDefault;
499            isDefaultHasBeenModified = true;
500            clearHashAndString();
501        }
502    }
503    
504    public boolean getIsDefaultHasBeenModified() {
505        return isDefaultHasBeenModified;
506    }
507    
508    public Integer getSortOrder() {
509        return sortOrder;
510    }
511    
512    public void setSortOrder(Integer sortOrder)
513            throws PersistenceNotNullException {
514        checkForNull(sortOrder);
515        
516        boolean update = true;
517        
518        if(this.sortOrder != null) {
519            if(this.sortOrder.equals(sortOrder)) {
520                update = false;
521            }
522        } else if(sortOrder == null) {
523            update = false;
524        }
525        
526        if(update) {
527            this.sortOrder = sortOrder;
528            sortOrderHasBeenModified = true;
529            clearHashAndString();
530        }
531    }
532    
533    public boolean getSortOrderHasBeenModified() {
534        return sortOrderHasBeenModified;
535    }
536    
537    public Long getFromTime() {
538        return fromTime;
539    }
540    
541    public void setFromTime(Long fromTime)
542            throws PersistenceNotNullException {
543        checkForNull(fromTime);
544        
545        boolean update = true;
546        
547        if(this.fromTime != null) {
548            if(this.fromTime.equals(fromTime)) {
549                update = false;
550            }
551        } else if(fromTime == null) {
552            update = false;
553        }
554        
555        if(update) {
556            this.fromTime = fromTime;
557            fromTimeHasBeenModified = true;
558            clearHashAndString();
559        }
560    }
561    
562    public boolean getFromTimeHasBeenModified() {
563        return fromTimeHasBeenModified;
564    }
565    
566    public Long getThruTime() {
567        return thruTime;
568    }
569    
570    public void setThruTime(Long thruTime)
571            throws PersistenceNotNullException {
572        checkForNull(thruTime);
573        
574        boolean update = true;
575        
576        if(this.thruTime != null) {
577            if(this.thruTime.equals(thruTime)) {
578                update = false;
579            }
580        } else if(thruTime == null) {
581            update = false;
582        }
583        
584        if(update) {
585            this.thruTime = thruTime;
586            thruTimeHasBeenModified = true;
587            clearHashAndString();
588        }
589    }
590    
591    public boolean getThruTimeHasBeenModified() {
592        return thruTimeHasBeenModified;
593    }
594    
595}