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 * 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            StringBuilder stringValue = new StringBuilder("{");
166            
167            stringValue.append("entityId=").append(getEntityId());
168            
169            stringValue.append(", partyPaymentMethodPK=").append(getPartyPaymentMethodPK());
170            stringValue.append(", partyPaymentMethodName=").append(getPartyPaymentMethodName());
171            stringValue.append(", partyPK=").append(getPartyPK());
172            stringValue.append(", description=").append(getDescription());
173            stringValue.append(", paymentMethodPK=").append(getPaymentMethodPK());
174            stringValue.append(", deleteWhenUnused=").append(getDeleteWhenUnused());
175            stringValue.append(", isDefault=").append(getIsDefault());
176            stringValue.append(", sortOrder=").append(getSortOrder());
177            stringValue.append(", fromTime=").append(getFromTime());
178            stringValue.append(", thruTime=").append(getThruTime());
179            
180            stringValue.append('}');
181            
182            _stringValue = stringValue.toString();
183        }
184        return _stringValue;
185    }
186    
187    @Override
188    public boolean equals(Object other) {
189        if(this == other)
190            return true;
191        
192        if(!hasIdentity())
193            return false;
194        
195        if(other instanceof  PartyPaymentMethodDetailValue) {
196            PartyPaymentMethodDetailValue that = (PartyPaymentMethodDetailValue)other;
197            
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 = 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) {
216            PartyPaymentMethodDetailValue that = (PartyPaymentMethodDetailValue)other;
217            boolean objectsEqual = true;
218            
219            
220            if(objectsEqual) {
221                PartyPaymentMethodPK thisPartyPaymentMethodPK = getPartyPaymentMethodPK();
222                PartyPaymentMethodPK thatPartyPaymentMethodPK = that.getPartyPaymentMethodPK();
223                
224                if(thisPartyPaymentMethodPK == null) {
225                    objectsEqual = objectsEqual && (thatPartyPaymentMethodPK == null);
226                } else {
227                    objectsEqual = objectsEqual && thisPartyPaymentMethodPK.equals(thatPartyPaymentMethodPK);
228                }
229            }
230            
231            if(objectsEqual) {
232                String thisPartyPaymentMethodName = getPartyPaymentMethodName();
233                String thatPartyPaymentMethodName = that.getPartyPaymentMethodName();
234                
235                if(thisPartyPaymentMethodName == null) {
236                    objectsEqual = objectsEqual && (thatPartyPaymentMethodName == null);
237                } else {
238                    objectsEqual = objectsEqual && thisPartyPaymentMethodName.equals(thatPartyPaymentMethodName);
239                }
240            }
241            
242            if(objectsEqual) {
243                PartyPK thisPartyPK = getPartyPK();
244                PartyPK thatPartyPK = that.getPartyPK();
245                
246                if(thisPartyPK == null) {
247                    objectsEqual = objectsEqual && (thatPartyPK == null);
248                } else {
249                    objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK);
250                }
251            }
252            
253            if(objectsEqual) {
254                String thisDescription = getDescription();
255                String thatDescription = that.getDescription();
256                
257                if(thisDescription == null) {
258                    objectsEqual = objectsEqual && (thatDescription == null);
259                } else {
260                    objectsEqual = objectsEqual && thisDescription.equals(thatDescription);
261                }
262            }
263            
264            if(objectsEqual) {
265                PaymentMethodPK thisPaymentMethodPK = getPaymentMethodPK();
266                PaymentMethodPK thatPaymentMethodPK = that.getPaymentMethodPK();
267                
268                if(thisPaymentMethodPK == null) {
269                    objectsEqual = objectsEqual && (thatPaymentMethodPK == null);
270                } else {
271                    objectsEqual = objectsEqual && thisPaymentMethodPK.equals(thatPaymentMethodPK);
272                }
273            }
274            
275            if(objectsEqual) {
276                Boolean thisDeleteWhenUnused = getDeleteWhenUnused();
277                Boolean thatDeleteWhenUnused = that.getDeleteWhenUnused();
278                
279                if(thisDeleteWhenUnused == null) {
280                    objectsEqual = objectsEqual && (thatDeleteWhenUnused == null);
281                } else {
282                    objectsEqual = objectsEqual && thisDeleteWhenUnused.equals(thatDeleteWhenUnused);
283                }
284            }
285            
286            if(objectsEqual) {
287                Boolean thisIsDefault = getIsDefault();
288                Boolean thatIsDefault = that.getIsDefault();
289                
290                if(thisIsDefault == null) {
291                    objectsEqual = objectsEqual && (thatIsDefault == null);
292                } else {
293                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
294                }
295            }
296            
297            if(objectsEqual) {
298                Integer thisSortOrder = getSortOrder();
299                Integer thatSortOrder = that.getSortOrder();
300                
301                if(thisSortOrder == null) {
302                    objectsEqual = objectsEqual && (thatSortOrder == null);
303                } else {
304                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
305                }
306            }
307            
308            if(objectsEqual) {
309                Long thisFromTime = getFromTime();
310                Long thatFromTime = that.getFromTime();
311                
312                if(thisFromTime == null) {
313                    objectsEqual = objectsEqual && (thatFromTime == null);
314                } else {
315                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
316                }
317            }
318            
319            if(objectsEqual) {
320                Long thisThruTime = getThruTime();
321                Long thatThruTime = that.getThruTime();
322                
323                if(thisThruTime == null) {
324                    objectsEqual = objectsEqual && (thatThruTime == null);
325                } else {
326                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
327                }
328            }
329            
330            return objectsEqual;
331        } else {
332            return false;
333        }
334    }
335    
336    @Override
337    public boolean hasBeenModified() {
338        return partyPaymentMethodPKHasBeenModified || partyPaymentMethodNameHasBeenModified || partyPKHasBeenModified || descriptionHasBeenModified || paymentMethodPKHasBeenModified || deleteWhenUnusedHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
339    }
340    
341    @Override
342    public void clearHasBeenModified() {
343        partyPaymentMethodPKHasBeenModified = false;
344        partyPaymentMethodNameHasBeenModified = false;
345        partyPKHasBeenModified = false;
346        descriptionHasBeenModified = false;
347        paymentMethodPKHasBeenModified = false;
348        deleteWhenUnusedHasBeenModified = false;
349        isDefaultHasBeenModified = false;
350        sortOrderHasBeenModified = false;
351        fromTimeHasBeenModified = false;
352        thruTimeHasBeenModified = false;
353    }
354    
355    public PartyPaymentMethodPK getPartyPaymentMethodPK() {
356        return partyPaymentMethodPK;
357    }
358    
359    public void setPartyPaymentMethodPK(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    public String getPartyPaymentMethodName() {
385        return partyPaymentMethodName;
386    }
387    
388    public void setPartyPaymentMethodName(String partyPaymentMethodName)
389            throws PersistenceNotNullException {
390        checkForNull(partyPaymentMethodName);
391        
392        boolean update = true;
393        
394        if(this.partyPaymentMethodName != null) {
395            if(this.partyPaymentMethodName.equals(partyPaymentMethodName)) {
396                update = false;
397            }
398        } else if(partyPaymentMethodName == null) {
399            update = false;
400        }
401        
402        if(update) {
403            this.partyPaymentMethodName = partyPaymentMethodName;
404            partyPaymentMethodNameHasBeenModified = true;
405            clearHashAndString();
406        }
407    }
408    
409    public boolean getPartyPaymentMethodNameHasBeenModified() {
410        return partyPaymentMethodNameHasBeenModified;
411    }
412    
413    public PartyPK getPartyPK() {
414        return partyPK;
415    }
416    
417    public void setPartyPK(PartyPK partyPK)
418            throws PersistenceNotNullException {
419        checkForNull(partyPK);
420        
421        boolean update = true;
422        
423        if(this.partyPK != null) {
424            if(this.partyPK.equals(partyPK)) {
425                update = false;
426            }
427        } else if(partyPK == null) {
428            update = false;
429        }
430        
431        if(update) {
432            this.partyPK = partyPK;
433            partyPKHasBeenModified = true;
434            clearHashAndString();
435        }
436    }
437    
438    public boolean getPartyPKHasBeenModified() {
439        return partyPKHasBeenModified;
440    }
441    
442    public String getDescription() {
443        return description;
444    }
445    
446    public void setDescription(String description) {
447        boolean update = true;
448        
449        if(this.description != null) {
450            if(this.description.equals(description)) {
451                update = false;
452            }
453        } else if(description == null) {
454            update = false;
455        }
456        
457        if(update) {
458            this.description = description;
459            descriptionHasBeenModified = true;
460            clearHashAndString();
461        }
462    }
463    
464    public boolean getDescriptionHasBeenModified() {
465        return descriptionHasBeenModified;
466    }
467    
468    public PaymentMethodPK getPaymentMethodPK() {
469        return paymentMethodPK;
470    }
471    
472    public void setPaymentMethodPK(PaymentMethodPK paymentMethodPK)
473            throws PersistenceNotNullException {
474        checkForNull(paymentMethodPK);
475        
476        boolean update = true;
477        
478        if(this.paymentMethodPK != null) {
479            if(this.paymentMethodPK.equals(paymentMethodPK)) {
480                update = false;
481            }
482        } else if(paymentMethodPK == null) {
483            update = false;
484        }
485        
486        if(update) {
487            this.paymentMethodPK = paymentMethodPK;
488            paymentMethodPKHasBeenModified = true;
489            clearHashAndString();
490        }
491    }
492    
493    public boolean getPaymentMethodPKHasBeenModified() {
494        return paymentMethodPKHasBeenModified;
495    }
496    
497    public Boolean getDeleteWhenUnused() {
498        return deleteWhenUnused;
499    }
500    
501    public void setDeleteWhenUnused(Boolean deleteWhenUnused)
502            throws PersistenceNotNullException {
503        checkForNull(deleteWhenUnused);
504        
505        boolean update = true;
506        
507        if(this.deleteWhenUnused != null) {
508            if(this.deleteWhenUnused.equals(deleteWhenUnused)) {
509                update = false;
510            }
511        } else if(deleteWhenUnused == null) {
512            update = false;
513        }
514        
515        if(update) {
516            this.deleteWhenUnused = deleteWhenUnused;
517            deleteWhenUnusedHasBeenModified = true;
518            clearHashAndString();
519        }
520    }
521    
522    public boolean getDeleteWhenUnusedHasBeenModified() {
523        return deleteWhenUnusedHasBeenModified;
524    }
525    
526    public Boolean getIsDefault() {
527        return isDefault;
528    }
529    
530    public void setIsDefault(Boolean isDefault)
531            throws PersistenceNotNullException {
532        checkForNull(isDefault);
533        
534        boolean update = true;
535        
536        if(this.isDefault != null) {
537            if(this.isDefault.equals(isDefault)) {
538                update = false;
539            }
540        } else if(isDefault == null) {
541            update = false;
542        }
543        
544        if(update) {
545            this.isDefault = isDefault;
546            isDefaultHasBeenModified = true;
547            clearHashAndString();
548        }
549    }
550    
551    public boolean getIsDefaultHasBeenModified() {
552        return isDefaultHasBeenModified;
553    }
554    
555    public Integer getSortOrder() {
556        return sortOrder;
557    }
558    
559    public void setSortOrder(Integer sortOrder)
560            throws PersistenceNotNullException {
561        checkForNull(sortOrder);
562        
563        boolean update = true;
564        
565        if(this.sortOrder != null) {
566            if(this.sortOrder.equals(sortOrder)) {
567                update = false;
568            }
569        } else if(sortOrder == null) {
570            update = false;
571        }
572        
573        if(update) {
574            this.sortOrder = sortOrder;
575            sortOrderHasBeenModified = true;
576            clearHashAndString();
577        }
578    }
579    
580    public boolean getSortOrderHasBeenModified() {
581        return sortOrderHasBeenModified;
582    }
583    
584    public Long getFromTime() {
585        return fromTime;
586    }
587    
588    public void setFromTime(Long fromTime)
589            throws PersistenceNotNullException {
590        checkForNull(fromTime);
591        
592        boolean update = true;
593        
594        if(this.fromTime != null) {
595            if(this.fromTime.equals(fromTime)) {
596                update = false;
597            }
598        } else if(fromTime == null) {
599            update = false;
600        }
601        
602        if(update) {
603            this.fromTime = fromTime;
604            fromTimeHasBeenModified = true;
605            clearHashAndString();
606        }
607    }
608    
609    public boolean getFromTimeHasBeenModified() {
610        return fromTimeHasBeenModified;
611    }
612    
613    public Long getThruTime() {
614        return thruTime;
615    }
616    
617    public void setThruTime(Long thruTime)
618            throws PersistenceNotNullException {
619        checkForNull(thruTime);
620        
621        boolean update = true;
622        
623        if(this.thruTime != null) {
624            if(this.thruTime.equals(thruTime)) {
625                update = false;
626            }
627        } else if(thruTime == null) {
628            update = false;
629        }
630        
631        if(update) {
632            this.thruTime = thruTime;
633            thruTimeHasBeenModified = true;
634            clearHashAndString();
635        }
636    }
637    
638    public boolean getThruTimeHasBeenModified() {
639        return thruTimeHasBeenModified;
640    }
641    
642}