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 * 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            StringBuilder stringValue = new StringBuilder("{");
151            
152            stringValue.append("entityId=").append(getEntityId());
153            
154            stringValue.append(", partyCarrierAccountPK=").append(getPartyCarrierAccountPK());
155            stringValue.append(", partyPK=").append(getPartyPK());
156            stringValue.append(", carrierPartyPK=").append(getCarrierPartyPK());
157            stringValue.append(", account=").append(getAccount());
158            stringValue.append(", alwaysUseThirdPartyBilling=").append(getAlwaysUseThirdPartyBilling());
159            stringValue.append(", fromTime=").append(getFromTime());
160            stringValue.append(", thruTime=").append(getThruTime());
161            
162            stringValue.append('}');
163            
164            _stringValue = stringValue.toString();
165        }
166        return _stringValue;
167    }
168    
169    @Override
170    public boolean equals(Object other) {
171        if(this == other)
172            return true;
173        
174        if(!hasIdentity())
175            return false;
176        
177        if(other instanceof  PartyCarrierAccountDetailValue) {
178            PartyCarrierAccountDetailValue that = (PartyCarrierAccountDetailValue)other;
179            
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 = 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) {
198            PartyCarrierAccountDetailValue that = (PartyCarrierAccountDetailValue)other;
199            boolean objectsEqual = true;
200            
201            
202            if(objectsEqual) {
203                PartyCarrierAccountPK thisPartyCarrierAccountPK = getPartyCarrierAccountPK();
204                PartyCarrierAccountPK thatPartyCarrierAccountPK = that.getPartyCarrierAccountPK();
205                
206                if(thisPartyCarrierAccountPK == null) {
207                    objectsEqual = objectsEqual && (thatPartyCarrierAccountPK == null);
208                } else {
209                    objectsEqual = objectsEqual && thisPartyCarrierAccountPK.equals(thatPartyCarrierAccountPK);
210                }
211            }
212            
213            if(objectsEqual) {
214                PartyPK thisPartyPK = getPartyPK();
215                PartyPK thatPartyPK = that.getPartyPK();
216                
217                if(thisPartyPK == null) {
218                    objectsEqual = objectsEqual && (thatPartyPK == null);
219                } else {
220                    objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK);
221                }
222            }
223            
224            if(objectsEqual) {
225                PartyPK thisCarrierPartyPK = getCarrierPartyPK();
226                PartyPK thatCarrierPartyPK = that.getCarrierPartyPK();
227                
228                if(thisCarrierPartyPK == null) {
229                    objectsEqual = objectsEqual && (thatCarrierPartyPK == null);
230                } else {
231                    objectsEqual = objectsEqual && thisCarrierPartyPK.equals(thatCarrierPartyPK);
232                }
233            }
234            
235            if(objectsEqual) {
236                String thisAccount = getAccount();
237                String thatAccount = that.getAccount();
238                
239                if(thisAccount == null) {
240                    objectsEqual = objectsEqual && (thatAccount == null);
241                } else {
242                    objectsEqual = objectsEqual && thisAccount.equals(thatAccount);
243                }
244            }
245            
246            if(objectsEqual) {
247                Boolean thisAlwaysUseThirdPartyBilling = getAlwaysUseThirdPartyBilling();
248                Boolean thatAlwaysUseThirdPartyBilling = that.getAlwaysUseThirdPartyBilling();
249                
250                if(thisAlwaysUseThirdPartyBilling == null) {
251                    objectsEqual = objectsEqual && (thatAlwaysUseThirdPartyBilling == null);
252                } else {
253                    objectsEqual = objectsEqual && thisAlwaysUseThirdPartyBilling.equals(thatAlwaysUseThirdPartyBilling);
254                }
255            }
256            
257            if(objectsEqual) {
258                Long thisFromTime = getFromTime();
259                Long thatFromTime = that.getFromTime();
260                
261                if(thisFromTime == null) {
262                    objectsEqual = objectsEqual && (thatFromTime == null);
263                } else {
264                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
265                }
266            }
267            
268            if(objectsEqual) {
269                Long thisThruTime = getThruTime();
270                Long thatThruTime = that.getThruTime();
271                
272                if(thisThruTime == null) {
273                    objectsEqual = objectsEqual && (thatThruTime == null);
274                } else {
275                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
276                }
277            }
278            
279            return objectsEqual;
280        } else {
281            return false;
282        }
283    }
284    
285    @Override
286    public boolean hasBeenModified() {
287        return partyCarrierAccountPKHasBeenModified || partyPKHasBeenModified || carrierPartyPKHasBeenModified || accountHasBeenModified || alwaysUseThirdPartyBillingHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
288    }
289    
290    @Override
291    public void clearHasBeenModified() {
292        partyCarrierAccountPKHasBeenModified = false;
293        partyPKHasBeenModified = false;
294        carrierPartyPKHasBeenModified = false;
295        accountHasBeenModified = false;
296        alwaysUseThirdPartyBillingHasBeenModified = false;
297        fromTimeHasBeenModified = false;
298        thruTimeHasBeenModified = false;
299    }
300    
301    public PartyCarrierAccountPK getPartyCarrierAccountPK() {
302        return partyCarrierAccountPK;
303    }
304    
305    public void setPartyCarrierAccountPK(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    public PartyPK getPartyPK() {
331        return partyPK;
332    }
333    
334    public void setPartyPK(PartyPK partyPK)
335            throws PersistenceNotNullException {
336        checkForNull(partyPK);
337        
338        boolean update = true;
339        
340        if(this.partyPK != null) {
341            if(this.partyPK.equals(partyPK)) {
342                update = false;
343            }
344        } else if(partyPK == null) {
345            update = false;
346        }
347        
348        if(update) {
349            this.partyPK = partyPK;
350            partyPKHasBeenModified = true;
351            clearHashAndString();
352        }
353    }
354    
355    public boolean getPartyPKHasBeenModified() {
356        return partyPKHasBeenModified;
357    }
358    
359    public PartyPK getCarrierPartyPK() {
360        return carrierPartyPK;
361    }
362    
363    public void setCarrierPartyPK(PartyPK carrierPartyPK)
364            throws PersistenceNotNullException {
365        checkForNull(carrierPartyPK);
366        
367        boolean update = true;
368        
369        if(this.carrierPartyPK != null) {
370            if(this.carrierPartyPK.equals(carrierPartyPK)) {
371                update = false;
372            }
373        } else if(carrierPartyPK == null) {
374            update = false;
375        }
376        
377        if(update) {
378            this.carrierPartyPK = carrierPartyPK;
379            carrierPartyPKHasBeenModified = true;
380            clearHashAndString();
381        }
382    }
383    
384    public boolean getCarrierPartyPKHasBeenModified() {
385        return carrierPartyPKHasBeenModified;
386    }
387    
388    public String getAccount() {
389        return account;
390    }
391    
392    public void setAccount(String account)
393            throws PersistenceNotNullException {
394        checkForNull(account);
395        
396        boolean update = true;
397        
398        if(this.account != null) {
399            if(this.account.equals(account)) {
400                update = false;
401            }
402        } else if(account == null) {
403            update = false;
404        }
405        
406        if(update) {
407            this.account = account;
408            accountHasBeenModified = true;
409            clearHashAndString();
410        }
411    }
412    
413    public boolean getAccountHasBeenModified() {
414        return accountHasBeenModified;
415    }
416    
417    public Boolean getAlwaysUseThirdPartyBilling() {
418        return alwaysUseThirdPartyBilling;
419    }
420    
421    public void setAlwaysUseThirdPartyBilling(Boolean alwaysUseThirdPartyBilling)
422            throws PersistenceNotNullException {
423        checkForNull(alwaysUseThirdPartyBilling);
424        
425        boolean update = true;
426        
427        if(this.alwaysUseThirdPartyBilling != null) {
428            if(this.alwaysUseThirdPartyBilling.equals(alwaysUseThirdPartyBilling)) {
429                update = false;
430            }
431        } else if(alwaysUseThirdPartyBilling == null) {
432            update = false;
433        }
434        
435        if(update) {
436            this.alwaysUseThirdPartyBilling = alwaysUseThirdPartyBilling;
437            alwaysUseThirdPartyBillingHasBeenModified = true;
438            clearHashAndString();
439        }
440    }
441    
442    public boolean getAlwaysUseThirdPartyBillingHasBeenModified() {
443        return alwaysUseThirdPartyBillingHasBeenModified;
444    }
445    
446    public Long getFromTime() {
447        return fromTime;
448    }
449    
450    public void setFromTime(Long fromTime)
451            throws PersistenceNotNullException {
452        checkForNull(fromTime);
453        
454        boolean update = true;
455        
456        if(this.fromTime != null) {
457            if(this.fromTime.equals(fromTime)) {
458                update = false;
459            }
460        } else if(fromTime == null) {
461            update = false;
462        }
463        
464        if(update) {
465            this.fromTime = fromTime;
466            fromTimeHasBeenModified = true;
467            clearHashAndString();
468        }
469    }
470    
471    public boolean getFromTimeHasBeenModified() {
472        return fromTimeHasBeenModified;
473    }
474    
475    public Long getThruTime() {
476        return thruTime;
477    }
478    
479    public void setThruTime(Long thruTime)
480            throws PersistenceNotNullException {
481        checkForNull(thruTime);
482        
483        boolean update = true;
484        
485        if(this.thruTime != null) {
486            if(this.thruTime.equals(thruTime)) {
487                update = false;
488            }
489        } else if(thruTime == null) {
490            update = false;
491        }
492        
493        if(update) {
494            this.thruTime = thruTime;
495            thruTimeHasBeenModified = true;
496            clearHashAndString();
497        }
498    }
499    
500    public boolean getThruTimeHasBeenModified() {
501        return thruTimeHasBeenModified;
502    }
503    
504}