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