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