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 * ItemDescriptionDetailValue.java
021 */
022
023package com.echothree.model.data.item.server.value;
024
025import com.echothree.model.data.item.common.pk.ItemDescriptionDetailPK;
026
027import com.echothree.model.data.item.server.factory.ItemDescriptionDetailFactory;
028
029import com.echothree.model.data.item.common.pk.ItemDescriptionPK;
030import com.echothree.model.data.item.common.pk.ItemDescriptionTypePK;
031import com.echothree.model.data.item.common.pk.ItemPK;
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 ItemDescriptionDetailValue
043        extends BaseValue<ItemDescriptionDetailPK>
044        implements Cloneable, Serializable {
045    
046    private ItemDescriptionPK itemDescriptionPK;
047    private boolean itemDescriptionPKHasBeenModified = false;
048    private ItemDescriptionTypePK itemDescriptionTypePK;
049    private boolean itemDescriptionTypePKHasBeenModified = false;
050    private ItemPK itemPK;
051    private boolean itemPKHasBeenModified = 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(ItemDescriptionPK itemDescriptionPK, ItemDescriptionTypePK itemDescriptionTypePK, ItemPK itemPK, LanguagePK languagePK, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
065            throws PersistenceNotNullException {
066        checkForNull(itemDescriptionPK);
067        this.itemDescriptionPK = itemDescriptionPK;
068        checkForNull(itemDescriptionTypePK);
069        this.itemDescriptionTypePK = itemDescriptionTypePK;
070        checkForNull(itemPK);
071        this.itemPK = itemPK;
072        checkForNull(languagePK);
073        this.languagePK = languagePK;
074        this.mimeTypePK = mimeTypePK;
075        checkForNull(fromTime);
076        this.fromTime = fromTime;
077        checkForNull(thruTime);
078        this.thruTime = thruTime;
079    }
080    
081    /** Creates a new instance of ItemDescriptionDetailValue */
082    public ItemDescriptionDetailValue(ItemDescriptionDetailPK itemDescriptionDetailPK, ItemDescriptionPK itemDescriptionPK, ItemDescriptionTypePK itemDescriptionTypePK, ItemPK itemPK, LanguagePK languagePK, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
083            throws PersistenceNotNullException {
084        super(itemDescriptionDetailPK);
085        constructFields(itemDescriptionPK, itemDescriptionTypePK, itemPK, languagePK, mimeTypePK, fromTime, thruTime);
086    }
087    
088    /** Creates a new instance of ItemDescriptionDetailValue */
089    public ItemDescriptionDetailValue(ItemDescriptionPK itemDescriptionPK, ItemDescriptionTypePK itemDescriptionTypePK, ItemPK itemPK, LanguagePK languagePK, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
090            throws PersistenceNotNullException {
091        super();
092        constructFields(itemDescriptionPK, itemDescriptionTypePK, itemPK, languagePK, mimeTypePK, fromTime, thruTime);
093    }
094    
095   @Override
096   public ItemDescriptionDetailFactory getBaseFactoryInstance() {
097        return ItemDescriptionDetailFactory.getInstance();
098    }
099    
100    @Override
101    public ItemDescriptionDetailValue clone() {
102        Object result;
103        
104        try {
105            result = super.clone();
106        } catch (CloneNotSupportedException cnse) {
107            // This shouldn't happen, fail when it does.
108            throw new PersistenceCloneException(cnse);
109        }
110        
111        return (ItemDescriptionDetailValue)result;
112    }
113    
114   @Override
115    public ItemDescriptionDetailPK getPrimaryKey() {
116        if(_primaryKey == null) {
117            _primaryKey = new ItemDescriptionDetailPK(entityId);
118        }
119        
120        return _primaryKey;
121    }
122    
123    private void clearHashAndString() {
124        _hashCode = null;
125        _stringValue = null;
126    }
127    
128    @Override
129    public int hashCode() {
130        if(_hashCode == null) {
131            int hashCode = 17;
132            
133            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
134            
135            hashCode = 37 * hashCode + ((itemDescriptionPK != null) ? itemDescriptionPK.hashCode() : 0);
136            hashCode = 37 * hashCode + ((itemDescriptionTypePK != null) ? itemDescriptionTypePK.hashCode() : 0);
137            hashCode = 37 * hashCode + ((itemPK != null) ? itemPK.hashCode() : 0);
138            hashCode = 37 * hashCode + ((languagePK != null) ? languagePK.hashCode() : 0);
139            hashCode = 37 * hashCode + ((mimeTypePK != null) ? mimeTypePK.hashCode() : 0);
140            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
141            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
142            
143            _hashCode = hashCode;
144        }
145        
146        return _hashCode;
147    }
148    
149    @Override
150    public String toString() {
151        if(_stringValue == null) {
152            _stringValue = "{" + 
153                    "entityId=" + getEntityId() +
154                    ", itemDescriptionPK=" + getItemDescriptionPK() +
155                    ", itemDescriptionTypePK=" + getItemDescriptionTypePK() +
156                    ", itemPK=" + getItemPK() +
157                    ", languagePK=" + getLanguagePK() +
158                    ", mimeTypePK=" + getMimeTypePK() +
159                    ", fromTime=" + getFromTime() +
160                    ", thruTime=" + getThruTime() +
161                    "}";
162        }
163        return _stringValue;
164    }
165    
166    @Override
167    public boolean equals(Object other) {
168        if(this == other)
169            return true;
170        
171        if(!hasIdentity())
172            return false;
173        
174        if(other instanceof  ItemDescriptionDetailValue that) {
175            if(!that.hasIdentity())
176                return false;
177            
178            Long thisEntityId = getEntityId();
179            Long thatEntityId = that.getEntityId();
180            
181            boolean objectsEqual = thisEntityId.equals(thatEntityId);
182            if(objectsEqual)
183                objectsEqual = isIdentical(that);
184            
185            return objectsEqual;
186        } else {
187            return false;
188        }
189    }
190    
191    public boolean isIdentical(Object other) {
192        if(other instanceof ItemDescriptionDetailValue that) {
193            boolean objectsEqual = true;
194            
195            
196            if(objectsEqual) {
197                ItemDescriptionPK thisItemDescriptionPK = getItemDescriptionPK();
198                ItemDescriptionPK thatItemDescriptionPK = that.getItemDescriptionPK();
199                
200                if(thisItemDescriptionPK == null) {
201                    objectsEqual = objectsEqual && (thatItemDescriptionPK == null);
202                } else {
203                    objectsEqual = objectsEqual && thisItemDescriptionPK.equals(thatItemDescriptionPK);
204                }
205            }
206            
207            if(objectsEqual) {
208                ItemDescriptionTypePK thisItemDescriptionTypePK = getItemDescriptionTypePK();
209                ItemDescriptionTypePK thatItemDescriptionTypePK = that.getItemDescriptionTypePK();
210                
211                if(thisItemDescriptionTypePK == null) {
212                    objectsEqual = objectsEqual && (thatItemDescriptionTypePK == null);
213                } else {
214                    objectsEqual = objectsEqual && thisItemDescriptionTypePK.equals(thatItemDescriptionTypePK);
215                }
216            }
217            
218            if(objectsEqual) {
219                ItemPK thisItemPK = getItemPK();
220                ItemPK thatItemPK = that.getItemPK();
221                
222                if(thisItemPK == null) {
223                    objectsEqual = objectsEqual && (thatItemPK == null);
224                } else {
225                    objectsEqual = objectsEqual && thisItemPK.equals(thatItemPK);
226                }
227            }
228            
229            if(objectsEqual) {
230                LanguagePK thisLanguagePK = getLanguagePK();
231                LanguagePK thatLanguagePK = that.getLanguagePK();
232                
233                if(thisLanguagePK == null) {
234                    objectsEqual = objectsEqual && (thatLanguagePK == null);
235                } else {
236                    objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK);
237                }
238            }
239            
240            if(objectsEqual) {
241                MimeTypePK thisMimeTypePK = getMimeTypePK();
242                MimeTypePK thatMimeTypePK = that.getMimeTypePK();
243                
244                if(thisMimeTypePK == null) {
245                    objectsEqual = objectsEqual && (thatMimeTypePK == null);
246                } else {
247                    objectsEqual = objectsEqual && thisMimeTypePK.equals(thatMimeTypePK);
248                }
249            }
250            
251            if(objectsEqual) {
252                Long thisFromTime = getFromTime();
253                Long thatFromTime = that.getFromTime();
254                
255                if(thisFromTime == null) {
256                    objectsEqual = objectsEqual && (thatFromTime == null);
257                } else {
258                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
259                }
260            }
261            
262            if(objectsEqual) {
263                Long thisThruTime = getThruTime();
264                Long thatThruTime = that.getThruTime();
265                
266                if(thisThruTime == null) {
267                    objectsEqual = objectsEqual && (thatThruTime == null);
268                } else {
269                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
270                }
271            }
272            
273            return objectsEqual;
274        } else {
275            return false;
276        }
277    }
278    
279    @Override
280    public boolean hasBeenModified() {
281        return itemDescriptionPKHasBeenModified || itemDescriptionTypePKHasBeenModified || itemPKHasBeenModified || languagePKHasBeenModified || mimeTypePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
282    }
283    
284    @Override
285    public void clearHasBeenModified() {
286        itemDescriptionPKHasBeenModified = false;
287        itemDescriptionTypePKHasBeenModified = false;
288        itemPKHasBeenModified = false;
289        languagePKHasBeenModified = false;
290        mimeTypePKHasBeenModified = false;
291        fromTimeHasBeenModified = false;
292        thruTimeHasBeenModified = false;
293    }
294    
295    public ItemDescriptionPK getItemDescriptionPK() {
296        return itemDescriptionPK;
297    }
298    
299    public void setItemDescriptionPK(ItemDescriptionPK itemDescriptionPK)
300            throws PersistenceNotNullException {
301        checkForNull(itemDescriptionPK);
302        
303        boolean update = true;
304        
305        if(this.itemDescriptionPK != null) {
306            if(this.itemDescriptionPK.equals(itemDescriptionPK)) {
307                update = false;
308            }
309        } else if(itemDescriptionPK == null) {
310            update = false;
311        }
312        
313        if(update) {
314            this.itemDescriptionPK = itemDescriptionPK;
315            itemDescriptionPKHasBeenModified = true;
316            clearHashAndString();
317        }
318    }
319    
320    public boolean getItemDescriptionPKHasBeenModified() {
321        return itemDescriptionPKHasBeenModified;
322    }
323    
324    public ItemDescriptionTypePK getItemDescriptionTypePK() {
325        return itemDescriptionTypePK;
326    }
327    
328    public void setItemDescriptionTypePK(ItemDescriptionTypePK itemDescriptionTypePK)
329            throws PersistenceNotNullException {
330        checkForNull(itemDescriptionTypePK);
331        
332        boolean update = true;
333        
334        if(this.itemDescriptionTypePK != null) {
335            if(this.itemDescriptionTypePK.equals(itemDescriptionTypePK)) {
336                update = false;
337            }
338        } else if(itemDescriptionTypePK == null) {
339            update = false;
340        }
341        
342        if(update) {
343            this.itemDescriptionTypePK = itemDescriptionTypePK;
344            itemDescriptionTypePKHasBeenModified = true;
345            clearHashAndString();
346        }
347    }
348    
349    public boolean getItemDescriptionTypePKHasBeenModified() {
350        return itemDescriptionTypePKHasBeenModified;
351    }
352    
353    public ItemPK getItemPK() {
354        return itemPK;
355    }
356    
357    public void setItemPK(ItemPK itemPK)
358            throws PersistenceNotNullException {
359        checkForNull(itemPK);
360        
361        boolean update = true;
362        
363        if(this.itemPK != null) {
364            if(this.itemPK.equals(itemPK)) {
365                update = false;
366            }
367        } else if(itemPK == null) {
368            update = false;
369        }
370        
371        if(update) {
372            this.itemPK = itemPK;
373            itemPKHasBeenModified = true;
374            clearHashAndString();
375        }
376    }
377    
378    public boolean getItemPKHasBeenModified() {
379        return itemPKHasBeenModified;
380    }
381    
382    public LanguagePK getLanguagePK() {
383        return languagePK;
384    }
385    
386    public void setLanguagePK(LanguagePK languagePK)
387            throws PersistenceNotNullException {
388        checkForNull(languagePK);
389        
390        boolean update = true;
391        
392        if(this.languagePK != null) {
393            if(this.languagePK.equals(languagePK)) {
394                update = false;
395            }
396        } else if(languagePK == null) {
397            update = false;
398        }
399        
400        if(update) {
401            this.languagePK = languagePK;
402            languagePKHasBeenModified = true;
403            clearHashAndString();
404        }
405    }
406    
407    public boolean getLanguagePKHasBeenModified() {
408        return languagePKHasBeenModified;
409    }
410    
411    public MimeTypePK getMimeTypePK() {
412        return mimeTypePK;
413    }
414    
415    public void setMimeTypePK(MimeTypePK mimeTypePK) {
416        boolean update = true;
417        
418        if(this.mimeTypePK != null) {
419            if(this.mimeTypePK.equals(mimeTypePK)) {
420                update = false;
421            }
422        } else if(mimeTypePK == null) {
423            update = false;
424        }
425        
426        if(update) {
427            this.mimeTypePK = mimeTypePK;
428            mimeTypePKHasBeenModified = true;
429            clearHashAndString();
430        }
431    }
432    
433    public boolean getMimeTypePKHasBeenModified() {
434        return mimeTypePKHasBeenModified;
435    }
436    
437    public Long getFromTime() {
438        return fromTime;
439    }
440    
441    public void setFromTime(Long fromTime)
442            throws PersistenceNotNullException {
443        checkForNull(fromTime);
444        
445        boolean update = true;
446        
447        if(this.fromTime != null) {
448            if(this.fromTime.equals(fromTime)) {
449                update = false;
450            }
451        } else if(fromTime == null) {
452            update = false;
453        }
454        
455        if(update) {
456            this.fromTime = fromTime;
457            fromTimeHasBeenModified = true;
458            clearHashAndString();
459        }
460    }
461    
462    public boolean getFromTimeHasBeenModified() {
463        return fromTimeHasBeenModified;
464    }
465    
466    public Long getThruTime() {
467        return thruTime;
468    }
469    
470    public void setThruTime(Long thruTime)
471            throws PersistenceNotNullException {
472        checkForNull(thruTime);
473        
474        boolean update = true;
475        
476        if(this.thruTime != null) {
477            if(this.thruTime.equals(thruTime)) {
478                update = false;
479            }
480        } else if(thruTime == null) {
481            update = false;
482        }
483        
484        if(update) {
485            this.thruTime = thruTime;
486            thruTimeHasBeenModified = true;
487            clearHashAndString();
488        }
489    }
490    
491    public boolean getThruTimeHasBeenModified() {
492        return thruTimeHasBeenModified;
493    }
494    
495}