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