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