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 * ContactListDetailValue.java
021 */
022
023package com.echothree.model.data.contactlist.server.value;
024
025import com.echothree.model.data.contactlist.common.pk.ContactListDetailPK;
026
027import com.echothree.model.data.contactlist.server.factory.ContactListDetailFactory;
028
029import com.echothree.model.data.contactlist.common.pk.ContactListPK;
030import com.echothree.model.data.contactlist.common.pk.ContactListGroupPK;
031import com.echothree.model.data.contactlist.common.pk.ContactListTypePK;
032import com.echothree.model.data.contactlist.common.pk.ContactListFrequencyPK;
033import com.echothree.model.data.workflow.common.pk.WorkflowEntrancePK;
034
035import com.echothree.util.common.exception.PersistenceCloneException;
036import com.echothree.util.common.exception.PersistenceNotNullException;
037
038import com.echothree.util.server.persistence.BaseValue;
039
040import java.io.Serializable;
041
042public class ContactListDetailValue
043        extends BaseValue<ContactListDetailPK>
044        implements Cloneable, Serializable {
045    
046    private ContactListPK contactListPK;
047    private boolean contactListPKHasBeenModified = false;
048    private String contactListName;
049    private boolean contactListNameHasBeenModified = false;
050    private ContactListGroupPK contactListGroupPK;
051    private boolean contactListGroupPKHasBeenModified = false;
052    private ContactListTypePK contactListTypePK;
053    private boolean contactListTypePKHasBeenModified = false;
054    private ContactListFrequencyPK contactListFrequencyPK;
055    private boolean contactListFrequencyPKHasBeenModified = false;
056    private WorkflowEntrancePK defaultPartyContactListStatusPK;
057    private boolean defaultPartyContactListStatusPKHasBeenModified = false;
058    private Boolean isDefault;
059    private boolean isDefaultHasBeenModified = false;
060    private Integer sortOrder;
061    private boolean sortOrderHasBeenModified = false;
062    private Long fromTime;
063    private boolean fromTimeHasBeenModified = false;
064    private Long thruTime;
065    private boolean thruTimeHasBeenModified = false;
066    
067    private transient Integer _hashCode = null;
068    private transient String _stringValue = null;
069    
070    private void constructFields(ContactListPK contactListPK, String contactListName, ContactListGroupPK contactListGroupPK, ContactListTypePK contactListTypePK, ContactListFrequencyPK contactListFrequencyPK, WorkflowEntrancePK defaultPartyContactListStatusPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
071            throws PersistenceNotNullException {
072        checkForNull(contactListPK);
073        this.contactListPK = contactListPK;
074        checkForNull(contactListName);
075        this.contactListName = contactListName;
076        checkForNull(contactListGroupPK);
077        this.contactListGroupPK = contactListGroupPK;
078        checkForNull(contactListTypePK);
079        this.contactListTypePK = contactListTypePK;
080        this.contactListFrequencyPK = contactListFrequencyPK;
081        checkForNull(defaultPartyContactListStatusPK);
082        this.defaultPartyContactListStatusPK = defaultPartyContactListStatusPK;
083        checkForNull(isDefault);
084        this.isDefault = isDefault;
085        checkForNull(sortOrder);
086        this.sortOrder = sortOrder;
087        checkForNull(fromTime);
088        this.fromTime = fromTime;
089        checkForNull(thruTime);
090        this.thruTime = thruTime;
091    }
092    
093    /** Creates a new instance of ContactListDetailValue */
094    public ContactListDetailValue(ContactListDetailPK contactListDetailPK, ContactListPK contactListPK, String contactListName, ContactListGroupPK contactListGroupPK, ContactListTypePK contactListTypePK, ContactListFrequencyPK contactListFrequencyPK, WorkflowEntrancePK defaultPartyContactListStatusPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
095            throws PersistenceNotNullException {
096        super(contactListDetailPK);
097        constructFields(contactListPK, contactListName, contactListGroupPK, contactListTypePK, contactListFrequencyPK, defaultPartyContactListStatusPK, isDefault, sortOrder, fromTime, thruTime);
098    }
099    
100    /** Creates a new instance of ContactListDetailValue */
101    public ContactListDetailValue(ContactListPK contactListPK, String contactListName, ContactListGroupPK contactListGroupPK, ContactListTypePK contactListTypePK, ContactListFrequencyPK contactListFrequencyPK, WorkflowEntrancePK defaultPartyContactListStatusPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
102            throws PersistenceNotNullException {
103        super();
104        constructFields(contactListPK, contactListName, contactListGroupPK, contactListTypePK, contactListFrequencyPK, defaultPartyContactListStatusPK, isDefault, sortOrder, fromTime, thruTime);
105    }
106    
107   @Override
108   public ContactListDetailFactory getBaseFactoryInstance() {
109        return ContactListDetailFactory.getInstance();
110    }
111    
112    @Override
113    public ContactListDetailValue clone() {
114        Object result;
115        
116        try {
117            result = super.clone();
118        } catch (CloneNotSupportedException cnse) {
119            // This shouldn't happen, fail when it does.
120            throw new PersistenceCloneException(cnse);
121        }
122        
123        return (ContactListDetailValue)result;
124    }
125    
126   @Override
127    public ContactListDetailPK getPrimaryKey() {
128        if(_primaryKey == null) {
129            _primaryKey = new ContactListDetailPK(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 + ((contactListPK != null) ? contactListPK.hashCode() : 0);
148            hashCode = 37 * hashCode + ((contactListName != null) ? contactListName.hashCode() : 0);
149            hashCode = 37 * hashCode + ((contactListGroupPK != null) ? contactListGroupPK.hashCode() : 0);
150            hashCode = 37 * hashCode + ((contactListTypePK != null) ? contactListTypePK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((contactListFrequencyPK != null) ? contactListFrequencyPK.hashCode() : 0);
152            hashCode = 37 * hashCode + ((defaultPartyContactListStatusPK != null) ? defaultPartyContactListStatusPK.hashCode() : 0);
153            hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0);
154            hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0);
155            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
156            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
157            
158            _hashCode = hashCode;
159        }
160        
161        return _hashCode;
162    }
163    
164    @Override
165    public String toString() {
166        if(_stringValue == null) {
167            _stringValue = "{" + 
168                    "entityId=" + getEntityId() +
169                    ", contactListPK=" + getContactListPK() +
170                    ", contactListName=" + getContactListName() +
171                    ", contactListGroupPK=" + getContactListGroupPK() +
172                    ", contactListTypePK=" + getContactListTypePK() +
173                    ", contactListFrequencyPK=" + getContactListFrequencyPK() +
174                    ", defaultPartyContactListStatusPK=" + getDefaultPartyContactListStatusPK() +
175                    ", isDefault=" + getIsDefault() +
176                    ", sortOrder=" + getSortOrder() +
177                    ", fromTime=" + getFromTime() +
178                    ", thruTime=" + getThruTime() +
179                    "}";
180        }
181        return _stringValue;
182    }
183    
184    @Override
185    public boolean equals(Object other) {
186        if(this == other)
187            return true;
188        
189        if(!hasIdentity())
190            return false;
191        
192        if(other instanceof  ContactListDetailValue that) {
193            if(!that.hasIdentity())
194                return false;
195            
196            Long thisEntityId = getEntityId();
197            Long thatEntityId = that.getEntityId();
198            
199            boolean objectsEqual = thisEntityId.equals(thatEntityId);
200            if(objectsEqual)
201                objectsEqual = isIdentical(that);
202            
203            return objectsEqual;
204        } else {
205            return false;
206        }
207    }
208    
209    public boolean isIdentical(Object other) {
210        if(other instanceof ContactListDetailValue that) {
211            boolean objectsEqual = true;
212            
213            
214            if(objectsEqual) {
215                ContactListPK thisContactListPK = getContactListPK();
216                ContactListPK thatContactListPK = that.getContactListPK();
217                
218                if(thisContactListPK == null) {
219                    objectsEqual = objectsEqual && (thatContactListPK == null);
220                } else {
221                    objectsEqual = objectsEqual && thisContactListPK.equals(thatContactListPK);
222                }
223            }
224            
225            if(objectsEqual) {
226                String thisContactListName = getContactListName();
227                String thatContactListName = that.getContactListName();
228                
229                if(thisContactListName == null) {
230                    objectsEqual = objectsEqual && (thatContactListName == null);
231                } else {
232                    objectsEqual = objectsEqual && thisContactListName.equals(thatContactListName);
233                }
234            }
235            
236            if(objectsEqual) {
237                ContactListGroupPK thisContactListGroupPK = getContactListGroupPK();
238                ContactListGroupPK thatContactListGroupPK = that.getContactListGroupPK();
239                
240                if(thisContactListGroupPK == null) {
241                    objectsEqual = objectsEqual && (thatContactListGroupPK == null);
242                } else {
243                    objectsEqual = objectsEqual && thisContactListGroupPK.equals(thatContactListGroupPK);
244                }
245            }
246            
247            if(objectsEqual) {
248                ContactListTypePK thisContactListTypePK = getContactListTypePK();
249                ContactListTypePK thatContactListTypePK = that.getContactListTypePK();
250                
251                if(thisContactListTypePK == null) {
252                    objectsEqual = objectsEqual && (thatContactListTypePK == null);
253                } else {
254                    objectsEqual = objectsEqual && thisContactListTypePK.equals(thatContactListTypePK);
255                }
256            }
257            
258            if(objectsEqual) {
259                ContactListFrequencyPK thisContactListFrequencyPK = getContactListFrequencyPK();
260                ContactListFrequencyPK thatContactListFrequencyPK = that.getContactListFrequencyPK();
261                
262                if(thisContactListFrequencyPK == null) {
263                    objectsEqual = objectsEqual && (thatContactListFrequencyPK == null);
264                } else {
265                    objectsEqual = objectsEqual && thisContactListFrequencyPK.equals(thatContactListFrequencyPK);
266                }
267            }
268            
269            if(objectsEqual) {
270                WorkflowEntrancePK thisDefaultPartyContactListStatusPK = getDefaultPartyContactListStatusPK();
271                WorkflowEntrancePK thatDefaultPartyContactListStatusPK = that.getDefaultPartyContactListStatusPK();
272                
273                if(thisDefaultPartyContactListStatusPK == null) {
274                    objectsEqual = objectsEqual && (thatDefaultPartyContactListStatusPK == null);
275                } else {
276                    objectsEqual = objectsEqual && thisDefaultPartyContactListStatusPK.equals(thatDefaultPartyContactListStatusPK);
277                }
278            }
279            
280            if(objectsEqual) {
281                Boolean thisIsDefault = getIsDefault();
282                Boolean thatIsDefault = that.getIsDefault();
283                
284                if(thisIsDefault == null) {
285                    objectsEqual = objectsEqual && (thatIsDefault == null);
286                } else {
287                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
288                }
289            }
290            
291            if(objectsEqual) {
292                Integer thisSortOrder = getSortOrder();
293                Integer thatSortOrder = that.getSortOrder();
294                
295                if(thisSortOrder == null) {
296                    objectsEqual = objectsEqual && (thatSortOrder == null);
297                } else {
298                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
299                }
300            }
301            
302            if(objectsEqual) {
303                Long thisFromTime = getFromTime();
304                Long thatFromTime = that.getFromTime();
305                
306                if(thisFromTime == null) {
307                    objectsEqual = objectsEqual && (thatFromTime == null);
308                } else {
309                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
310                }
311            }
312            
313            if(objectsEqual) {
314                Long thisThruTime = getThruTime();
315                Long thatThruTime = that.getThruTime();
316                
317                if(thisThruTime == null) {
318                    objectsEqual = objectsEqual && (thatThruTime == null);
319                } else {
320                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
321                }
322            }
323            
324            return objectsEqual;
325        } else {
326            return false;
327        }
328    }
329    
330    @Override
331    public boolean hasBeenModified() {
332        return contactListPKHasBeenModified || contactListNameHasBeenModified || contactListGroupPKHasBeenModified || contactListTypePKHasBeenModified || contactListFrequencyPKHasBeenModified || defaultPartyContactListStatusPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
333    }
334    
335    @Override
336    public void clearHasBeenModified() {
337        contactListPKHasBeenModified = false;
338        contactListNameHasBeenModified = false;
339        contactListGroupPKHasBeenModified = false;
340        contactListTypePKHasBeenModified = false;
341        contactListFrequencyPKHasBeenModified = false;
342        defaultPartyContactListStatusPKHasBeenModified = false;
343        isDefaultHasBeenModified = false;
344        sortOrderHasBeenModified = false;
345        fromTimeHasBeenModified = false;
346        thruTimeHasBeenModified = false;
347    }
348    
349    public ContactListPK getContactListPK() {
350        return contactListPK;
351    }
352    
353    public void setContactListPK(ContactListPK contactListPK)
354            throws PersistenceNotNullException {
355        checkForNull(contactListPK);
356        
357        boolean update = true;
358        
359        if(this.contactListPK != null) {
360            if(this.contactListPK.equals(contactListPK)) {
361                update = false;
362            }
363        } else if(contactListPK == null) {
364            update = false;
365        }
366        
367        if(update) {
368            this.contactListPK = contactListPK;
369            contactListPKHasBeenModified = true;
370            clearHashAndString();
371        }
372    }
373    
374    public boolean getContactListPKHasBeenModified() {
375        return contactListPKHasBeenModified;
376    }
377    
378    public String getContactListName() {
379        return contactListName;
380    }
381    
382    public void setContactListName(String contactListName)
383            throws PersistenceNotNullException {
384        checkForNull(contactListName);
385        
386        boolean update = true;
387        
388        if(this.contactListName != null) {
389            if(this.contactListName.equals(contactListName)) {
390                update = false;
391            }
392        } else if(contactListName == null) {
393            update = false;
394        }
395        
396        if(update) {
397            this.contactListName = contactListName;
398            contactListNameHasBeenModified = true;
399            clearHashAndString();
400        }
401    }
402    
403    public boolean getContactListNameHasBeenModified() {
404        return contactListNameHasBeenModified;
405    }
406    
407    public ContactListGroupPK getContactListGroupPK() {
408        return contactListGroupPK;
409    }
410    
411    public void setContactListGroupPK(ContactListGroupPK contactListGroupPK)
412            throws PersistenceNotNullException {
413        checkForNull(contactListGroupPK);
414        
415        boolean update = true;
416        
417        if(this.contactListGroupPK != null) {
418            if(this.contactListGroupPK.equals(contactListGroupPK)) {
419                update = false;
420            }
421        } else if(contactListGroupPK == null) {
422            update = false;
423        }
424        
425        if(update) {
426            this.contactListGroupPK = contactListGroupPK;
427            contactListGroupPKHasBeenModified = true;
428            clearHashAndString();
429        }
430    }
431    
432    public boolean getContactListGroupPKHasBeenModified() {
433        return contactListGroupPKHasBeenModified;
434    }
435    
436    public ContactListTypePK getContactListTypePK() {
437        return contactListTypePK;
438    }
439    
440    public void setContactListTypePK(ContactListTypePK contactListTypePK)
441            throws PersistenceNotNullException {
442        checkForNull(contactListTypePK);
443        
444        boolean update = true;
445        
446        if(this.contactListTypePK != null) {
447            if(this.contactListTypePK.equals(contactListTypePK)) {
448                update = false;
449            }
450        } else if(contactListTypePK == null) {
451            update = false;
452        }
453        
454        if(update) {
455            this.contactListTypePK = contactListTypePK;
456            contactListTypePKHasBeenModified = true;
457            clearHashAndString();
458        }
459    }
460    
461    public boolean getContactListTypePKHasBeenModified() {
462        return contactListTypePKHasBeenModified;
463    }
464    
465    public ContactListFrequencyPK getContactListFrequencyPK() {
466        return contactListFrequencyPK;
467    }
468    
469    public void setContactListFrequencyPK(ContactListFrequencyPK contactListFrequencyPK) {
470        boolean update = true;
471        
472        if(this.contactListFrequencyPK != null) {
473            if(this.contactListFrequencyPK.equals(contactListFrequencyPK)) {
474                update = false;
475            }
476        } else if(contactListFrequencyPK == null) {
477            update = false;
478        }
479        
480        if(update) {
481            this.contactListFrequencyPK = contactListFrequencyPK;
482            contactListFrequencyPKHasBeenModified = true;
483            clearHashAndString();
484        }
485    }
486    
487    public boolean getContactListFrequencyPKHasBeenModified() {
488        return contactListFrequencyPKHasBeenModified;
489    }
490    
491    public WorkflowEntrancePK getDefaultPartyContactListStatusPK() {
492        return defaultPartyContactListStatusPK;
493    }
494    
495    public void setDefaultPartyContactListStatusPK(WorkflowEntrancePK defaultPartyContactListStatusPK)
496            throws PersistenceNotNullException {
497        checkForNull(defaultPartyContactListStatusPK);
498        
499        boolean update = true;
500        
501        if(this.defaultPartyContactListStatusPK != null) {
502            if(this.defaultPartyContactListStatusPK.equals(defaultPartyContactListStatusPK)) {
503                update = false;
504            }
505        } else if(defaultPartyContactListStatusPK == null) {
506            update = false;
507        }
508        
509        if(update) {
510            this.defaultPartyContactListStatusPK = defaultPartyContactListStatusPK;
511            defaultPartyContactListStatusPKHasBeenModified = true;
512            clearHashAndString();
513        }
514    }
515    
516    public boolean getDefaultPartyContactListStatusPKHasBeenModified() {
517        return defaultPartyContactListStatusPKHasBeenModified;
518    }
519    
520    public Boolean getIsDefault() {
521        return isDefault;
522    }
523    
524    public void setIsDefault(Boolean isDefault)
525            throws PersistenceNotNullException {
526        checkForNull(isDefault);
527        
528        boolean update = true;
529        
530        if(this.isDefault != null) {
531            if(this.isDefault.equals(isDefault)) {
532                update = false;
533            }
534        } else if(isDefault == null) {
535            update = false;
536        }
537        
538        if(update) {
539            this.isDefault = isDefault;
540            isDefaultHasBeenModified = true;
541            clearHashAndString();
542        }
543    }
544    
545    public boolean getIsDefaultHasBeenModified() {
546        return isDefaultHasBeenModified;
547    }
548    
549    public Integer getSortOrder() {
550        return sortOrder;
551    }
552    
553    public void setSortOrder(Integer sortOrder)
554            throws PersistenceNotNullException {
555        checkForNull(sortOrder);
556        
557        boolean update = true;
558        
559        if(this.sortOrder != null) {
560            if(this.sortOrder.equals(sortOrder)) {
561                update = false;
562            }
563        } else if(sortOrder == null) {
564            update = false;
565        }
566        
567        if(update) {
568            this.sortOrder = sortOrder;
569            sortOrderHasBeenModified = true;
570            clearHashAndString();
571        }
572    }
573    
574    public boolean getSortOrderHasBeenModified() {
575        return sortOrderHasBeenModified;
576    }
577    
578    public Long getFromTime() {
579        return fromTime;
580    }
581    
582    public void setFromTime(Long fromTime)
583            throws PersistenceNotNullException {
584        checkForNull(fromTime);
585        
586        boolean update = true;
587        
588        if(this.fromTime != null) {
589            if(this.fromTime.equals(fromTime)) {
590                update = false;
591            }
592        } else if(fromTime == null) {
593            update = false;
594        }
595        
596        if(update) {
597            this.fromTime = fromTime;
598            fromTimeHasBeenModified = true;
599            clearHashAndString();
600        }
601    }
602    
603    public boolean getFromTimeHasBeenModified() {
604        return fromTimeHasBeenModified;
605    }
606    
607    public Long getThruTime() {
608        return thruTime;
609    }
610    
611    public void setThruTime(Long thruTime)
612            throws PersistenceNotNullException {
613        checkForNull(thruTime);
614        
615        boolean update = true;
616        
617        if(this.thruTime != null) {
618            if(this.thruTime.equals(thruTime)) {
619                update = false;
620            }
621        } else if(thruTime == null) {
622            update = false;
623        }
624        
625        if(update) {
626            this.thruTime = thruTime;
627            thruTimeHasBeenModified = true;
628            clearHashAndString();
629        }
630    }
631    
632    public boolean getThruTimeHasBeenModified() {
633        return thruTimeHasBeenModified;
634    }
635    
636}