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