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