001// --------------------------------------------------------------------------------
002// Copyright 2002-2024 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
042public class ContentPageAreaDetailValue
043        extends BaseValue<ContentPageAreaDetailPK>
044        implements Cloneable, Serializable {
045    
046    private ContentPageAreaPK contentPageAreaPK;
047    private boolean contentPageAreaPKHasBeenModified = false;
048    private ContentPagePK contentPagePK;
049    private boolean contentPagePKHasBeenModified = false;
050    private ContentPageLayoutAreaPK contentPageLayoutAreaPK;
051    private boolean contentPageLayoutAreaPKHasBeenModified = false;
052    private LanguagePK languagePK;
053    private boolean languagePKHasBeenModified = false;
054    private MimeTypePK mimeTypePK;
055    private boolean mimeTypePKHasBeenModified = false;
056    private Long fromTime;
057    private boolean fromTimeHasBeenModified = false;
058    private Long thruTime;
059    private boolean thruTimeHasBeenModified = false;
060    
061    private transient Integer _hashCode = null;
062    private transient String _stringValue = null;
063    
064    private void constructFields(ContentPageAreaPK contentPageAreaPK, ContentPagePK contentPagePK, ContentPageLayoutAreaPK contentPageLayoutAreaPK, LanguagePK languagePK, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
065            throws PersistenceNotNullException {
066        checkForNull(contentPageAreaPK);
067        this.contentPageAreaPK = contentPageAreaPK;
068        checkForNull(contentPagePK);
069        this.contentPagePK = contentPagePK;
070        checkForNull(contentPageLayoutAreaPK);
071        this.contentPageLayoutAreaPK = contentPageLayoutAreaPK;
072        checkForNull(languagePK);
073        this.languagePK = languagePK;
074        checkForNull(mimeTypePK);
075        this.mimeTypePK = mimeTypePK;
076        checkForNull(fromTime);
077        this.fromTime = fromTime;
078        checkForNull(thruTime);
079        this.thruTime = thruTime;
080    }
081    
082    /** Creates a new instance of ContentPageAreaDetailValue */
083    public ContentPageAreaDetailValue(ContentPageAreaDetailPK contentPageAreaDetailPK, ContentPageAreaPK contentPageAreaPK, ContentPagePK contentPagePK, ContentPageLayoutAreaPK contentPageLayoutAreaPK, LanguagePK languagePK, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
084            throws PersistenceNotNullException {
085        super(contentPageAreaDetailPK);
086        constructFields(contentPageAreaPK, contentPagePK, contentPageLayoutAreaPK, languagePK, mimeTypePK, fromTime, thruTime);
087    }
088    
089    /** Creates a new instance of ContentPageAreaDetailValue */
090    public ContentPageAreaDetailValue(ContentPageAreaPK contentPageAreaPK, ContentPagePK contentPagePK, ContentPageLayoutAreaPK contentPageLayoutAreaPK, LanguagePK languagePK, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
091            throws PersistenceNotNullException {
092        super();
093        constructFields(contentPageAreaPK, contentPagePK, contentPageLayoutAreaPK, languagePK, mimeTypePK, fromTime, thruTime);
094    }
095    
096   @Override
097   public ContentPageAreaDetailFactory getBaseFactoryInstance() {
098        return ContentPageAreaDetailFactory.getInstance();
099    }
100    
101    @Override
102    public ContentPageAreaDetailValue 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 (ContentPageAreaDetailValue)result;
113    }
114    
115   @Override
116    public ContentPageAreaDetailPK getPrimaryKey() {
117        if(_primaryKey == null) {
118            _primaryKey = new ContentPageAreaDetailPK(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 + ((contentPageAreaPK != null) ? contentPageAreaPK.hashCode() : 0);
137            hashCode = 37 * hashCode + ((contentPagePK != null) ? contentPagePK.hashCode() : 0);
138            hashCode = 37 * hashCode + ((contentPageLayoutAreaPK != null) ? contentPageLayoutAreaPK.hashCode() : 0);
139            hashCode = 37 * hashCode + ((languagePK != null) ? languagePK.hashCode() : 0);
140            hashCode = 37 * hashCode + ((mimeTypePK != null) ? mimeTypePK.hashCode() : 0);
141            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
142            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
143            
144            _hashCode = hashCode;
145        }
146        
147        return _hashCode;
148    }
149    
150    @Override
151    public String toString() {
152        if(_stringValue == null) {
153            StringBuilder stringValue = new StringBuilder("{");
154            
155            stringValue.append("entityId=").append(getEntityId());
156            
157            stringValue.append(", contentPageAreaPK=").append(getContentPageAreaPK());
158            stringValue.append(", contentPagePK=").append(getContentPagePK());
159            stringValue.append(", contentPageLayoutAreaPK=").append(getContentPageLayoutAreaPK());
160            stringValue.append(", languagePK=").append(getLanguagePK());
161            stringValue.append(", mimeTypePK=").append(getMimeTypePK());
162            stringValue.append(", fromTime=").append(getFromTime());
163            stringValue.append(", thruTime=").append(getThruTime());
164            
165            stringValue.append('}');
166            
167            _stringValue = stringValue.toString();
168        }
169        return _stringValue;
170    }
171    
172    @Override
173    public boolean equals(Object other) {
174        if(this == other)
175            return true;
176        
177        if(!hasIdentity())
178            return false;
179        
180        if(other instanceof  ContentPageAreaDetailValue) {
181            ContentPageAreaDetailValue that = (ContentPageAreaDetailValue)other;
182            
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 = 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) {
201            ContentPageAreaDetailValue that = (ContentPageAreaDetailValue)other;
202            boolean objectsEqual = true;
203            
204            
205            if(objectsEqual) {
206                ContentPageAreaPK thisContentPageAreaPK = getContentPageAreaPK();
207                ContentPageAreaPK thatContentPageAreaPK = that.getContentPageAreaPK();
208                
209                if(thisContentPageAreaPK == null) {
210                    objectsEqual = objectsEqual && (thatContentPageAreaPK == null);
211                } else {
212                    objectsEqual = objectsEqual && thisContentPageAreaPK.equals(thatContentPageAreaPK);
213                }
214            }
215            
216            if(objectsEqual) {
217                ContentPagePK thisContentPagePK = getContentPagePK();
218                ContentPagePK thatContentPagePK = that.getContentPagePK();
219                
220                if(thisContentPagePK == null) {
221                    objectsEqual = objectsEqual && (thatContentPagePK == null);
222                } else {
223                    objectsEqual = objectsEqual && thisContentPagePK.equals(thatContentPagePK);
224                }
225            }
226            
227            if(objectsEqual) {
228                ContentPageLayoutAreaPK thisContentPageLayoutAreaPK = getContentPageLayoutAreaPK();
229                ContentPageLayoutAreaPK thatContentPageLayoutAreaPK = that.getContentPageLayoutAreaPK();
230                
231                if(thisContentPageLayoutAreaPK == null) {
232                    objectsEqual = objectsEqual && (thatContentPageLayoutAreaPK == null);
233                } else {
234                    objectsEqual = objectsEqual && thisContentPageLayoutAreaPK.equals(thatContentPageLayoutAreaPK);
235                }
236            }
237            
238            if(objectsEqual) {
239                LanguagePK thisLanguagePK = getLanguagePK();
240                LanguagePK thatLanguagePK = that.getLanguagePK();
241                
242                if(thisLanguagePK == null) {
243                    objectsEqual = objectsEqual && (thatLanguagePK == null);
244                } else {
245                    objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK);
246                }
247            }
248            
249            if(objectsEqual) {
250                MimeTypePK thisMimeTypePK = getMimeTypePK();
251                MimeTypePK thatMimeTypePK = that.getMimeTypePK();
252                
253                if(thisMimeTypePK == null) {
254                    objectsEqual = objectsEqual && (thatMimeTypePK == null);
255                } else {
256                    objectsEqual = objectsEqual && thisMimeTypePK.equals(thatMimeTypePK);
257                }
258            }
259            
260            if(objectsEqual) {
261                Long thisFromTime = getFromTime();
262                Long thatFromTime = that.getFromTime();
263                
264                if(thisFromTime == null) {
265                    objectsEqual = objectsEqual && (thatFromTime == null);
266                } else {
267                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
268                }
269            }
270            
271            if(objectsEqual) {
272                Long thisThruTime = getThruTime();
273                Long thatThruTime = that.getThruTime();
274                
275                if(thisThruTime == null) {
276                    objectsEqual = objectsEqual && (thatThruTime == null);
277                } else {
278                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
279                }
280            }
281            
282            return objectsEqual;
283        } else {
284            return false;
285        }
286    }
287    
288    @Override
289    public boolean hasBeenModified() {
290        return contentPageAreaPKHasBeenModified || contentPagePKHasBeenModified || contentPageLayoutAreaPKHasBeenModified || languagePKHasBeenModified || mimeTypePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
291    }
292    
293    @Override
294    public void clearHasBeenModified() {
295        contentPageAreaPKHasBeenModified = false;
296        contentPagePKHasBeenModified = false;
297        contentPageLayoutAreaPKHasBeenModified = false;
298        languagePKHasBeenModified = false;
299        mimeTypePKHasBeenModified = false;
300        fromTimeHasBeenModified = false;
301        thruTimeHasBeenModified = false;
302    }
303    
304    public ContentPageAreaPK getContentPageAreaPK() {
305        return contentPageAreaPK;
306    }
307    
308    public void setContentPageAreaPK(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    public ContentPagePK getContentPagePK() {
334        return contentPagePK;
335    }
336    
337    public void setContentPagePK(ContentPagePK contentPagePK)
338            throws PersistenceNotNullException {
339        checkForNull(contentPagePK);
340        
341        boolean update = true;
342        
343        if(this.contentPagePK != null) {
344            if(this.contentPagePK.equals(contentPagePK)) {
345                update = false;
346            }
347        } else if(contentPagePK == null) {
348            update = false;
349        }
350        
351        if(update) {
352            this.contentPagePK = contentPagePK;
353            contentPagePKHasBeenModified = true;
354            clearHashAndString();
355        }
356    }
357    
358    public boolean getContentPagePKHasBeenModified() {
359        return contentPagePKHasBeenModified;
360    }
361    
362    public ContentPageLayoutAreaPK getContentPageLayoutAreaPK() {
363        return contentPageLayoutAreaPK;
364    }
365    
366    public void setContentPageLayoutAreaPK(ContentPageLayoutAreaPK contentPageLayoutAreaPK)
367            throws PersistenceNotNullException {
368        checkForNull(contentPageLayoutAreaPK);
369        
370        boolean update = true;
371        
372        if(this.contentPageLayoutAreaPK != null) {
373            if(this.contentPageLayoutAreaPK.equals(contentPageLayoutAreaPK)) {
374                update = false;
375            }
376        } else if(contentPageLayoutAreaPK == null) {
377            update = false;
378        }
379        
380        if(update) {
381            this.contentPageLayoutAreaPK = contentPageLayoutAreaPK;
382            contentPageLayoutAreaPKHasBeenModified = true;
383            clearHashAndString();
384        }
385    }
386    
387    public boolean getContentPageLayoutAreaPKHasBeenModified() {
388        return contentPageLayoutAreaPKHasBeenModified;
389    }
390    
391    public LanguagePK getLanguagePK() {
392        return languagePK;
393    }
394    
395    public void setLanguagePK(LanguagePK languagePK)
396            throws PersistenceNotNullException {
397        checkForNull(languagePK);
398        
399        boolean update = true;
400        
401        if(this.languagePK != null) {
402            if(this.languagePK.equals(languagePK)) {
403                update = false;
404            }
405        } else if(languagePK == null) {
406            update = false;
407        }
408        
409        if(update) {
410            this.languagePK = languagePK;
411            languagePKHasBeenModified = true;
412            clearHashAndString();
413        }
414    }
415    
416    public boolean getLanguagePKHasBeenModified() {
417        return languagePKHasBeenModified;
418    }
419    
420    public MimeTypePK getMimeTypePK() {
421        return mimeTypePK;
422    }
423    
424    public void setMimeTypePK(MimeTypePK mimeTypePK)
425            throws PersistenceNotNullException {
426        checkForNull(mimeTypePK);
427        
428        boolean update = true;
429        
430        if(this.mimeTypePK != null) {
431            if(this.mimeTypePK.equals(mimeTypePK)) {
432                update = false;
433            }
434        } else if(mimeTypePK == null) {
435            update = false;
436        }
437        
438        if(update) {
439            this.mimeTypePK = mimeTypePK;
440            mimeTypePKHasBeenModified = true;
441            clearHashAndString();
442        }
443    }
444    
445    public boolean getMimeTypePKHasBeenModified() {
446        return mimeTypePKHasBeenModified;
447    }
448    
449    public Long getFromTime() {
450        return fromTime;
451    }
452    
453    public void setFromTime(Long fromTime)
454            throws PersistenceNotNullException {
455        checkForNull(fromTime);
456        
457        boolean update = true;
458        
459        if(this.fromTime != null) {
460            if(this.fromTime.equals(fromTime)) {
461                update = false;
462            }
463        } else if(fromTime == null) {
464            update = false;
465        }
466        
467        if(update) {
468            this.fromTime = fromTime;
469            fromTimeHasBeenModified = true;
470            clearHashAndString();
471        }
472    }
473    
474    public boolean getFromTimeHasBeenModified() {
475        return fromTimeHasBeenModified;
476    }
477    
478    public Long getThruTime() {
479        return thruTime;
480    }
481    
482    public void setThruTime(Long thruTime)
483            throws PersistenceNotNullException {
484        checkForNull(thruTime);
485        
486        boolean update = true;
487        
488        if(this.thruTime != null) {
489            if(this.thruTime.equals(thruTime)) {
490                update = false;
491            }
492        } else if(thruTime == null) {
493            update = false;
494        }
495        
496        if(update) {
497            this.thruTime = thruTime;
498            thruTimeHasBeenModified = true;
499            clearHashAndString();
500        }
501    }
502    
503    public boolean getThruTimeHasBeenModified() {
504        return thruTimeHasBeenModified;
505    }
506    
507}