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