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 * 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            StringBuilder stringValue = new StringBuilder("{");
168            
169            stringValue.append("entityId=").append(getEntityId());
170            
171            stringValue.append(", contactListPK=").append(getContactListPK());
172            stringValue.append(", contactListName=").append(getContactListName());
173            stringValue.append(", contactListGroupPK=").append(getContactListGroupPK());
174            stringValue.append(", contactListTypePK=").append(getContactListTypePK());
175            stringValue.append(", contactListFrequencyPK=").append(getContactListFrequencyPK());
176            stringValue.append(", defaultPartyContactListStatusPK=").append(getDefaultPartyContactListStatusPK());
177            stringValue.append(", isDefault=").append(getIsDefault());
178            stringValue.append(", sortOrder=").append(getSortOrder());
179            stringValue.append(", fromTime=").append(getFromTime());
180            stringValue.append(", thruTime=").append(getThruTime());
181            
182            stringValue.append('}');
183            
184            _stringValue = stringValue.toString();
185        }
186        return _stringValue;
187    }
188    
189    @Override
190    public boolean equals(Object other) {
191        if(this == other)
192            return true;
193        
194        if(!hasIdentity())
195            return false;
196        
197        if(other instanceof  ContactListDetailValue) {
198            ContactListDetailValue that = (ContactListDetailValue)other;
199            
200            if(!that.hasIdentity())
201                return false;
202            
203            Long thisEntityId = getEntityId();
204            Long thatEntityId = that.getEntityId();
205            
206            boolean objectsEqual = thisEntityId.equals(thatEntityId);
207            if(objectsEqual)
208                objectsEqual = objectsEqual && isIdentical(that);
209            
210            return objectsEqual;
211        } else {
212            return false;
213        }
214    }
215    
216    public boolean isIdentical(Object other) {
217        if(other instanceof ContactListDetailValue) {
218            ContactListDetailValue that = (ContactListDetailValue)other;
219            boolean objectsEqual = true;
220            
221            
222            if(objectsEqual) {
223                ContactListPK thisContactListPK = getContactListPK();
224                ContactListPK thatContactListPK = that.getContactListPK();
225                
226                if(thisContactListPK == null) {
227                    objectsEqual = objectsEqual && (thatContactListPK == null);
228                } else {
229                    objectsEqual = objectsEqual && thisContactListPK.equals(thatContactListPK);
230                }
231            }
232            
233            if(objectsEqual) {
234                String thisContactListName = getContactListName();
235                String thatContactListName = that.getContactListName();
236                
237                if(thisContactListName == null) {
238                    objectsEqual = objectsEqual && (thatContactListName == null);
239                } else {
240                    objectsEqual = objectsEqual && thisContactListName.equals(thatContactListName);
241                }
242            }
243            
244            if(objectsEqual) {
245                ContactListGroupPK thisContactListGroupPK = getContactListGroupPK();
246                ContactListGroupPK thatContactListGroupPK = that.getContactListGroupPK();
247                
248                if(thisContactListGroupPK == null) {
249                    objectsEqual = objectsEqual && (thatContactListGroupPK == null);
250                } else {
251                    objectsEqual = objectsEqual && thisContactListGroupPK.equals(thatContactListGroupPK);
252                }
253            }
254            
255            if(objectsEqual) {
256                ContactListTypePK thisContactListTypePK = getContactListTypePK();
257                ContactListTypePK thatContactListTypePK = that.getContactListTypePK();
258                
259                if(thisContactListTypePK == null) {
260                    objectsEqual = objectsEqual && (thatContactListTypePK == null);
261                } else {
262                    objectsEqual = objectsEqual && thisContactListTypePK.equals(thatContactListTypePK);
263                }
264            }
265            
266            if(objectsEqual) {
267                ContactListFrequencyPK thisContactListFrequencyPK = getContactListFrequencyPK();
268                ContactListFrequencyPK thatContactListFrequencyPK = that.getContactListFrequencyPK();
269                
270                if(thisContactListFrequencyPK == null) {
271                    objectsEqual = objectsEqual && (thatContactListFrequencyPK == null);
272                } else {
273                    objectsEqual = objectsEqual && thisContactListFrequencyPK.equals(thatContactListFrequencyPK);
274                }
275            }
276            
277            if(objectsEqual) {
278                WorkflowEntrancePK thisDefaultPartyContactListStatusPK = getDefaultPartyContactListStatusPK();
279                WorkflowEntrancePK thatDefaultPartyContactListStatusPK = that.getDefaultPartyContactListStatusPK();
280                
281                if(thisDefaultPartyContactListStatusPK == null) {
282                    objectsEqual = objectsEqual && (thatDefaultPartyContactListStatusPK == null);
283                } else {
284                    objectsEqual = objectsEqual && thisDefaultPartyContactListStatusPK.equals(thatDefaultPartyContactListStatusPK);
285                }
286            }
287            
288            if(objectsEqual) {
289                Boolean thisIsDefault = getIsDefault();
290                Boolean thatIsDefault = that.getIsDefault();
291                
292                if(thisIsDefault == null) {
293                    objectsEqual = objectsEqual && (thatIsDefault == null);
294                } else {
295                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
296                }
297            }
298            
299            if(objectsEqual) {
300                Integer thisSortOrder = getSortOrder();
301                Integer thatSortOrder = that.getSortOrder();
302                
303                if(thisSortOrder == null) {
304                    objectsEqual = objectsEqual && (thatSortOrder == null);
305                } else {
306                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
307                }
308            }
309            
310            if(objectsEqual) {
311                Long thisFromTime = getFromTime();
312                Long thatFromTime = that.getFromTime();
313                
314                if(thisFromTime == null) {
315                    objectsEqual = objectsEqual && (thatFromTime == null);
316                } else {
317                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
318                }
319            }
320            
321            if(objectsEqual) {
322                Long thisThruTime = getThruTime();
323                Long thatThruTime = that.getThruTime();
324                
325                if(thisThruTime == null) {
326                    objectsEqual = objectsEqual && (thatThruTime == null);
327                } else {
328                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
329                }
330            }
331            
332            return objectsEqual;
333        } else {
334            return false;
335        }
336    }
337    
338    @Override
339    public boolean hasBeenModified() {
340        return contactListPKHasBeenModified || contactListNameHasBeenModified || contactListGroupPKHasBeenModified || contactListTypePKHasBeenModified || contactListFrequencyPKHasBeenModified || defaultPartyContactListStatusPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
341    }
342    
343    @Override
344    public void clearHasBeenModified() {
345        contactListPKHasBeenModified = false;
346        contactListNameHasBeenModified = false;
347        contactListGroupPKHasBeenModified = false;
348        contactListTypePKHasBeenModified = false;
349        contactListFrequencyPKHasBeenModified = false;
350        defaultPartyContactListStatusPKHasBeenModified = false;
351        isDefaultHasBeenModified = false;
352        sortOrderHasBeenModified = false;
353        fromTimeHasBeenModified = false;
354        thruTimeHasBeenModified = false;
355    }
356    
357    public ContactListPK getContactListPK() {
358        return contactListPK;
359    }
360    
361    public void setContactListPK(ContactListPK contactListPK)
362            throws PersistenceNotNullException {
363        checkForNull(contactListPK);
364        
365        boolean update = true;
366        
367        if(this.contactListPK != null) {
368            if(this.contactListPK.equals(contactListPK)) {
369                update = false;
370            }
371        } else if(contactListPK == null) {
372            update = false;
373        }
374        
375        if(update) {
376            this.contactListPK = contactListPK;
377            contactListPKHasBeenModified = true;
378            clearHashAndString();
379        }
380    }
381    
382    public boolean getContactListPKHasBeenModified() {
383        return contactListPKHasBeenModified;
384    }
385    
386    public String getContactListName() {
387        return contactListName;
388    }
389    
390    public void setContactListName(String contactListName)
391            throws PersistenceNotNullException {
392        checkForNull(contactListName);
393        
394        boolean update = true;
395        
396        if(this.contactListName != null) {
397            if(this.contactListName.equals(contactListName)) {
398                update = false;
399            }
400        } else if(contactListName == null) {
401            update = false;
402        }
403        
404        if(update) {
405            this.contactListName = contactListName;
406            contactListNameHasBeenModified = true;
407            clearHashAndString();
408        }
409    }
410    
411    public boolean getContactListNameHasBeenModified() {
412        return contactListNameHasBeenModified;
413    }
414    
415    public ContactListGroupPK getContactListGroupPK() {
416        return contactListGroupPK;
417    }
418    
419    public void setContactListGroupPK(ContactListGroupPK contactListGroupPK)
420            throws PersistenceNotNullException {
421        checkForNull(contactListGroupPK);
422        
423        boolean update = true;
424        
425        if(this.contactListGroupPK != null) {
426            if(this.contactListGroupPK.equals(contactListGroupPK)) {
427                update = false;
428            }
429        } else if(contactListGroupPK == null) {
430            update = false;
431        }
432        
433        if(update) {
434            this.contactListGroupPK = contactListGroupPK;
435            contactListGroupPKHasBeenModified = true;
436            clearHashAndString();
437        }
438    }
439    
440    public boolean getContactListGroupPKHasBeenModified() {
441        return contactListGroupPKHasBeenModified;
442    }
443    
444    public ContactListTypePK getContactListTypePK() {
445        return contactListTypePK;
446    }
447    
448    public void setContactListTypePK(ContactListTypePK contactListTypePK)
449            throws PersistenceNotNullException {
450        checkForNull(contactListTypePK);
451        
452        boolean update = true;
453        
454        if(this.contactListTypePK != null) {
455            if(this.contactListTypePK.equals(contactListTypePK)) {
456                update = false;
457            }
458        } else if(contactListTypePK == null) {
459            update = false;
460        }
461        
462        if(update) {
463            this.contactListTypePK = contactListTypePK;
464            contactListTypePKHasBeenModified = true;
465            clearHashAndString();
466        }
467    }
468    
469    public boolean getContactListTypePKHasBeenModified() {
470        return contactListTypePKHasBeenModified;
471    }
472    
473    public ContactListFrequencyPK getContactListFrequencyPK() {
474        return contactListFrequencyPK;
475    }
476    
477    public void setContactListFrequencyPK(ContactListFrequencyPK contactListFrequencyPK) {
478        boolean update = true;
479        
480        if(this.contactListFrequencyPK != null) {
481            if(this.contactListFrequencyPK.equals(contactListFrequencyPK)) {
482                update = false;
483            }
484        } else if(contactListFrequencyPK == null) {
485            update = false;
486        }
487        
488        if(update) {
489            this.contactListFrequencyPK = contactListFrequencyPK;
490            contactListFrequencyPKHasBeenModified = true;
491            clearHashAndString();
492        }
493    }
494    
495    public boolean getContactListFrequencyPKHasBeenModified() {
496        return contactListFrequencyPKHasBeenModified;
497    }
498    
499    public WorkflowEntrancePK getDefaultPartyContactListStatusPK() {
500        return defaultPartyContactListStatusPK;
501    }
502    
503    public void setDefaultPartyContactListStatusPK(WorkflowEntrancePK defaultPartyContactListStatusPK)
504            throws PersistenceNotNullException {
505        checkForNull(defaultPartyContactListStatusPK);
506        
507        boolean update = true;
508        
509        if(this.defaultPartyContactListStatusPK != null) {
510            if(this.defaultPartyContactListStatusPK.equals(defaultPartyContactListStatusPK)) {
511                update = false;
512            }
513        } else if(defaultPartyContactListStatusPK == null) {
514            update = false;
515        }
516        
517        if(update) {
518            this.defaultPartyContactListStatusPK = defaultPartyContactListStatusPK;
519            defaultPartyContactListStatusPKHasBeenModified = true;
520            clearHashAndString();
521        }
522    }
523    
524    public boolean getDefaultPartyContactListStatusPKHasBeenModified() {
525        return defaultPartyContactListStatusPKHasBeenModified;
526    }
527    
528    public Boolean getIsDefault() {
529        return isDefault;
530    }
531    
532    public void setIsDefault(Boolean isDefault)
533            throws PersistenceNotNullException {
534        checkForNull(isDefault);
535        
536        boolean update = true;
537        
538        if(this.isDefault != null) {
539            if(this.isDefault.equals(isDefault)) {
540                update = false;
541            }
542        } else if(isDefault == null) {
543            update = false;
544        }
545        
546        if(update) {
547            this.isDefault = isDefault;
548            isDefaultHasBeenModified = true;
549            clearHashAndString();
550        }
551    }
552    
553    public boolean getIsDefaultHasBeenModified() {
554        return isDefaultHasBeenModified;
555    }
556    
557    public Integer getSortOrder() {
558        return sortOrder;
559    }
560    
561    public void setSortOrder(Integer sortOrder)
562            throws PersistenceNotNullException {
563        checkForNull(sortOrder);
564        
565        boolean update = true;
566        
567        if(this.sortOrder != null) {
568            if(this.sortOrder.equals(sortOrder)) {
569                update = false;
570            }
571        } else if(sortOrder == null) {
572            update = false;
573        }
574        
575        if(update) {
576            this.sortOrder = sortOrder;
577            sortOrderHasBeenModified = true;
578            clearHashAndString();
579        }
580    }
581    
582    public boolean getSortOrderHasBeenModified() {
583        return sortOrderHasBeenModified;
584    }
585    
586    public Long getFromTime() {
587        return fromTime;
588    }
589    
590    public void setFromTime(Long fromTime)
591            throws PersistenceNotNullException {
592        checkForNull(fromTime);
593        
594        boolean update = true;
595        
596        if(this.fromTime != null) {
597            if(this.fromTime.equals(fromTime)) {
598                update = false;
599            }
600        } else if(fromTime == null) {
601            update = false;
602        }
603        
604        if(update) {
605            this.fromTime = fromTime;
606            fromTimeHasBeenModified = true;
607            clearHashAndString();
608        }
609    }
610    
611    public boolean getFromTimeHasBeenModified() {
612        return fromTimeHasBeenModified;
613    }
614    
615    public Long getThruTime() {
616        return thruTime;
617    }
618    
619    public void setThruTime(Long thruTime)
620            throws PersistenceNotNullException {
621        checkForNull(thruTime);
622        
623        boolean update = true;
624        
625        if(this.thruTime != null) {
626            if(this.thruTime.equals(thruTime)) {
627                update = false;
628            }
629        } else if(thruTime == null) {
630            update = false;
631        }
632        
633        if(update) {
634            this.thruTime = thruTime;
635            thruTimeHasBeenModified = true;
636            clearHashAndString();
637        }
638    }
639    
640    public boolean getThruTimeHasBeenModified() {
641        return thruTimeHasBeenModified;
642    }
643    
644}