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 * PartyDetailValue.java
021 */
022
023package com.echothree.model.data.party.server.value;
024
025import com.echothree.model.data.party.common.pk.PartyDetailPK;
026
027import com.echothree.model.data.party.server.factory.PartyDetailFactory;
028
029import com.echothree.model.data.party.common.pk.PartyPK;
030import com.echothree.model.data.party.common.pk.PartyTypePK;
031import com.echothree.model.data.party.common.pk.LanguagePK;
032import com.echothree.model.data.accounting.common.pk.CurrencyPK;
033import com.echothree.model.data.party.common.pk.TimeZonePK;
034import com.echothree.model.data.party.common.pk.DateTimeFormatPK;
035
036import com.echothree.util.common.exception.PersistenceCloneException;
037import com.echothree.util.common.exception.PersistenceNotNullException;
038
039import com.echothree.util.server.persistence.BaseValue;
040
041import java.io.Serializable;
042
043public class PartyDetailValue
044        extends BaseValue<PartyDetailPK>
045        implements Cloneable, Serializable {
046    
047    private PartyPK partyPK;
048    private boolean partyPKHasBeenModified = false;
049    private String partyName;
050    private boolean partyNameHasBeenModified = false;
051    private PartyTypePK partyTypePK;
052    private boolean partyTypePKHasBeenModified = false;
053    private LanguagePK preferredLanguagePK;
054    private boolean preferredLanguagePKHasBeenModified = false;
055    private CurrencyPK preferredCurrencyPK;
056    private boolean preferredCurrencyPKHasBeenModified = false;
057    private TimeZonePK preferredTimeZonePK;
058    private boolean preferredTimeZonePKHasBeenModified = false;
059    private DateTimeFormatPK preferredDateTimeFormatPK;
060    private boolean preferredDateTimeFormatPKHasBeenModified = false;
061    private Long fromTime;
062    private boolean fromTimeHasBeenModified = false;
063    private Long thruTime;
064    private boolean thruTimeHasBeenModified = false;
065    
066    private transient Integer _hashCode = null;
067    private transient String _stringValue = null;
068    
069    private void constructFields(PartyPK partyPK, String partyName, PartyTypePK partyTypePK, LanguagePK preferredLanguagePK, CurrencyPK preferredCurrencyPK, TimeZonePK preferredTimeZonePK, DateTimeFormatPK preferredDateTimeFormatPK, Long fromTime, Long thruTime)
070            throws PersistenceNotNullException {
071        checkForNull(partyPK);
072        this.partyPK = partyPK;
073        checkForNull(partyName);
074        this.partyName = partyName;
075        checkForNull(partyTypePK);
076        this.partyTypePK = partyTypePK;
077        this.preferredLanguagePK = preferredLanguagePK;
078        this.preferredCurrencyPK = preferredCurrencyPK;
079        this.preferredTimeZonePK = preferredTimeZonePK;
080        this.preferredDateTimeFormatPK = preferredDateTimeFormatPK;
081        checkForNull(fromTime);
082        this.fromTime = fromTime;
083        checkForNull(thruTime);
084        this.thruTime = thruTime;
085    }
086    
087    /** Creates a new instance of PartyDetailValue */
088    public PartyDetailValue(PartyDetailPK partyDetailPK, PartyPK partyPK, String partyName, PartyTypePK partyTypePK, LanguagePK preferredLanguagePK, CurrencyPK preferredCurrencyPK, TimeZonePK preferredTimeZonePK, DateTimeFormatPK preferredDateTimeFormatPK, Long fromTime, Long thruTime)
089            throws PersistenceNotNullException {
090        super(partyDetailPK);
091        constructFields(partyPK, partyName, partyTypePK, preferredLanguagePK, preferredCurrencyPK, preferredTimeZonePK, preferredDateTimeFormatPK, fromTime, thruTime);
092    }
093    
094    /** Creates a new instance of PartyDetailValue */
095    public PartyDetailValue(PartyPK partyPK, String partyName, PartyTypePK partyTypePK, LanguagePK preferredLanguagePK, CurrencyPK preferredCurrencyPK, TimeZonePK preferredTimeZonePK, DateTimeFormatPK preferredDateTimeFormatPK, Long fromTime, Long thruTime)
096            throws PersistenceNotNullException {
097        super();
098        constructFields(partyPK, partyName, partyTypePK, preferredLanguagePK, preferredCurrencyPK, preferredTimeZonePK, preferredDateTimeFormatPK, fromTime, thruTime);
099    }
100    
101   @Override
102   public PartyDetailFactory getBaseFactoryInstance() {
103        return PartyDetailFactory.getInstance();
104    }
105    
106    @Override
107    public PartyDetailValue 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 (PartyDetailValue)result;
118    }
119    
120   @Override
121    public PartyDetailPK getPrimaryKey() {
122        if(_primaryKey == null) {
123            _primaryKey = new PartyDetailPK(entityId);
124        }
125        
126        return _primaryKey;
127    }
128    
129    private void clearHashAndString() {
130        _hashCode = null;
131        _stringValue = null;
132    }
133    
134    @Override
135    public int hashCode() {
136        if(_hashCode == null) {
137            int hashCode = 17;
138            
139            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
140            
141            hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0);
142            hashCode = 37 * hashCode + ((partyName != null) ? partyName.hashCode() : 0);
143            hashCode = 37 * hashCode + ((partyTypePK != null) ? partyTypePK.hashCode() : 0);
144            hashCode = 37 * hashCode + ((preferredLanguagePK != null) ? preferredLanguagePK.hashCode() : 0);
145            hashCode = 37 * hashCode + ((preferredCurrencyPK != null) ? preferredCurrencyPK.hashCode() : 0);
146            hashCode = 37 * hashCode + ((preferredTimeZonePK != null) ? preferredTimeZonePK.hashCode() : 0);
147            hashCode = 37 * hashCode + ((preferredDateTimeFormatPK != null) ? preferredDateTimeFormatPK.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    public String toString() {
159        if(_stringValue == null) {
160            _stringValue = "{" + 
161                    "entityId=" + getEntityId() +
162                    ", partyPK=" + getPartyPK() +
163                    ", partyName=" + getPartyName() +
164                    ", partyTypePK=" + getPartyTypePK() +
165                    ", preferredLanguagePK=" + getPreferredLanguagePK() +
166                    ", preferredCurrencyPK=" + getPreferredCurrencyPK() +
167                    ", preferredTimeZonePK=" + getPreferredTimeZonePK() +
168                    ", preferredDateTimeFormatPK=" + getPreferredDateTimeFormatPK() +
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  PartyDetailValue 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 PartyDetailValue that) {
203            boolean objectsEqual = true;
204            
205            
206            if(objectsEqual) {
207                PartyPK thisPartyPK = getPartyPK();
208                PartyPK thatPartyPK = that.getPartyPK();
209                
210                if(thisPartyPK == null) {
211                    objectsEqual = objectsEqual && (thatPartyPK == null);
212                } else {
213                    objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK);
214                }
215            }
216            
217            if(objectsEqual) {
218                String thisPartyName = getPartyName();
219                String thatPartyName = that.getPartyName();
220                
221                if(thisPartyName == null) {
222                    objectsEqual = objectsEqual && (thatPartyName == null);
223                } else {
224                    objectsEqual = objectsEqual && thisPartyName.equals(thatPartyName);
225                }
226            }
227            
228            if(objectsEqual) {
229                PartyTypePK thisPartyTypePK = getPartyTypePK();
230                PartyTypePK thatPartyTypePK = that.getPartyTypePK();
231                
232                if(thisPartyTypePK == null) {
233                    objectsEqual = objectsEqual && (thatPartyTypePK == null);
234                } else {
235                    objectsEqual = objectsEqual && thisPartyTypePK.equals(thatPartyTypePK);
236                }
237            }
238            
239            if(objectsEqual) {
240                LanguagePK thisPreferredLanguagePK = getPreferredLanguagePK();
241                LanguagePK thatPreferredLanguagePK = that.getPreferredLanguagePK();
242                
243                if(thisPreferredLanguagePK == null) {
244                    objectsEqual = objectsEqual && (thatPreferredLanguagePK == null);
245                } else {
246                    objectsEqual = objectsEqual && thisPreferredLanguagePK.equals(thatPreferredLanguagePK);
247                }
248            }
249            
250            if(objectsEqual) {
251                CurrencyPK thisPreferredCurrencyPK = getPreferredCurrencyPK();
252                CurrencyPK thatPreferredCurrencyPK = that.getPreferredCurrencyPK();
253                
254                if(thisPreferredCurrencyPK == null) {
255                    objectsEqual = objectsEqual && (thatPreferredCurrencyPK == null);
256                } else {
257                    objectsEqual = objectsEqual && thisPreferredCurrencyPK.equals(thatPreferredCurrencyPK);
258                }
259            }
260            
261            if(objectsEqual) {
262                TimeZonePK thisPreferredTimeZonePK = getPreferredTimeZonePK();
263                TimeZonePK thatPreferredTimeZonePK = that.getPreferredTimeZonePK();
264                
265                if(thisPreferredTimeZonePK == null) {
266                    objectsEqual = objectsEqual && (thatPreferredTimeZonePK == null);
267                } else {
268                    objectsEqual = objectsEqual && thisPreferredTimeZonePK.equals(thatPreferredTimeZonePK);
269                }
270            }
271            
272            if(objectsEqual) {
273                DateTimeFormatPK thisPreferredDateTimeFormatPK = getPreferredDateTimeFormatPK();
274                DateTimeFormatPK thatPreferredDateTimeFormatPK = that.getPreferredDateTimeFormatPK();
275                
276                if(thisPreferredDateTimeFormatPK == null) {
277                    objectsEqual = objectsEqual && (thatPreferredDateTimeFormatPK == null);
278                } else {
279                    objectsEqual = objectsEqual && thisPreferredDateTimeFormatPK.equals(thatPreferredDateTimeFormatPK);
280                }
281            }
282            
283            if(objectsEqual) {
284                Long thisFromTime = getFromTime();
285                Long thatFromTime = that.getFromTime();
286                
287                if(thisFromTime == null) {
288                    objectsEqual = objectsEqual && (thatFromTime == null);
289                } else {
290                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
291                }
292            }
293            
294            if(objectsEqual) {
295                Long thisThruTime = getThruTime();
296                Long thatThruTime = that.getThruTime();
297                
298                if(thisThruTime == null) {
299                    objectsEqual = objectsEqual && (thatThruTime == null);
300                } else {
301                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
302                }
303            }
304            
305            return objectsEqual;
306        } else {
307            return false;
308        }
309    }
310    
311    @Override
312    public boolean hasBeenModified() {
313        return partyPKHasBeenModified || partyNameHasBeenModified || partyTypePKHasBeenModified || preferredLanguagePKHasBeenModified || preferredCurrencyPKHasBeenModified || preferredTimeZonePKHasBeenModified || preferredDateTimeFormatPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
314    }
315    
316    @Override
317    public void clearHasBeenModified() {
318        partyPKHasBeenModified = false;
319        partyNameHasBeenModified = false;
320        partyTypePKHasBeenModified = false;
321        preferredLanguagePKHasBeenModified = false;
322        preferredCurrencyPKHasBeenModified = false;
323        preferredTimeZonePKHasBeenModified = false;
324        preferredDateTimeFormatPKHasBeenModified = false;
325        fromTimeHasBeenModified = false;
326        thruTimeHasBeenModified = false;
327    }
328    
329    public PartyPK getPartyPK() {
330        return partyPK;
331    }
332    
333    public void setPartyPK(PartyPK partyPK)
334            throws PersistenceNotNullException {
335        checkForNull(partyPK);
336        
337        boolean update = true;
338        
339        if(this.partyPK != null) {
340            if(this.partyPK.equals(partyPK)) {
341                update = false;
342            }
343        } else if(partyPK == null) {
344            update = false;
345        }
346        
347        if(update) {
348            this.partyPK = partyPK;
349            partyPKHasBeenModified = true;
350            clearHashAndString();
351        }
352    }
353    
354    public boolean getPartyPKHasBeenModified() {
355        return partyPKHasBeenModified;
356    }
357    
358    public String getPartyName() {
359        return partyName;
360    }
361    
362    public void setPartyName(String partyName)
363            throws PersistenceNotNullException {
364        checkForNull(partyName);
365        
366        boolean update = true;
367        
368        if(this.partyName != null) {
369            if(this.partyName.equals(partyName)) {
370                update = false;
371            }
372        } else if(partyName == null) {
373            update = false;
374        }
375        
376        if(update) {
377            this.partyName = partyName;
378            partyNameHasBeenModified = true;
379            clearHashAndString();
380        }
381    }
382    
383    public boolean getPartyNameHasBeenModified() {
384        return partyNameHasBeenModified;
385    }
386    
387    public PartyTypePK getPartyTypePK() {
388        return partyTypePK;
389    }
390    
391    public void setPartyTypePK(PartyTypePK partyTypePK)
392            throws PersistenceNotNullException {
393        checkForNull(partyTypePK);
394        
395        boolean update = true;
396        
397        if(this.partyTypePK != null) {
398            if(this.partyTypePK.equals(partyTypePK)) {
399                update = false;
400            }
401        } else if(partyTypePK == null) {
402            update = false;
403        }
404        
405        if(update) {
406            this.partyTypePK = partyTypePK;
407            partyTypePKHasBeenModified = true;
408            clearHashAndString();
409        }
410    }
411    
412    public boolean getPartyTypePKHasBeenModified() {
413        return partyTypePKHasBeenModified;
414    }
415    
416    public LanguagePK getPreferredLanguagePK() {
417        return preferredLanguagePK;
418    }
419    
420    public void setPreferredLanguagePK(LanguagePK preferredLanguagePK) {
421        boolean update = true;
422        
423        if(this.preferredLanguagePK != null) {
424            if(this.preferredLanguagePK.equals(preferredLanguagePK)) {
425                update = false;
426            }
427        } else if(preferredLanguagePK == null) {
428            update = false;
429        }
430        
431        if(update) {
432            this.preferredLanguagePK = preferredLanguagePK;
433            preferredLanguagePKHasBeenModified = true;
434            clearHashAndString();
435        }
436    }
437    
438    public boolean getPreferredLanguagePKHasBeenModified() {
439        return preferredLanguagePKHasBeenModified;
440    }
441    
442    public CurrencyPK getPreferredCurrencyPK() {
443        return preferredCurrencyPK;
444    }
445    
446    public void setPreferredCurrencyPK(CurrencyPK preferredCurrencyPK) {
447        boolean update = true;
448        
449        if(this.preferredCurrencyPK != null) {
450            if(this.preferredCurrencyPK.equals(preferredCurrencyPK)) {
451                update = false;
452            }
453        } else if(preferredCurrencyPK == null) {
454            update = false;
455        }
456        
457        if(update) {
458            this.preferredCurrencyPK = preferredCurrencyPK;
459            preferredCurrencyPKHasBeenModified = true;
460            clearHashAndString();
461        }
462    }
463    
464    public boolean getPreferredCurrencyPKHasBeenModified() {
465        return preferredCurrencyPKHasBeenModified;
466    }
467    
468    public TimeZonePK getPreferredTimeZonePK() {
469        return preferredTimeZonePK;
470    }
471    
472    public void setPreferredTimeZonePK(TimeZonePK preferredTimeZonePK) {
473        boolean update = true;
474        
475        if(this.preferredTimeZonePK != null) {
476            if(this.preferredTimeZonePK.equals(preferredTimeZonePK)) {
477                update = false;
478            }
479        } else if(preferredTimeZonePK == null) {
480            update = false;
481        }
482        
483        if(update) {
484            this.preferredTimeZonePK = preferredTimeZonePK;
485            preferredTimeZonePKHasBeenModified = true;
486            clearHashAndString();
487        }
488    }
489    
490    public boolean getPreferredTimeZonePKHasBeenModified() {
491        return preferredTimeZonePKHasBeenModified;
492    }
493    
494    public DateTimeFormatPK getPreferredDateTimeFormatPK() {
495        return preferredDateTimeFormatPK;
496    }
497    
498    public void setPreferredDateTimeFormatPK(DateTimeFormatPK preferredDateTimeFormatPK) {
499        boolean update = true;
500        
501        if(this.preferredDateTimeFormatPK != null) {
502            if(this.preferredDateTimeFormatPK.equals(preferredDateTimeFormatPK)) {
503                update = false;
504            }
505        } else if(preferredDateTimeFormatPK == null) {
506            update = false;
507        }
508        
509        if(update) {
510            this.preferredDateTimeFormatPK = preferredDateTimeFormatPK;
511            preferredDateTimeFormatPKHasBeenModified = true;
512            clearHashAndString();
513        }
514    }
515    
516    public boolean getPreferredDateTimeFormatPKHasBeenModified() {
517        return preferredDateTimeFormatPKHasBeenModified;
518    }
519    
520    public Long getFromTime() {
521        return fromTime;
522    }
523    
524    public void setFromTime(Long fromTime)
525            throws PersistenceNotNullException {
526        checkForNull(fromTime);
527        
528        boolean update = true;
529        
530        if(this.fromTime != null) {
531            if(this.fromTime.equals(fromTime)) {
532                update = false;
533            }
534        } else if(fromTime == null) {
535            update = false;
536        }
537        
538        if(update) {
539            this.fromTime = fromTime;
540            fromTimeHasBeenModified = true;
541            clearHashAndString();
542        }
543    }
544    
545    public boolean getFromTimeHasBeenModified() {
546        return fromTimeHasBeenModified;
547    }
548    
549    public Long getThruTime() {
550        return thruTime;
551    }
552    
553    public void setThruTime(Long thruTime)
554            throws PersistenceNotNullException {
555        checkForNull(thruTime);
556        
557        boolean update = true;
558        
559        if(this.thruTime != null) {
560            if(this.thruTime.equals(thruTime)) {
561                update = false;
562            }
563        } else if(thruTime == null) {
564            update = false;
565        }
566        
567        if(update) {
568            this.thruTime = thruTime;
569            thruTimeHasBeenModified = true;
570            clearHashAndString();
571        }
572    }
573    
574    public boolean getThruTimeHasBeenModified() {
575        return thruTimeHasBeenModified;
576    }
577    
578}