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 * 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
041public class ClubDetailValue
042        extends BaseValue<ClubDetailPK>
043        implements Cloneable, Serializable {
044    
045    private ClubPK clubPK;
046    private boolean clubPKHasBeenModified = false;
047    private String clubName;
048    private boolean clubNameHasBeenModified = false;
049    private SubscriptionTypePK subscriptionTypePK;
050    private boolean subscriptionTypePKHasBeenModified = false;
051    private FilterPK clubPriceFilterPK;
052    private boolean clubPriceFilterPKHasBeenModified = false;
053    private CurrencyPK currencyPK;
054    private boolean currencyPKHasBeenModified = false;
055    private Boolean isDefault;
056    private boolean isDefaultHasBeenModified = false;
057    private Integer sortOrder;
058    private boolean sortOrderHasBeenModified = 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(ClubPK clubPK, String clubName, SubscriptionTypePK subscriptionTypePK, FilterPK clubPriceFilterPK, CurrencyPK currencyPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
068            throws PersistenceNotNullException {
069        checkForNull(clubPK);
070        this.clubPK = clubPK;
071        checkForNull(clubName);
072        this.clubName = clubName;
073        checkForNull(subscriptionTypePK);
074        this.subscriptionTypePK = subscriptionTypePK;
075        this.clubPriceFilterPK = clubPriceFilterPK;
076        this.currencyPK = currencyPK;
077        checkForNull(isDefault);
078        this.isDefault = isDefault;
079        checkForNull(sortOrder);
080        this.sortOrder = sortOrder;
081        checkForNull(fromTime);
082        this.fromTime = fromTime;
083        checkForNull(thruTime);
084        this.thruTime = thruTime;
085    }
086    
087    /** Creates a new instance of ClubDetailValue */
088    public ClubDetailValue(ClubDetailPK clubDetailPK, ClubPK clubPK, String clubName, SubscriptionTypePK subscriptionTypePK, FilterPK clubPriceFilterPK, CurrencyPK currencyPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
089            throws PersistenceNotNullException {
090        super(clubDetailPK);
091        constructFields(clubPK, clubName, subscriptionTypePK, clubPriceFilterPK, currencyPK, isDefault, sortOrder, fromTime, thruTime);
092    }
093    
094    /** Creates a new instance of ClubDetailValue */
095    public ClubDetailValue(ClubPK clubPK, String clubName, SubscriptionTypePK subscriptionTypePK, FilterPK clubPriceFilterPK, CurrencyPK currencyPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
096            throws PersistenceNotNullException {
097        super();
098        constructFields(clubPK, clubName, subscriptionTypePK, clubPriceFilterPK, currencyPK, isDefault, sortOrder, fromTime, thruTime);
099    }
100    
101   @Override
102   public ClubDetailFactory getBaseFactoryInstance() {
103        return ClubDetailFactory.getInstance();
104    }
105    
106    @Override
107    public ClubDetailValue 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 (ClubDetailValue)result;
118    }
119    
120   @Override
121    public ClubDetailPK getPrimaryKey() {
122        if(_primaryKey == null) {
123            _primaryKey = new ClubDetailPK(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 + ((clubPK != null) ? clubPK.hashCode() : 0);
142            hashCode = 37 * hashCode + ((clubName != null) ? clubName.hashCode() : 0);
143            hashCode = 37 * hashCode + ((subscriptionTypePK != null) ? subscriptionTypePK.hashCode() : 0);
144            hashCode = 37 * hashCode + ((clubPriceFilterPK != null) ? clubPriceFilterPK.hashCode() : 0);
145            hashCode = 37 * hashCode + ((currencyPK != null) ? currencyPK.hashCode() : 0);
146            hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0);
147            hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.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                    ", clubPK=" + getClubPK() +
163                    ", clubName=" + getClubName() +
164                    ", subscriptionTypePK=" + getSubscriptionTypePK() +
165                    ", clubPriceFilterPK=" + getClubPriceFilterPK() +
166                    ", currencyPK=" + getCurrencyPK() +
167                    ", isDefault=" + getIsDefault() +
168                    ", sortOrder=" + getSortOrder() +
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  ClubDetailValue 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 ClubDetailValue that) {
203            boolean objectsEqual = true;
204            
205            
206            if(objectsEqual) {
207                ClubPK thisClubPK = getClubPK();
208                ClubPK thatClubPK = that.getClubPK();
209                
210                if(thisClubPK == null) {
211                    objectsEqual = objectsEqual && (thatClubPK == null);
212                } else {
213                    objectsEqual = objectsEqual && thisClubPK.equals(thatClubPK);
214                }
215            }
216            
217            if(objectsEqual) {
218                String thisClubName = getClubName();
219                String thatClubName = that.getClubName();
220                
221                if(thisClubName == null) {
222                    objectsEqual = objectsEqual && (thatClubName == null);
223                } else {
224                    objectsEqual = objectsEqual && thisClubName.equals(thatClubName);
225                }
226            }
227            
228            if(objectsEqual) {
229                SubscriptionTypePK thisSubscriptionTypePK = getSubscriptionTypePK();
230                SubscriptionTypePK thatSubscriptionTypePK = that.getSubscriptionTypePK();
231                
232                if(thisSubscriptionTypePK == null) {
233                    objectsEqual = objectsEqual && (thatSubscriptionTypePK == null);
234                } else {
235                    objectsEqual = objectsEqual && thisSubscriptionTypePK.equals(thatSubscriptionTypePK);
236                }
237            }
238            
239            if(objectsEqual) {
240                FilterPK thisClubPriceFilterPK = getClubPriceFilterPK();
241                FilterPK thatClubPriceFilterPK = that.getClubPriceFilterPK();
242                
243                if(thisClubPriceFilterPK == null) {
244                    objectsEqual = objectsEqual && (thatClubPriceFilterPK == null);
245                } else {
246                    objectsEqual = objectsEqual && thisClubPriceFilterPK.equals(thatClubPriceFilterPK);
247                }
248            }
249            
250            if(objectsEqual) {
251                CurrencyPK thisCurrencyPK = getCurrencyPK();
252                CurrencyPK thatCurrencyPK = that.getCurrencyPK();
253                
254                if(thisCurrencyPK == null) {
255                    objectsEqual = objectsEqual && (thatCurrencyPK == null);
256                } else {
257                    objectsEqual = objectsEqual && thisCurrencyPK.equals(thatCurrencyPK);
258                }
259            }
260            
261            if(objectsEqual) {
262                Boolean thisIsDefault = getIsDefault();
263                Boolean thatIsDefault = that.getIsDefault();
264                
265                if(thisIsDefault == null) {
266                    objectsEqual = objectsEqual && (thatIsDefault == null);
267                } else {
268                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
269                }
270            }
271            
272            if(objectsEqual) {
273                Integer thisSortOrder = getSortOrder();
274                Integer thatSortOrder = that.getSortOrder();
275                
276                if(thisSortOrder == null) {
277                    objectsEqual = objectsEqual && (thatSortOrder == null);
278                } else {
279                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
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 clubPKHasBeenModified || clubNameHasBeenModified || subscriptionTypePKHasBeenModified || clubPriceFilterPKHasBeenModified || currencyPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
314    }
315    
316    @Override
317    public void clearHasBeenModified() {
318        clubPKHasBeenModified = false;
319        clubNameHasBeenModified = false;
320        subscriptionTypePKHasBeenModified = false;
321        clubPriceFilterPKHasBeenModified = false;
322        currencyPKHasBeenModified = false;
323        isDefaultHasBeenModified = false;
324        sortOrderHasBeenModified = false;
325        fromTimeHasBeenModified = false;
326        thruTimeHasBeenModified = false;
327    }
328    
329    public ClubPK getClubPK() {
330        return clubPK;
331    }
332    
333    public void setClubPK(ClubPK clubPK)
334            throws PersistenceNotNullException {
335        checkForNull(clubPK);
336        
337        boolean update = true;
338        
339        if(this.clubPK != null) {
340            if(this.clubPK.equals(clubPK)) {
341                update = false;
342            }
343        } else if(clubPK == null) {
344            update = false;
345        }
346        
347        if(update) {
348            this.clubPK = clubPK;
349            clubPKHasBeenModified = true;
350            clearHashAndString();
351        }
352    }
353    
354    public boolean getClubPKHasBeenModified() {
355        return clubPKHasBeenModified;
356    }
357    
358    public String getClubName() {
359        return clubName;
360    }
361    
362    public void setClubName(String clubName)
363            throws PersistenceNotNullException {
364        checkForNull(clubName);
365        
366        boolean update = true;
367        
368        if(this.clubName != null) {
369            if(this.clubName.equals(clubName)) {
370                update = false;
371            }
372        } else if(clubName == null) {
373            update = false;
374        }
375        
376        if(update) {
377            this.clubName = clubName;
378            clubNameHasBeenModified = true;
379            clearHashAndString();
380        }
381    }
382    
383    public boolean getClubNameHasBeenModified() {
384        return clubNameHasBeenModified;
385    }
386    
387    public SubscriptionTypePK getSubscriptionTypePK() {
388        return subscriptionTypePK;
389    }
390    
391    public void setSubscriptionTypePK(SubscriptionTypePK subscriptionTypePK)
392            throws PersistenceNotNullException {
393        checkForNull(subscriptionTypePK);
394        
395        boolean update = true;
396        
397        if(this.subscriptionTypePK != null) {
398            if(this.subscriptionTypePK.equals(subscriptionTypePK)) {
399                update = false;
400            }
401        } else if(subscriptionTypePK == null) {
402            update = false;
403        }
404        
405        if(update) {
406            this.subscriptionTypePK = subscriptionTypePK;
407            subscriptionTypePKHasBeenModified = true;
408            clearHashAndString();
409        }
410    }
411    
412    public boolean getSubscriptionTypePKHasBeenModified() {
413        return subscriptionTypePKHasBeenModified;
414    }
415    
416    public FilterPK getClubPriceFilterPK() {
417        return clubPriceFilterPK;
418    }
419    
420    public void setClubPriceFilterPK(FilterPK clubPriceFilterPK) {
421        boolean update = true;
422        
423        if(this.clubPriceFilterPK != null) {
424            if(this.clubPriceFilterPK.equals(clubPriceFilterPK)) {
425                update = false;
426            }
427        } else if(clubPriceFilterPK == null) {
428            update = false;
429        }
430        
431        if(update) {
432            this.clubPriceFilterPK = clubPriceFilterPK;
433            clubPriceFilterPKHasBeenModified = true;
434            clearHashAndString();
435        }
436    }
437    
438    public boolean getClubPriceFilterPKHasBeenModified() {
439        return clubPriceFilterPKHasBeenModified;
440    }
441    
442    public CurrencyPK getCurrencyPK() {
443        return currencyPK;
444    }
445    
446    public void setCurrencyPK(CurrencyPK currencyPK) {
447        boolean update = true;
448        
449        if(this.currencyPK != null) {
450            if(this.currencyPK.equals(currencyPK)) {
451                update = false;
452            }
453        } else if(currencyPK == null) {
454            update = false;
455        }
456        
457        if(update) {
458            this.currencyPK = currencyPK;
459            currencyPKHasBeenModified = true;
460            clearHashAndString();
461        }
462    }
463    
464    public boolean getCurrencyPKHasBeenModified() {
465        return currencyPKHasBeenModified;
466    }
467    
468    public Boolean getIsDefault() {
469        return isDefault;
470    }
471    
472    public void setIsDefault(Boolean isDefault)
473            throws PersistenceNotNullException {
474        checkForNull(isDefault);
475        
476        boolean update = true;
477        
478        if(this.isDefault != null) {
479            if(this.isDefault.equals(isDefault)) {
480                update = false;
481            }
482        } else if(isDefault == null) {
483            update = false;
484        }
485        
486        if(update) {
487            this.isDefault = isDefault;
488            isDefaultHasBeenModified = true;
489            clearHashAndString();
490        }
491    }
492    
493    public boolean getIsDefaultHasBeenModified() {
494        return isDefaultHasBeenModified;
495    }
496    
497    public Integer getSortOrder() {
498        return sortOrder;
499    }
500    
501    public void setSortOrder(Integer sortOrder)
502            throws PersistenceNotNullException {
503        checkForNull(sortOrder);
504        
505        boolean update = true;
506        
507        if(this.sortOrder != null) {
508            if(this.sortOrder.equals(sortOrder)) {
509                update = false;
510            }
511        } else if(sortOrder == null) {
512            update = false;
513        }
514        
515        if(update) {
516            this.sortOrder = sortOrder;
517            sortOrderHasBeenModified = true;
518            clearHashAndString();
519        }
520    }
521    
522    public boolean getSortOrderHasBeenModified() {
523        return sortOrderHasBeenModified;
524    }
525    
526    public Long getFromTime() {
527        return fromTime;
528    }
529    
530    public void setFromTime(Long fromTime)
531            throws PersistenceNotNullException {
532        checkForNull(fromTime);
533        
534        boolean update = true;
535        
536        if(this.fromTime != null) {
537            if(this.fromTime.equals(fromTime)) {
538                update = false;
539            }
540        } else if(fromTime == null) {
541            update = false;
542        }
543        
544        if(update) {
545            this.fromTime = fromTime;
546            fromTimeHasBeenModified = true;
547            clearHashAndString();
548        }
549    }
550    
551    public boolean getFromTimeHasBeenModified() {
552        return fromTimeHasBeenModified;
553    }
554    
555    public Long getThruTime() {
556        return thruTime;
557    }
558    
559    public void setThruTime(Long thruTime)
560            throws PersistenceNotNullException {
561        checkForNull(thruTime);
562        
563        boolean update = true;
564        
565        if(this.thruTime != null) {
566            if(this.thruTime.equals(thruTime)) {
567                update = false;
568            }
569        } else if(thruTime == null) {
570            update = false;
571        }
572        
573        if(update) {
574            this.thruTime = thruTime;
575            thruTimeHasBeenModified = true;
576            clearHashAndString();
577        }
578    }
579    
580    public boolean getThruTimeHasBeenModified() {
581        return thruTimeHasBeenModified;
582    }
583    
584}