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 * CampaignTermDetailValue.java
021 */
022
023package com.echothree.model.data.campaign.server.value;
024
025import com.echothree.model.data.campaign.common.pk.CampaignTermDetailPK;
026
027import com.echothree.model.data.campaign.server.factory.CampaignTermDetailFactory;
028
029import com.echothree.model.data.campaign.common.pk.CampaignTermPK;
030
031import com.echothree.util.common.exception.PersistenceCloneException;
032import com.echothree.util.common.exception.PersistenceNotNullException;
033
034import com.echothree.util.server.persistence.BaseValue;
035
036import java.io.Serializable;
037
038public class CampaignTermDetailValue
039        extends BaseValue<CampaignTermDetailPK>
040        implements Cloneable, Serializable {
041    
042    private CampaignTermPK campaignTermPK;
043    private boolean campaignTermPKHasBeenModified = false;
044    private String campaignTermName;
045    private boolean campaignTermNameHasBeenModified = false;
046    private String valueSha1Hash;
047    private boolean valueSha1HashHasBeenModified = false;
048    private String value;
049    private boolean valueHasBeenModified = false;
050    private Boolean isDefault;
051    private boolean isDefaultHasBeenModified = false;
052    private Integer sortOrder;
053    private boolean sortOrderHasBeenModified = false;
054    private Long fromTime;
055    private boolean fromTimeHasBeenModified = false;
056    private Long thruTime;
057    private boolean thruTimeHasBeenModified = false;
058    
059    private transient Integer _hashCode = null;
060    private transient String _stringValue = null;
061    
062    private void constructFields(CampaignTermPK campaignTermPK, String campaignTermName, String valueSha1Hash, String value, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
063            throws PersistenceNotNullException {
064        checkForNull(campaignTermPK);
065        this.campaignTermPK = campaignTermPK;
066        checkForNull(campaignTermName);
067        this.campaignTermName = campaignTermName;
068        checkForNull(valueSha1Hash);
069        this.valueSha1Hash = valueSha1Hash;
070        checkForNull(value);
071        this.value = value;
072        checkForNull(isDefault);
073        this.isDefault = isDefault;
074        checkForNull(sortOrder);
075        this.sortOrder = sortOrder;
076        checkForNull(fromTime);
077        this.fromTime = fromTime;
078        checkForNull(thruTime);
079        this.thruTime = thruTime;
080    }
081    
082    /** Creates a new instance of CampaignTermDetailValue */
083    public CampaignTermDetailValue(CampaignTermDetailPK campaignTermDetailPK, CampaignTermPK campaignTermPK, String campaignTermName, String valueSha1Hash, String value, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
084            throws PersistenceNotNullException {
085        super(campaignTermDetailPK);
086        constructFields(campaignTermPK, campaignTermName, valueSha1Hash, value, isDefault, sortOrder, fromTime, thruTime);
087    }
088    
089    /** Creates a new instance of CampaignTermDetailValue */
090    public CampaignTermDetailValue(CampaignTermPK campaignTermPK, String campaignTermName, String valueSha1Hash, String value, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
091            throws PersistenceNotNullException {
092        super();
093        constructFields(campaignTermPK, campaignTermName, valueSha1Hash, value, isDefault, sortOrder, fromTime, thruTime);
094    }
095    
096   @Override
097   public CampaignTermDetailFactory getBaseFactoryInstance() {
098        return CampaignTermDetailFactory.getInstance();
099    }
100    
101    @Override
102    public CampaignTermDetailValue 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 (CampaignTermDetailValue)result;
113    }
114    
115   @Override
116    public CampaignTermDetailPK getPrimaryKey() {
117        if(_primaryKey == null) {
118            _primaryKey = new CampaignTermDetailPK(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 + ((campaignTermPK != null) ? campaignTermPK.hashCode() : 0);
137            hashCode = 37 * hashCode + ((campaignTermName != null) ? campaignTermName.hashCode() : 0);
138            hashCode = 37 * hashCode + ((valueSha1Hash != null) ? valueSha1Hash.hashCode() : 0);
139            hashCode = 37 * hashCode + ((value != null) ? value.hashCode() : 0);
140            hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0);
141            hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.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                    ", campaignTermPK=" + getCampaignTermPK() +
157                    ", campaignTermName=" + getCampaignTermName() +
158                    ", valueSha1Hash=" + getValueSha1Hash() +
159                    ", value=" + getValue() +
160                    ", isDefault=" + getIsDefault() +
161                    ", sortOrder=" + getSortOrder() +
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  CampaignTermDetailValue 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 CampaignTermDetailValue that) {
196            boolean objectsEqual = true;
197            
198            
199            if(objectsEqual) {
200                CampaignTermPK thisCampaignTermPK = getCampaignTermPK();
201                CampaignTermPK thatCampaignTermPK = that.getCampaignTermPK();
202                
203                if(thisCampaignTermPK == null) {
204                    objectsEqual = objectsEqual && (thatCampaignTermPK == null);
205                } else {
206                    objectsEqual = objectsEqual && thisCampaignTermPK.equals(thatCampaignTermPK);
207                }
208            }
209            
210            if(objectsEqual) {
211                String thisCampaignTermName = getCampaignTermName();
212                String thatCampaignTermName = that.getCampaignTermName();
213                
214                if(thisCampaignTermName == null) {
215                    objectsEqual = objectsEqual && (thatCampaignTermName == null);
216                } else {
217                    objectsEqual = objectsEqual && thisCampaignTermName.equals(thatCampaignTermName);
218                }
219            }
220            
221            if(objectsEqual) {
222                String thisValueSha1Hash = getValueSha1Hash();
223                String thatValueSha1Hash = that.getValueSha1Hash();
224                
225                if(thisValueSha1Hash == null) {
226                    objectsEqual = objectsEqual && (thatValueSha1Hash == null);
227                } else {
228                    objectsEqual = objectsEqual && thisValueSha1Hash.equals(thatValueSha1Hash);
229                }
230            }
231            
232            if(objectsEqual) {
233                String thisValue = getValue();
234                String thatValue = that.getValue();
235                
236                if(thisValue == null) {
237                    objectsEqual = objectsEqual && (thatValue == null);
238                } else {
239                    objectsEqual = objectsEqual && thisValue.equals(thatValue);
240                }
241            }
242            
243            if(objectsEqual) {
244                Boolean thisIsDefault = getIsDefault();
245                Boolean thatIsDefault = that.getIsDefault();
246                
247                if(thisIsDefault == null) {
248                    objectsEqual = objectsEqual && (thatIsDefault == null);
249                } else {
250                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
251                }
252            }
253            
254            if(objectsEqual) {
255                Integer thisSortOrder = getSortOrder();
256                Integer thatSortOrder = that.getSortOrder();
257                
258                if(thisSortOrder == null) {
259                    objectsEqual = objectsEqual && (thatSortOrder == null);
260                } else {
261                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
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 campaignTermPKHasBeenModified || campaignTermNameHasBeenModified || valueSha1HashHasBeenModified || valueHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
296    }
297    
298    @Override
299    public void clearHasBeenModified() {
300        campaignTermPKHasBeenModified = false;
301        campaignTermNameHasBeenModified = false;
302        valueSha1HashHasBeenModified = false;
303        valueHasBeenModified = false;
304        isDefaultHasBeenModified = false;
305        sortOrderHasBeenModified = false;
306        fromTimeHasBeenModified = false;
307        thruTimeHasBeenModified = false;
308    }
309    
310    public CampaignTermPK getCampaignTermPK() {
311        return campaignTermPK;
312    }
313    
314    public void setCampaignTermPK(CampaignTermPK campaignTermPK)
315            throws PersistenceNotNullException {
316        checkForNull(campaignTermPK);
317        
318        boolean update = true;
319        
320        if(this.campaignTermPK != null) {
321            if(this.campaignTermPK.equals(campaignTermPK)) {
322                update = false;
323            }
324        } else if(campaignTermPK == null) {
325            update = false;
326        }
327        
328        if(update) {
329            this.campaignTermPK = campaignTermPK;
330            campaignTermPKHasBeenModified = true;
331            clearHashAndString();
332        }
333    }
334    
335    public boolean getCampaignTermPKHasBeenModified() {
336        return campaignTermPKHasBeenModified;
337    }
338    
339    public String getCampaignTermName() {
340        return campaignTermName;
341    }
342    
343    public void setCampaignTermName(String campaignTermName)
344            throws PersistenceNotNullException {
345        checkForNull(campaignTermName);
346        
347        boolean update = true;
348        
349        if(this.campaignTermName != null) {
350            if(this.campaignTermName.equals(campaignTermName)) {
351                update = false;
352            }
353        } else if(campaignTermName == null) {
354            update = false;
355        }
356        
357        if(update) {
358            this.campaignTermName = campaignTermName;
359            campaignTermNameHasBeenModified = true;
360            clearHashAndString();
361        }
362    }
363    
364    public boolean getCampaignTermNameHasBeenModified() {
365        return campaignTermNameHasBeenModified;
366    }
367    
368    public String getValueSha1Hash() {
369        return valueSha1Hash;
370    }
371    
372    public void setValueSha1Hash(String valueSha1Hash)
373            throws PersistenceNotNullException {
374        checkForNull(valueSha1Hash);
375        
376        boolean update = true;
377        
378        if(this.valueSha1Hash != null) {
379            if(this.valueSha1Hash.equals(valueSha1Hash)) {
380                update = false;
381            }
382        } else if(valueSha1Hash == null) {
383            update = false;
384        }
385        
386        if(update) {
387            this.valueSha1Hash = valueSha1Hash;
388            valueSha1HashHasBeenModified = true;
389            clearHashAndString();
390        }
391    }
392    
393    public boolean getValueSha1HashHasBeenModified() {
394        return valueSha1HashHasBeenModified;
395    }
396    
397    public String getValue() {
398        return value;
399    }
400    
401    public void setValue(String value)
402            throws PersistenceNotNullException {
403        checkForNull(value);
404        
405        boolean update = true;
406        
407        if(this.value != null) {
408            if(this.value.equals(value)) {
409                update = false;
410            }
411        } else if(value == null) {
412            update = false;
413        }
414        
415        if(update) {
416            this.value = value;
417            valueHasBeenModified = true;
418            clearHashAndString();
419        }
420    }
421    
422    public boolean getValueHasBeenModified() {
423        return valueHasBeenModified;
424    }
425    
426    public Boolean getIsDefault() {
427        return isDefault;
428    }
429    
430    public void setIsDefault(Boolean isDefault)
431            throws PersistenceNotNullException {
432        checkForNull(isDefault);
433        
434        boolean update = true;
435        
436        if(this.isDefault != null) {
437            if(this.isDefault.equals(isDefault)) {
438                update = false;
439            }
440        } else if(isDefault == null) {
441            update = false;
442        }
443        
444        if(update) {
445            this.isDefault = isDefault;
446            isDefaultHasBeenModified = true;
447            clearHashAndString();
448        }
449    }
450    
451    public boolean getIsDefaultHasBeenModified() {
452        return isDefaultHasBeenModified;
453    }
454    
455    public Integer getSortOrder() {
456        return sortOrder;
457    }
458    
459    public void setSortOrder(Integer sortOrder)
460            throws PersistenceNotNullException {
461        checkForNull(sortOrder);
462        
463        boolean update = true;
464        
465        if(this.sortOrder != null) {
466            if(this.sortOrder.equals(sortOrder)) {
467                update = false;
468            }
469        } else if(sortOrder == null) {
470            update = false;
471        }
472        
473        if(update) {
474            this.sortOrder = sortOrder;
475            sortOrderHasBeenModified = true;
476            clearHashAndString();
477        }
478    }
479    
480    public boolean getSortOrderHasBeenModified() {
481        return sortOrderHasBeenModified;
482    }
483    
484    public Long getFromTime() {
485        return fromTime;
486    }
487    
488    public void setFromTime(Long fromTime)
489            throws PersistenceNotNullException {
490        checkForNull(fromTime);
491        
492        boolean update = true;
493        
494        if(this.fromTime != null) {
495            if(this.fromTime.equals(fromTime)) {
496                update = false;
497            }
498        } else if(fromTime == null) {
499            update = false;
500        }
501        
502        if(update) {
503            this.fromTime = fromTime;
504            fromTimeHasBeenModified = true;
505            clearHashAndString();
506        }
507    }
508    
509    public boolean getFromTimeHasBeenModified() {
510        return fromTimeHasBeenModified;
511    }
512    
513    public Long getThruTime() {
514        return thruTime;
515    }
516    
517    public void setThruTime(Long thruTime)
518            throws PersistenceNotNullException {
519        checkForNull(thruTime);
520        
521        boolean update = true;
522        
523        if(this.thruTime != null) {
524            if(this.thruTime.equals(thruTime)) {
525                update = false;
526            }
527        } else if(thruTime == null) {
528            update = false;
529        }
530        
531        if(update) {
532            this.thruTime = thruTime;
533            thruTimeHasBeenModified = true;
534            clearHashAndString();
535        }
536    }
537    
538    public boolean getThruTimeHasBeenModified() {
539        return thruTimeHasBeenModified;
540    }
541    
542}