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 * ContentPageAreaDetailValue.java
021 */
022
023package com.echothree.model.data.content.server.value;
024
025import com.echothree.model.data.content.common.pk.ContentPageAreaDetailPK;
026
027import com.echothree.model.data.content.server.factory.ContentPageAreaDetailFactory;
028
029import com.echothree.model.data.content.common.pk.ContentPageAreaPK;
030import com.echothree.model.data.content.common.pk.ContentPagePK;
031import com.echothree.model.data.content.common.pk.ContentPageLayoutAreaPK;
032import com.echothree.model.data.party.common.pk.LanguagePK;
033import com.echothree.model.data.core.common.pk.MimeTypePK;
034
035import com.echothree.util.common.exception.PersistenceCloneException;
036import com.echothree.util.common.exception.PersistenceNotNullException;
037
038import com.echothree.util.server.persistence.BaseValue;
039
040import java.io.Serializable;
041
042import javax.annotation.Nonnull;
043import javax.annotation.Nullable;
044
045public class ContentPageAreaDetailValue
046        extends BaseValue<ContentPageAreaDetailPK>
047        implements Cloneable, Serializable {
048    
049    private ContentPageAreaPK contentPageAreaPK;
050    private boolean contentPageAreaPKHasBeenModified = false;
051    private ContentPagePK contentPagePK;
052    private boolean contentPagePKHasBeenModified = false;
053    private ContentPageLayoutAreaPK contentPageLayoutAreaPK;
054    private boolean contentPageLayoutAreaPKHasBeenModified = false;
055    private LanguagePK languagePK;
056    private boolean languagePKHasBeenModified = false;
057    private MimeTypePK mimeTypePK;
058    private boolean mimeTypePKHasBeenModified = 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(ContentPageAreaPK contentPageAreaPK, ContentPagePK contentPagePK, ContentPageLayoutAreaPK contentPageLayoutAreaPK, LanguagePK languagePK, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
068            throws PersistenceNotNullException {
069        checkForNull(contentPageAreaPK);
070        this.contentPageAreaPK = contentPageAreaPK;
071        checkForNull(contentPagePK);
072        this.contentPagePK = contentPagePK;
073        checkForNull(contentPageLayoutAreaPK);
074        this.contentPageLayoutAreaPK = contentPageLayoutAreaPK;
075        checkForNull(languagePK);
076        this.languagePK = languagePK;
077        checkForNull(mimeTypePK);
078        this.mimeTypePK = mimeTypePK;
079        checkForNull(fromTime);
080        this.fromTime = fromTime;
081        checkForNull(thruTime);
082        this.thruTime = thruTime;
083    }
084    
085    /** Creates a new instance of ContentPageAreaDetailValue */
086    public ContentPageAreaDetailValue(ContentPageAreaDetailPK contentPageAreaDetailPK, ContentPageAreaPK contentPageAreaPK, ContentPagePK contentPagePK, ContentPageLayoutAreaPK contentPageLayoutAreaPK, LanguagePK languagePK, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
087            throws PersistenceNotNullException {
088        super(contentPageAreaDetailPK);
089        constructFields(contentPageAreaPK, contentPagePK, contentPageLayoutAreaPK, languagePK, mimeTypePK, fromTime, thruTime);
090    }
091    
092    /** Creates a new instance of ContentPageAreaDetailValue */
093    public ContentPageAreaDetailValue(ContentPageAreaPK contentPageAreaPK, ContentPagePK contentPagePK, ContentPageLayoutAreaPK contentPageLayoutAreaPK, LanguagePK languagePK, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
094            throws PersistenceNotNullException {
095        super();
096        constructFields(contentPageAreaPK, contentPagePK, contentPageLayoutAreaPK, languagePK, mimeTypePK, fromTime, thruTime);
097    }
098    
099    @Override
100    @Nonnull
101    public ContentPageAreaDetailFactory getBaseFactoryInstance() {
102        return ContentPageAreaDetailFactory.getInstance();
103    }
104    
105    @Override
106    @Nonnull
107    public ContentPageAreaDetailValue 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 (ContentPageAreaDetailValue)result;
118    }
119    
120    @Override
121    @Nonnull
122    public ContentPageAreaDetailPK getPrimaryKey() {
123        if(_primaryKey == null) {
124            _primaryKey = new ContentPageAreaDetailPK(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 + ((contentPageAreaPK != null) ? contentPageAreaPK.hashCode() : 0);
143            hashCode = 37 * hashCode + ((contentPagePK != null) ? contentPagePK.hashCode() : 0);
144            hashCode = 37 * hashCode + ((contentPageLayoutAreaPK != null) ? contentPageLayoutAreaPK.hashCode() : 0);
145            hashCode = 37 * hashCode + ((languagePK != null) ? languagePK.hashCode() : 0);
146            hashCode = 37 * hashCode + ((mimeTypePK != null) ? mimeTypePK.hashCode() : 0);
147            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
148            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
149            
150            _hashCode = hashCode;
151        }
152        
153        return _hashCode;
154    }
155    
156    @Override
157    @Nonnull
158    public String toString() {
159        if(_stringValue == null) {
160            _stringValue = "{" + 
161                    "entityId=" + getEntityId() +
162                    ", contentPageAreaPK=" + getContentPageAreaPK() +
163                    ", contentPagePK=" + getContentPagePK() +
164                    ", contentPageLayoutAreaPK=" + getContentPageLayoutAreaPK() +
165                    ", languagePK=" + getLanguagePK() +
166                    ", mimeTypePK=" + getMimeTypePK() +
167                    ", fromTime=" + getFromTime() +
168                    ", thruTime=" + getThruTime() +
169                    "}";
170        }
171        return _stringValue;
172    }
173    
174    @Override
175    public boolean equals(Object other) {
176        if(this == other)
177            return true;
178        
179        if(!hasIdentity())
180            return false;
181        
182        if(other instanceof  ContentPageAreaDetailValue that) {
183            if(!that.hasIdentity())
184                return false;
185            
186            Long thisEntityId = getEntityId();
187            Long thatEntityId = that.getEntityId();
188            
189            boolean objectsEqual = thisEntityId.equals(thatEntityId);
190            if(objectsEqual)
191                objectsEqual = isIdentical(that);
192            
193            return objectsEqual;
194        } else {
195            return false;
196        }
197    }
198    
199    public boolean isIdentical(Object other) {
200        if(other instanceof ContentPageAreaDetailValue that) {
201            boolean objectsEqual = true;
202            
203            
204            if(objectsEqual) {
205                ContentPageAreaPK thisContentPageAreaPK = getContentPageAreaPK();
206                ContentPageAreaPK thatContentPageAreaPK = that.getContentPageAreaPK();
207                
208                if(thisContentPageAreaPK == null) {
209                    objectsEqual = objectsEqual && (thatContentPageAreaPK == null);
210                } else {
211                    objectsEqual = objectsEqual && thisContentPageAreaPK.equals(thatContentPageAreaPK);
212                }
213            }
214            
215            if(objectsEqual) {
216                ContentPagePK thisContentPagePK = getContentPagePK();
217                ContentPagePK thatContentPagePK = that.getContentPagePK();
218                
219                if(thisContentPagePK == null) {
220                    objectsEqual = objectsEqual && (thatContentPagePK == null);
221                } else {
222                    objectsEqual = objectsEqual && thisContentPagePK.equals(thatContentPagePK);
223                }
224            }
225            
226            if(objectsEqual) {
227                ContentPageLayoutAreaPK thisContentPageLayoutAreaPK = getContentPageLayoutAreaPK();
228                ContentPageLayoutAreaPK thatContentPageLayoutAreaPK = that.getContentPageLayoutAreaPK();
229                
230                if(thisContentPageLayoutAreaPK == null) {
231                    objectsEqual = objectsEqual && (thatContentPageLayoutAreaPK == null);
232                } else {
233                    objectsEqual = objectsEqual && thisContentPageLayoutAreaPK.equals(thatContentPageLayoutAreaPK);
234                }
235            }
236            
237            if(objectsEqual) {
238                LanguagePK thisLanguagePK = getLanguagePK();
239                LanguagePK thatLanguagePK = that.getLanguagePK();
240                
241                if(thisLanguagePK == null) {
242                    objectsEqual = objectsEqual && (thatLanguagePK == null);
243                } else {
244                    objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK);
245                }
246            }
247            
248            if(objectsEqual) {
249                MimeTypePK thisMimeTypePK = getMimeTypePK();
250                MimeTypePK thatMimeTypePK = that.getMimeTypePK();
251                
252                if(thisMimeTypePK == null) {
253                    objectsEqual = objectsEqual && (thatMimeTypePK == null);
254                } else {
255                    objectsEqual = objectsEqual && thisMimeTypePK.equals(thatMimeTypePK);
256                }
257            }
258            
259            if(objectsEqual) {
260                Long thisFromTime = getFromTime();
261                Long thatFromTime = that.getFromTime();
262                
263                if(thisFromTime == null) {
264                    objectsEqual = objectsEqual && (thatFromTime == null);
265                } else {
266                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
267                }
268            }
269            
270            if(objectsEqual) {
271                Long thisThruTime = getThruTime();
272                Long thatThruTime = that.getThruTime();
273                
274                if(thisThruTime == null) {
275                    objectsEqual = objectsEqual && (thatThruTime == null);
276                } else {
277                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
278                }
279            }
280            
281            return objectsEqual;
282        } else {
283            return false;
284        }
285    }
286    
287    @Override
288    public boolean hasBeenModified() {
289        return contentPageAreaPKHasBeenModified || contentPagePKHasBeenModified || contentPageLayoutAreaPKHasBeenModified || languagePKHasBeenModified || mimeTypePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
290    }
291    
292    @Override
293    public void clearHasBeenModified() {
294        contentPageAreaPKHasBeenModified = false;
295        contentPagePKHasBeenModified = false;
296        contentPageLayoutAreaPKHasBeenModified = false;
297        languagePKHasBeenModified = false;
298        mimeTypePKHasBeenModified = false;
299        fromTimeHasBeenModified = false;
300        thruTimeHasBeenModified = false;
301    }
302    
303    @Nonnull
304    public ContentPageAreaPK getContentPageAreaPK() {
305        return contentPageAreaPK;
306    }
307    
308    public void setContentPageAreaPK(@Nonnull ContentPageAreaPK contentPageAreaPK)
309            throws PersistenceNotNullException {
310        checkForNull(contentPageAreaPK);
311        
312        boolean update = true;
313        
314        if(this.contentPageAreaPK != null) {
315            if(this.contentPageAreaPK.equals(contentPageAreaPK)) {
316                update = false;
317            }
318        } else if(contentPageAreaPK == null) {
319            update = false;
320        }
321        
322        if(update) {
323            this.contentPageAreaPK = contentPageAreaPK;
324            contentPageAreaPKHasBeenModified = true;
325            clearHashAndString();
326        }
327    }
328    
329    public boolean getContentPageAreaPKHasBeenModified() {
330        return contentPageAreaPKHasBeenModified;
331    }
332    
333    @Nonnull
334    public ContentPagePK getContentPagePK() {
335        return contentPagePK;
336    }
337    
338    public void setContentPagePK(@Nonnull ContentPagePK contentPagePK)
339            throws PersistenceNotNullException {
340        checkForNull(contentPagePK);
341        
342        boolean update = true;
343        
344        if(this.contentPagePK != null) {
345            if(this.contentPagePK.equals(contentPagePK)) {
346                update = false;
347            }
348        } else if(contentPagePK == null) {
349            update = false;
350        }
351        
352        if(update) {
353            this.contentPagePK = contentPagePK;
354            contentPagePKHasBeenModified = true;
355            clearHashAndString();
356        }
357    }
358    
359    public boolean getContentPagePKHasBeenModified() {
360        return contentPagePKHasBeenModified;
361    }
362    
363    @Nonnull
364    public ContentPageLayoutAreaPK getContentPageLayoutAreaPK() {
365        return contentPageLayoutAreaPK;
366    }
367    
368    public void setContentPageLayoutAreaPK(@Nonnull ContentPageLayoutAreaPK contentPageLayoutAreaPK)
369            throws PersistenceNotNullException {
370        checkForNull(contentPageLayoutAreaPK);
371        
372        boolean update = true;
373        
374        if(this.contentPageLayoutAreaPK != null) {
375            if(this.contentPageLayoutAreaPK.equals(contentPageLayoutAreaPK)) {
376                update = false;
377            }
378        } else if(contentPageLayoutAreaPK == null) {
379            update = false;
380        }
381        
382        if(update) {
383            this.contentPageLayoutAreaPK = contentPageLayoutAreaPK;
384            contentPageLayoutAreaPKHasBeenModified = true;
385            clearHashAndString();
386        }
387    }
388    
389    public boolean getContentPageLayoutAreaPKHasBeenModified() {
390        return contentPageLayoutAreaPKHasBeenModified;
391    }
392    
393    @Nonnull
394    public LanguagePK getLanguagePK() {
395        return languagePK;
396    }
397    
398    public void setLanguagePK(@Nonnull LanguagePK languagePK)
399            throws PersistenceNotNullException {
400        checkForNull(languagePK);
401        
402        boolean update = true;
403        
404        if(this.languagePK != null) {
405            if(this.languagePK.equals(languagePK)) {
406                update = false;
407            }
408        } else if(languagePK == null) {
409            update = false;
410        }
411        
412        if(update) {
413            this.languagePK = languagePK;
414            languagePKHasBeenModified = true;
415            clearHashAndString();
416        }
417    }
418    
419    public boolean getLanguagePKHasBeenModified() {
420        return languagePKHasBeenModified;
421    }
422    
423    @Nonnull
424    public MimeTypePK getMimeTypePK() {
425        return mimeTypePK;
426    }
427    
428    public void setMimeTypePK(@Nonnull MimeTypePK mimeTypePK)
429            throws PersistenceNotNullException {
430        checkForNull(mimeTypePK);
431        
432        boolean update = true;
433        
434        if(this.mimeTypePK != null) {
435            if(this.mimeTypePK.equals(mimeTypePK)) {
436                update = false;
437            }
438        } else if(mimeTypePK == null) {
439            update = false;
440        }
441        
442        if(update) {
443            this.mimeTypePK = mimeTypePK;
444            mimeTypePKHasBeenModified = true;
445            clearHashAndString();
446        }
447    }
448    
449    public boolean getMimeTypePKHasBeenModified() {
450        return mimeTypePKHasBeenModified;
451    }
452    
453    @Nonnull
454    public Long getFromTime() {
455        return fromTime;
456    }
457    
458    public void setFromTime(@Nonnull Long fromTime)
459            throws PersistenceNotNullException {
460        checkForNull(fromTime);
461        
462        boolean update = true;
463        
464        if(this.fromTime != null) {
465            if(this.fromTime.equals(fromTime)) {
466                update = false;
467            }
468        } else if(fromTime == null) {
469            update = false;
470        }
471        
472        if(update) {
473            this.fromTime = fromTime;
474            fromTimeHasBeenModified = true;
475            clearHashAndString();
476        }
477    }
478    
479    public boolean getFromTimeHasBeenModified() {
480        return fromTimeHasBeenModified;
481    }
482    
483    @Nonnull
484    public Long getThruTime() {
485        return thruTime;
486    }
487    
488    public void setThruTime(@Nonnull Long thruTime)
489            throws PersistenceNotNullException {
490        checkForNull(thruTime);
491        
492        boolean update = true;
493        
494        if(this.thruTime != null) {
495            if(this.thruTime.equals(thruTime)) {
496                update = false;
497            }
498        } else if(thruTime == null) {
499            update = false;
500        }
501        
502        if(update) {
503            this.thruTime = thruTime;
504            thruTimeHasBeenModified = true;
505            clearHashAndString();
506        }
507    }
508    
509    public boolean getThruTimeHasBeenModified() {
510        return thruTimeHasBeenModified;
511    }
512    
513}