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 * 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            StringBuilder stringValue = new StringBuilder("{");
161            
162            stringValue.append("entityId=").append(getEntityId());
163            
164            stringValue.append(", clubPK=").append(getClubPK());
165            stringValue.append(", clubName=").append(getClubName());
166            stringValue.append(", subscriptionTypePK=").append(getSubscriptionTypePK());
167            stringValue.append(", clubPriceFilterPK=").append(getClubPriceFilterPK());
168            stringValue.append(", currencyPK=").append(getCurrencyPK());
169            stringValue.append(", isDefault=").append(getIsDefault());
170            stringValue.append(", sortOrder=").append(getSortOrder());
171            stringValue.append(", fromTime=").append(getFromTime());
172            stringValue.append(", thruTime=").append(getThruTime());
173            
174            stringValue.append('}');
175            
176            _stringValue = stringValue.toString();
177        }
178        return _stringValue;
179    }
180    
181    @Override
182    public boolean equals(Object other) {
183        if(this == other)
184            return true;
185        
186        if(!hasIdentity())
187            return false;
188        
189        if(other instanceof  ClubDetailValue) {
190            ClubDetailValue that = (ClubDetailValue)other;
191            
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 = 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) {
210            ClubDetailValue that = (ClubDetailValue)other;
211            boolean objectsEqual = true;
212            
213            
214            if(objectsEqual) {
215                ClubPK thisClubPK = getClubPK();
216                ClubPK thatClubPK = that.getClubPK();
217                
218                if(thisClubPK == null) {
219                    objectsEqual = objectsEqual && (thatClubPK == null);
220                } else {
221                    objectsEqual = objectsEqual && thisClubPK.equals(thatClubPK);
222                }
223            }
224            
225            if(objectsEqual) {
226                String thisClubName = getClubName();
227                String thatClubName = that.getClubName();
228                
229                if(thisClubName == null) {
230                    objectsEqual = objectsEqual && (thatClubName == null);
231                } else {
232                    objectsEqual = objectsEqual && thisClubName.equals(thatClubName);
233                }
234            }
235            
236            if(objectsEqual) {
237                SubscriptionTypePK thisSubscriptionTypePK = getSubscriptionTypePK();
238                SubscriptionTypePK thatSubscriptionTypePK = that.getSubscriptionTypePK();
239                
240                if(thisSubscriptionTypePK == null) {
241                    objectsEqual = objectsEqual && (thatSubscriptionTypePK == null);
242                } else {
243                    objectsEqual = objectsEqual && thisSubscriptionTypePK.equals(thatSubscriptionTypePK);
244                }
245            }
246            
247            if(objectsEqual) {
248                FilterPK thisClubPriceFilterPK = getClubPriceFilterPK();
249                FilterPK thatClubPriceFilterPK = that.getClubPriceFilterPK();
250                
251                if(thisClubPriceFilterPK == null) {
252                    objectsEqual = objectsEqual && (thatClubPriceFilterPK == null);
253                } else {
254                    objectsEqual = objectsEqual && thisClubPriceFilterPK.equals(thatClubPriceFilterPK);
255                }
256            }
257            
258            if(objectsEqual) {
259                CurrencyPK thisCurrencyPK = getCurrencyPK();
260                CurrencyPK thatCurrencyPK = that.getCurrencyPK();
261                
262                if(thisCurrencyPK == null) {
263                    objectsEqual = objectsEqual && (thatCurrencyPK == null);
264                } else {
265                    objectsEqual = objectsEqual && thisCurrencyPK.equals(thatCurrencyPK);
266                }
267            }
268            
269            if(objectsEqual) {
270                Boolean thisIsDefault = getIsDefault();
271                Boolean thatIsDefault = that.getIsDefault();
272                
273                if(thisIsDefault == null) {
274                    objectsEqual = objectsEqual && (thatIsDefault == null);
275                } else {
276                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
277                }
278            }
279            
280            if(objectsEqual) {
281                Integer thisSortOrder = getSortOrder();
282                Integer thatSortOrder = that.getSortOrder();
283                
284                if(thisSortOrder == null) {
285                    objectsEqual = objectsEqual && (thatSortOrder == null);
286                } else {
287                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
288                }
289            }
290            
291            if(objectsEqual) {
292                Long thisFromTime = getFromTime();
293                Long thatFromTime = that.getFromTime();
294                
295                if(thisFromTime == null) {
296                    objectsEqual = objectsEqual && (thatFromTime == null);
297                } else {
298                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
299                }
300            }
301            
302            if(objectsEqual) {
303                Long thisThruTime = getThruTime();
304                Long thatThruTime = that.getThruTime();
305                
306                if(thisThruTime == null) {
307                    objectsEqual = objectsEqual && (thatThruTime == null);
308                } else {
309                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
310                }
311            }
312            
313            return objectsEqual;
314        } else {
315            return false;
316        }
317    }
318    
319    @Override
320    public boolean hasBeenModified() {
321        return clubPKHasBeenModified || clubNameHasBeenModified || subscriptionTypePKHasBeenModified || clubPriceFilterPKHasBeenModified || currencyPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
322    }
323    
324    @Override
325    public void clearHasBeenModified() {
326        clubPKHasBeenModified = false;
327        clubNameHasBeenModified = false;
328        subscriptionTypePKHasBeenModified = false;
329        clubPriceFilterPKHasBeenModified = false;
330        currencyPKHasBeenModified = false;
331        isDefaultHasBeenModified = false;
332        sortOrderHasBeenModified = false;
333        fromTimeHasBeenModified = false;
334        thruTimeHasBeenModified = false;
335    }
336    
337    public ClubPK getClubPK() {
338        return clubPK;
339    }
340    
341    public void setClubPK(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    public String getClubName() {
367        return clubName;
368    }
369    
370    public void setClubName(String clubName)
371            throws PersistenceNotNullException {
372        checkForNull(clubName);
373        
374        boolean update = true;
375        
376        if(this.clubName != null) {
377            if(this.clubName.equals(clubName)) {
378                update = false;
379            }
380        } else if(clubName == null) {
381            update = false;
382        }
383        
384        if(update) {
385            this.clubName = clubName;
386            clubNameHasBeenModified = true;
387            clearHashAndString();
388        }
389    }
390    
391    public boolean getClubNameHasBeenModified() {
392        return clubNameHasBeenModified;
393    }
394    
395    public SubscriptionTypePK getSubscriptionTypePK() {
396        return subscriptionTypePK;
397    }
398    
399    public void setSubscriptionTypePK(SubscriptionTypePK subscriptionTypePK)
400            throws PersistenceNotNullException {
401        checkForNull(subscriptionTypePK);
402        
403        boolean update = true;
404        
405        if(this.subscriptionTypePK != null) {
406            if(this.subscriptionTypePK.equals(subscriptionTypePK)) {
407                update = false;
408            }
409        } else if(subscriptionTypePK == null) {
410            update = false;
411        }
412        
413        if(update) {
414            this.subscriptionTypePK = subscriptionTypePK;
415            subscriptionTypePKHasBeenModified = true;
416            clearHashAndString();
417        }
418    }
419    
420    public boolean getSubscriptionTypePKHasBeenModified() {
421        return subscriptionTypePKHasBeenModified;
422    }
423    
424    public FilterPK getClubPriceFilterPK() {
425        return clubPriceFilterPK;
426    }
427    
428    public void setClubPriceFilterPK(FilterPK clubPriceFilterPK) {
429        boolean update = true;
430        
431        if(this.clubPriceFilterPK != null) {
432            if(this.clubPriceFilterPK.equals(clubPriceFilterPK)) {
433                update = false;
434            }
435        } else if(clubPriceFilterPK == null) {
436            update = false;
437        }
438        
439        if(update) {
440            this.clubPriceFilterPK = clubPriceFilterPK;
441            clubPriceFilterPKHasBeenModified = true;
442            clearHashAndString();
443        }
444    }
445    
446    public boolean getClubPriceFilterPKHasBeenModified() {
447        return clubPriceFilterPKHasBeenModified;
448    }
449    
450    public CurrencyPK getCurrencyPK() {
451        return currencyPK;
452    }
453    
454    public void setCurrencyPK(CurrencyPK currencyPK) {
455        boolean update = true;
456        
457        if(this.currencyPK != null) {
458            if(this.currencyPK.equals(currencyPK)) {
459                update = false;
460            }
461        } else if(currencyPK == null) {
462            update = false;
463        }
464        
465        if(update) {
466            this.currencyPK = currencyPK;
467            currencyPKHasBeenModified = true;
468            clearHashAndString();
469        }
470    }
471    
472    public boolean getCurrencyPKHasBeenModified() {
473        return currencyPKHasBeenModified;
474    }
475    
476    public Boolean getIsDefault() {
477        return isDefault;
478    }
479    
480    public void setIsDefault(Boolean isDefault)
481            throws PersistenceNotNullException {
482        checkForNull(isDefault);
483        
484        boolean update = true;
485        
486        if(this.isDefault != null) {
487            if(this.isDefault.equals(isDefault)) {
488                update = false;
489            }
490        } else if(isDefault == null) {
491            update = false;
492        }
493        
494        if(update) {
495            this.isDefault = isDefault;
496            isDefaultHasBeenModified = true;
497            clearHashAndString();
498        }
499    }
500    
501    public boolean getIsDefaultHasBeenModified() {
502        return isDefaultHasBeenModified;
503    }
504    
505    public Integer getSortOrder() {
506        return sortOrder;
507    }
508    
509    public void setSortOrder(Integer sortOrder)
510            throws PersistenceNotNullException {
511        checkForNull(sortOrder);
512        
513        boolean update = true;
514        
515        if(this.sortOrder != null) {
516            if(this.sortOrder.equals(sortOrder)) {
517                update = false;
518            }
519        } else if(sortOrder == null) {
520            update = false;
521        }
522        
523        if(update) {
524            this.sortOrder = sortOrder;
525            sortOrderHasBeenModified = true;
526            clearHashAndString();
527        }
528    }
529    
530    public boolean getSortOrderHasBeenModified() {
531        return sortOrderHasBeenModified;
532    }
533    
534    public Long getFromTime() {
535        return fromTime;
536    }
537    
538    public void setFromTime(Long fromTime)
539            throws PersistenceNotNullException {
540        checkForNull(fromTime);
541        
542        boolean update = true;
543        
544        if(this.fromTime != null) {
545            if(this.fromTime.equals(fromTime)) {
546                update = false;
547            }
548        } else if(fromTime == null) {
549            update = false;
550        }
551        
552        if(update) {
553            this.fromTime = fromTime;
554            fromTimeHasBeenModified = true;
555            clearHashAndString();
556        }
557    }
558    
559    public boolean getFromTimeHasBeenModified() {
560        return fromTimeHasBeenModified;
561    }
562    
563    public Long getThruTime() {
564        return thruTime;
565    }
566    
567    public void setThruTime(Long thruTime)
568            throws PersistenceNotNullException {
569        checkForNull(thruTime);
570        
571        boolean update = true;
572        
573        if(this.thruTime != null) {
574            if(this.thruTime.equals(thruTime)) {
575                update = false;
576            }
577        } else if(thruTime == null) {
578            update = false;
579        }
580        
581        if(update) {
582            this.thruTime = thruTime;
583            thruTimeHasBeenModified = true;
584            clearHashAndString();
585        }
586    }
587    
588    public boolean getThruTimeHasBeenModified() {
589        return thruTimeHasBeenModified;
590    }
591    
592}