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