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 * PartyCarrierAccountDetailValue.java
021 */
022
023package com.echothree.model.data.carrier.server.value;
024
025import com.echothree.model.data.carrier.common.pk.PartyCarrierAccountDetailPK;
026
027import com.echothree.model.data.carrier.server.factory.PartyCarrierAccountDetailFactory;
028
029import com.echothree.model.data.carrier.common.pk.PartyCarrierAccountPK;
030import com.echothree.model.data.party.common.pk.PartyPK;
031
032import com.echothree.util.common.exception.PersistenceCloneException;
033import com.echothree.util.common.exception.PersistenceNotNullException;
034
035import com.echothree.util.server.persistence.BaseValue;
036
037import java.io.Serializable;
038
039import javax.annotation.Nonnull;
040import javax.annotation.Nullable;
041
042public class PartyCarrierAccountDetailValue
043        extends BaseValue<PartyCarrierAccountDetailPK>
044        implements Cloneable, Serializable {
045    
046    private PartyCarrierAccountPK partyCarrierAccountPK;
047    private boolean partyCarrierAccountPKHasBeenModified = false;
048    private PartyPK partyPK;
049    private boolean partyPKHasBeenModified = false;
050    private PartyPK carrierPartyPK;
051    private boolean carrierPartyPKHasBeenModified = false;
052    private String account;
053    private boolean accountHasBeenModified = false;
054    private Boolean alwaysUseThirdPartyBilling;
055    private boolean alwaysUseThirdPartyBillingHasBeenModified = false;
056    private Long fromTime;
057    private boolean fromTimeHasBeenModified = false;
058    private Long thruTime;
059    private boolean thruTimeHasBeenModified = false;
060    
061    private transient Integer _hashCode = null;
062    private transient String _stringValue = null;
063    
064    private void constructFields(PartyCarrierAccountPK partyCarrierAccountPK, PartyPK partyPK, PartyPK carrierPartyPK, String account, Boolean alwaysUseThirdPartyBilling, Long fromTime, Long thruTime)
065            throws PersistenceNotNullException {
066        checkForNull(partyCarrierAccountPK);
067        this.partyCarrierAccountPK = partyCarrierAccountPK;
068        checkForNull(partyPK);
069        this.partyPK = partyPK;
070        checkForNull(carrierPartyPK);
071        this.carrierPartyPK = carrierPartyPK;
072        checkForNull(account);
073        this.account = account;
074        checkForNull(alwaysUseThirdPartyBilling);
075        this.alwaysUseThirdPartyBilling = alwaysUseThirdPartyBilling;
076        checkForNull(fromTime);
077        this.fromTime = fromTime;
078        checkForNull(thruTime);
079        this.thruTime = thruTime;
080    }
081    
082    /** Creates a new instance of PartyCarrierAccountDetailValue */
083    public PartyCarrierAccountDetailValue(PartyCarrierAccountDetailPK partyCarrierAccountDetailPK, PartyCarrierAccountPK partyCarrierAccountPK, PartyPK partyPK, PartyPK carrierPartyPK, String account, Boolean alwaysUseThirdPartyBilling, Long fromTime, Long thruTime)
084            throws PersistenceNotNullException {
085        super(partyCarrierAccountDetailPK);
086        constructFields(partyCarrierAccountPK, partyPK, carrierPartyPK, account, alwaysUseThirdPartyBilling, fromTime, thruTime);
087    }
088    
089    /** Creates a new instance of PartyCarrierAccountDetailValue */
090    public PartyCarrierAccountDetailValue(PartyCarrierAccountPK partyCarrierAccountPK, PartyPK partyPK, PartyPK carrierPartyPK, String account, Boolean alwaysUseThirdPartyBilling, Long fromTime, Long thruTime)
091            throws PersistenceNotNullException {
092        super();
093        constructFields(partyCarrierAccountPK, partyPK, carrierPartyPK, account, alwaysUseThirdPartyBilling, fromTime, thruTime);
094    }
095    
096    @Override
097    @Nonnull
098    public PartyCarrierAccountDetailFactory getBaseFactoryInstance() {
099        return PartyCarrierAccountDetailFactory.getInstance();
100    }
101    
102    @Override
103    @Nonnull
104    public PartyCarrierAccountDetailValue clone() {
105        Object result;
106        
107        try {
108            result = super.clone();
109        } catch (CloneNotSupportedException cnse) {
110            // This shouldn't happen, fail when it does.
111            throw new PersistenceCloneException(cnse);
112        }
113        
114        return (PartyCarrierAccountDetailValue)result;
115    }
116    
117    @Override
118    @Nonnull
119    public PartyCarrierAccountDetailPK getPrimaryKey() {
120        if(_primaryKey == null) {
121            _primaryKey = new PartyCarrierAccountDetailPK(entityId);
122        }
123        
124        return _primaryKey;
125    }
126    
127    private void clearHashAndString() {
128        _hashCode = null;
129        _stringValue = null;
130    }
131    
132    @Override
133    public int hashCode() {
134        if(_hashCode == null) {
135            int hashCode = 17;
136            
137            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
138            
139            hashCode = 37 * hashCode + ((partyCarrierAccountPK != null) ? partyCarrierAccountPK.hashCode() : 0);
140            hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0);
141            hashCode = 37 * hashCode + ((carrierPartyPK != null) ? carrierPartyPK.hashCode() : 0);
142            hashCode = 37 * hashCode + ((account != null) ? account.hashCode() : 0);
143            hashCode = 37 * hashCode + ((alwaysUseThirdPartyBilling != null) ? alwaysUseThirdPartyBilling.hashCode() : 0);
144            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
145            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
146            
147            _hashCode = hashCode;
148        }
149        
150        return _hashCode;
151    }
152    
153    @Override
154    @Nonnull
155    public String toString() {
156        if(_stringValue == null) {
157            _stringValue = "{" + 
158                    "entityId=" + getEntityId() +
159                    ", partyCarrierAccountPK=" + getPartyCarrierAccountPK() +
160                    ", partyPK=" + getPartyPK() +
161                    ", carrierPartyPK=" + getCarrierPartyPK() +
162                    ", account=" + getAccount() +
163                    ", alwaysUseThirdPartyBilling=" + getAlwaysUseThirdPartyBilling() +
164                    ", fromTime=" + getFromTime() +
165                    ", thruTime=" + getThruTime() +
166                    "}";
167        }
168        return _stringValue;
169    }
170    
171    @Override
172    public boolean equals(Object other) {
173        if(this == other)
174            return true;
175        
176        if(!hasIdentity())
177            return false;
178        
179        if(other instanceof  PartyCarrierAccountDetailValue that) {
180            if(!that.hasIdentity())
181                return false;
182            
183            Long thisEntityId = getEntityId();
184            Long thatEntityId = that.getEntityId();
185            
186            boolean objectsEqual = thisEntityId.equals(thatEntityId);
187            if(objectsEqual)
188                objectsEqual = isIdentical(that);
189            
190            return objectsEqual;
191        } else {
192            return false;
193        }
194    }
195    
196    public boolean isIdentical(Object other) {
197        if(other instanceof PartyCarrierAccountDetailValue that) {
198            boolean objectsEqual = true;
199            
200            
201            if(objectsEqual) {
202                PartyCarrierAccountPK thisPartyCarrierAccountPK = getPartyCarrierAccountPK();
203                PartyCarrierAccountPK thatPartyCarrierAccountPK = that.getPartyCarrierAccountPK();
204                
205                if(thisPartyCarrierAccountPK == null) {
206                    objectsEqual = objectsEqual && (thatPartyCarrierAccountPK == null);
207                } else {
208                    objectsEqual = objectsEqual && thisPartyCarrierAccountPK.equals(thatPartyCarrierAccountPK);
209                }
210            }
211            
212            if(objectsEqual) {
213                PartyPK thisPartyPK = getPartyPK();
214                PartyPK thatPartyPK = that.getPartyPK();
215                
216                if(thisPartyPK == null) {
217                    objectsEqual = objectsEqual && (thatPartyPK == null);
218                } else {
219                    objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK);
220                }
221            }
222            
223            if(objectsEqual) {
224                PartyPK thisCarrierPartyPK = getCarrierPartyPK();
225                PartyPK thatCarrierPartyPK = that.getCarrierPartyPK();
226                
227                if(thisCarrierPartyPK == null) {
228                    objectsEqual = objectsEqual && (thatCarrierPartyPK == null);
229                } else {
230                    objectsEqual = objectsEqual && thisCarrierPartyPK.equals(thatCarrierPartyPK);
231                }
232            }
233            
234            if(objectsEqual) {
235                String thisAccount = getAccount();
236                String thatAccount = that.getAccount();
237                
238                if(thisAccount == null) {
239                    objectsEqual = objectsEqual && (thatAccount == null);
240                } else {
241                    objectsEqual = objectsEqual && thisAccount.equals(thatAccount);
242                }
243            }
244            
245            if(objectsEqual) {
246                Boolean thisAlwaysUseThirdPartyBilling = getAlwaysUseThirdPartyBilling();
247                Boolean thatAlwaysUseThirdPartyBilling = that.getAlwaysUseThirdPartyBilling();
248                
249                if(thisAlwaysUseThirdPartyBilling == null) {
250                    objectsEqual = objectsEqual && (thatAlwaysUseThirdPartyBilling == null);
251                } else {
252                    objectsEqual = objectsEqual && thisAlwaysUseThirdPartyBilling.equals(thatAlwaysUseThirdPartyBilling);
253                }
254            }
255            
256            if(objectsEqual) {
257                Long thisFromTime = getFromTime();
258                Long thatFromTime = that.getFromTime();
259                
260                if(thisFromTime == null) {
261                    objectsEqual = objectsEqual && (thatFromTime == null);
262                } else {
263                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
264                }
265            }
266            
267            if(objectsEqual) {
268                Long thisThruTime = getThruTime();
269                Long thatThruTime = that.getThruTime();
270                
271                if(thisThruTime == null) {
272                    objectsEqual = objectsEqual && (thatThruTime == null);
273                } else {
274                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
275                }
276            }
277            
278            return objectsEqual;
279        } else {
280            return false;
281        }
282    }
283    
284    @Override
285    public boolean hasBeenModified() {
286        return partyCarrierAccountPKHasBeenModified || partyPKHasBeenModified || carrierPartyPKHasBeenModified || accountHasBeenModified || alwaysUseThirdPartyBillingHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
287    }
288    
289    @Override
290    public void clearHasBeenModified() {
291        partyCarrierAccountPKHasBeenModified = false;
292        partyPKHasBeenModified = false;
293        carrierPartyPKHasBeenModified = false;
294        accountHasBeenModified = false;
295        alwaysUseThirdPartyBillingHasBeenModified = false;
296        fromTimeHasBeenModified = false;
297        thruTimeHasBeenModified = false;
298    }
299    
300    @Nonnull
301    public PartyCarrierAccountPK getPartyCarrierAccountPK() {
302        return partyCarrierAccountPK;
303    }
304    
305    public void setPartyCarrierAccountPK(@Nonnull PartyCarrierAccountPK partyCarrierAccountPK)
306            throws PersistenceNotNullException {
307        checkForNull(partyCarrierAccountPK);
308        
309        boolean update = true;
310        
311        if(this.partyCarrierAccountPK != null) {
312            if(this.partyCarrierAccountPK.equals(partyCarrierAccountPK)) {
313                update = false;
314            }
315        } else if(partyCarrierAccountPK == null) {
316            update = false;
317        }
318        
319        if(update) {
320            this.partyCarrierAccountPK = partyCarrierAccountPK;
321            partyCarrierAccountPKHasBeenModified = true;
322            clearHashAndString();
323        }
324    }
325    
326    public boolean getPartyCarrierAccountPKHasBeenModified() {
327        return partyCarrierAccountPKHasBeenModified;
328    }
329    
330    @Nonnull
331    public PartyPK getPartyPK() {
332        return partyPK;
333    }
334    
335    public void setPartyPK(@Nonnull PartyPK partyPK)
336            throws PersistenceNotNullException {
337        checkForNull(partyPK);
338        
339        boolean update = true;
340        
341        if(this.partyPK != null) {
342            if(this.partyPK.equals(partyPK)) {
343                update = false;
344            }
345        } else if(partyPK == null) {
346            update = false;
347        }
348        
349        if(update) {
350            this.partyPK = partyPK;
351            partyPKHasBeenModified = true;
352            clearHashAndString();
353        }
354    }
355    
356    public boolean getPartyPKHasBeenModified() {
357        return partyPKHasBeenModified;
358    }
359    
360    @Nonnull
361    public PartyPK getCarrierPartyPK() {
362        return carrierPartyPK;
363    }
364    
365    public void setCarrierPartyPK(@Nonnull PartyPK carrierPartyPK)
366            throws PersistenceNotNullException {
367        checkForNull(carrierPartyPK);
368        
369        boolean update = true;
370        
371        if(this.carrierPartyPK != null) {
372            if(this.carrierPartyPK.equals(carrierPartyPK)) {
373                update = false;
374            }
375        } else if(carrierPartyPK == null) {
376            update = false;
377        }
378        
379        if(update) {
380            this.carrierPartyPK = carrierPartyPK;
381            carrierPartyPKHasBeenModified = true;
382            clearHashAndString();
383        }
384    }
385    
386    public boolean getCarrierPartyPKHasBeenModified() {
387        return carrierPartyPKHasBeenModified;
388    }
389    
390    @Nonnull
391    public String getAccount() {
392        return account;
393    }
394    
395    public void setAccount(@Nonnull String account)
396            throws PersistenceNotNullException {
397        checkForNull(account);
398        
399        boolean update = true;
400        
401        if(this.account != null) {
402            if(this.account.equals(account)) {
403                update = false;
404            }
405        } else if(account == null) {
406            update = false;
407        }
408        
409        if(update) {
410            this.account = account;
411            accountHasBeenModified = true;
412            clearHashAndString();
413        }
414    }
415    
416    public boolean getAccountHasBeenModified() {
417        return accountHasBeenModified;
418    }
419    
420    @Nonnull
421    public Boolean getAlwaysUseThirdPartyBilling() {
422        return alwaysUseThirdPartyBilling;
423    }
424    
425    public void setAlwaysUseThirdPartyBilling(@Nonnull Boolean alwaysUseThirdPartyBilling)
426            throws PersistenceNotNullException {
427        checkForNull(alwaysUseThirdPartyBilling);
428        
429        boolean update = true;
430        
431        if(this.alwaysUseThirdPartyBilling != null) {
432            if(this.alwaysUseThirdPartyBilling.equals(alwaysUseThirdPartyBilling)) {
433                update = false;
434            }
435        } else if(alwaysUseThirdPartyBilling == null) {
436            update = false;
437        }
438        
439        if(update) {
440            this.alwaysUseThirdPartyBilling = alwaysUseThirdPartyBilling;
441            alwaysUseThirdPartyBillingHasBeenModified = true;
442            clearHashAndString();
443        }
444    }
445    
446    public boolean getAlwaysUseThirdPartyBillingHasBeenModified() {
447        return alwaysUseThirdPartyBillingHasBeenModified;
448    }
449    
450    @Nonnull
451    public Long getFromTime() {
452        return fromTime;
453    }
454    
455    public void setFromTime(@Nonnull Long fromTime)
456            throws PersistenceNotNullException {
457        checkForNull(fromTime);
458        
459        boolean update = true;
460        
461        if(this.fromTime != null) {
462            if(this.fromTime.equals(fromTime)) {
463                update = false;
464            }
465        } else if(fromTime == null) {
466            update = false;
467        }
468        
469        if(update) {
470            this.fromTime = fromTime;
471            fromTimeHasBeenModified = true;
472            clearHashAndString();
473        }
474    }
475    
476    public boolean getFromTimeHasBeenModified() {
477        return fromTimeHasBeenModified;
478    }
479    
480    @Nonnull
481    public Long getThruTime() {
482        return thruTime;
483    }
484    
485    public void setThruTime(@Nonnull Long thruTime)
486            throws PersistenceNotNullException {
487        checkForNull(thruTime);
488        
489        boolean update = true;
490        
491        if(this.thruTime != null) {
492            if(this.thruTime.equals(thruTime)) {
493                update = false;
494            }
495        } else if(thruTime == null) {
496            update = false;
497        }
498        
499        if(update) {
500            this.thruTime = thruTime;
501            thruTimeHasBeenModified = true;
502            clearHashAndString();
503        }
504    }
505    
506    public boolean getThruTimeHasBeenModified() {
507        return thruTimeHasBeenModified;
508    }
509    
510}