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