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 * InvoiceLineDetailValue.java
021 */
022
023package com.echothree.model.data.invoice.server.value;
024
025import com.echothree.model.data.invoice.common.pk.InvoiceLineDetailPK;
026
027import com.echothree.model.data.invoice.server.factory.InvoiceLineDetailFactory;
028
029import com.echothree.model.data.invoice.common.pk.InvoiceLinePK;
030import com.echothree.model.data.invoice.common.pk.InvoicePK;
031import com.echothree.model.data.invoice.common.pk.InvoiceLineTypePK;
032import com.echothree.model.data.invoice.common.pk.InvoiceLineUseTypePK;
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 InvoiceLineDetailValue
042        extends BaseValue<InvoiceLineDetailPK>
043        implements Cloneable, Serializable {
044    
045    private InvoiceLinePK invoiceLinePK;
046    private boolean invoiceLinePKHasBeenModified = false;
047    private InvoicePK invoicePK;
048    private boolean invoicePKHasBeenModified = false;
049    private Integer invoiceLineSequence;
050    private boolean invoiceLineSequenceHasBeenModified = false;
051    private InvoiceLinePK parentInvoiceLinePK;
052    private boolean parentInvoiceLinePKHasBeenModified = false;
053    private InvoiceLineTypePK invoiceLineTypePK;
054    private boolean invoiceLineTypePKHasBeenModified = false;
055    private InvoiceLineUseTypePK invoiceLineUseTypePK;
056    private boolean invoiceLineUseTypePKHasBeenModified = false;
057    private Long amount;
058    private boolean amountHasBeenModified = false;
059    private String description;
060    private boolean descriptionHasBeenModified = 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(InvoiceLinePK invoiceLinePK, InvoicePK invoicePK, Integer invoiceLineSequence, InvoiceLinePK parentInvoiceLinePK, InvoiceLineTypePK invoiceLineTypePK, InvoiceLineUseTypePK invoiceLineUseTypePK, Long amount, String description, Long fromTime, Long thruTime)
070            throws PersistenceNotNullException {
071        checkForNull(invoiceLinePK);
072        this.invoiceLinePK = invoiceLinePK;
073        checkForNull(invoicePK);
074        this.invoicePK = invoicePK;
075        checkForNull(invoiceLineSequence);
076        this.invoiceLineSequence = invoiceLineSequence;
077        this.parentInvoiceLinePK = parentInvoiceLinePK;
078        checkForNull(invoiceLineTypePK);
079        this.invoiceLineTypePK = invoiceLineTypePK;
080        checkForNull(invoiceLineUseTypePK);
081        this.invoiceLineUseTypePK = invoiceLineUseTypePK;
082        checkForNull(amount);
083        this.amount = amount;
084        this.description = description;
085        checkForNull(fromTime);
086        this.fromTime = fromTime;
087        checkForNull(thruTime);
088        this.thruTime = thruTime;
089    }
090    
091    /** Creates a new instance of InvoiceLineDetailValue */
092    public InvoiceLineDetailValue(InvoiceLineDetailPK invoiceLineDetailPK, InvoiceLinePK invoiceLinePK, InvoicePK invoicePK, Integer invoiceLineSequence, InvoiceLinePK parentInvoiceLinePK, InvoiceLineTypePK invoiceLineTypePK, InvoiceLineUseTypePK invoiceLineUseTypePK, Long amount, String description, Long fromTime, Long thruTime)
093            throws PersistenceNotNullException {
094        super(invoiceLineDetailPK);
095        constructFields(invoiceLinePK, invoicePK, invoiceLineSequence, parentInvoiceLinePK, invoiceLineTypePK, invoiceLineUseTypePK, amount, description, fromTime, thruTime);
096    }
097    
098    /** Creates a new instance of InvoiceLineDetailValue */
099    public InvoiceLineDetailValue(InvoiceLinePK invoiceLinePK, InvoicePK invoicePK, Integer invoiceLineSequence, InvoiceLinePK parentInvoiceLinePK, InvoiceLineTypePK invoiceLineTypePK, InvoiceLineUseTypePK invoiceLineUseTypePK, Long amount, String description, Long fromTime, Long thruTime)
100            throws PersistenceNotNullException {
101        super();
102        constructFields(invoiceLinePK, invoicePK, invoiceLineSequence, parentInvoiceLinePK, invoiceLineTypePK, invoiceLineUseTypePK, amount, description, fromTime, thruTime);
103    }
104    
105   @Override
106   public InvoiceLineDetailFactory getBaseFactoryInstance() {
107        return InvoiceLineDetailFactory.getInstance();
108    }
109    
110    @Override
111    public InvoiceLineDetailValue 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 (InvoiceLineDetailValue)result;
122    }
123    
124   @Override
125    public InvoiceLineDetailPK getPrimaryKey() {
126        if(_primaryKey == null) {
127            _primaryKey = new InvoiceLineDetailPK(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 + ((invoiceLinePK != null) ? invoiceLinePK.hashCode() : 0);
146            hashCode = 37 * hashCode + ((invoicePK != null) ? invoicePK.hashCode() : 0);
147            hashCode = 37 * hashCode + ((invoiceLineSequence != null) ? invoiceLineSequence.hashCode() : 0);
148            hashCode = 37 * hashCode + ((parentInvoiceLinePK != null) ? parentInvoiceLinePK.hashCode() : 0);
149            hashCode = 37 * hashCode + ((invoiceLineTypePK != null) ? invoiceLineTypePK.hashCode() : 0);
150            hashCode = 37 * hashCode + ((invoiceLineUseTypePK != null) ? invoiceLineUseTypePK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((amount != null) ? amount.hashCode() : 0);
152            hashCode = 37 * hashCode + ((description != null) ? description.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(", invoiceLinePK=").append(getInvoiceLinePK());
170            stringValue.append(", invoicePK=").append(getInvoicePK());
171            stringValue.append(", invoiceLineSequence=").append(getInvoiceLineSequence());
172            stringValue.append(", parentInvoiceLinePK=").append(getParentInvoiceLinePK());
173            stringValue.append(", invoiceLineTypePK=").append(getInvoiceLineTypePK());
174            stringValue.append(", invoiceLineUseTypePK=").append(getInvoiceLineUseTypePK());
175            stringValue.append(", amount=").append(getAmount());
176            stringValue.append(", description=").append(getDescription());
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  InvoiceLineDetailValue) {
196            InvoiceLineDetailValue that = (InvoiceLineDetailValue)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 InvoiceLineDetailValue) {
216            InvoiceLineDetailValue that = (InvoiceLineDetailValue)other;
217            boolean objectsEqual = true;
218            
219            
220            if(objectsEqual) {
221                InvoiceLinePK thisInvoiceLinePK = getInvoiceLinePK();
222                InvoiceLinePK thatInvoiceLinePK = that.getInvoiceLinePK();
223                
224                if(thisInvoiceLinePK == null) {
225                    objectsEqual = objectsEqual && (thatInvoiceLinePK == null);
226                } else {
227                    objectsEqual = objectsEqual && thisInvoiceLinePK.equals(thatInvoiceLinePK);
228                }
229            }
230            
231            if(objectsEqual) {
232                InvoicePK thisInvoicePK = getInvoicePK();
233                InvoicePK thatInvoicePK = that.getInvoicePK();
234                
235                if(thisInvoicePK == null) {
236                    objectsEqual = objectsEqual && (thatInvoicePK == null);
237                } else {
238                    objectsEqual = objectsEqual && thisInvoicePK.equals(thatInvoicePK);
239                }
240            }
241            
242            if(objectsEqual) {
243                Integer thisInvoiceLineSequence = getInvoiceLineSequence();
244                Integer thatInvoiceLineSequence = that.getInvoiceLineSequence();
245                
246                if(thisInvoiceLineSequence == null) {
247                    objectsEqual = objectsEqual && (thatInvoiceLineSequence == null);
248                } else {
249                    objectsEqual = objectsEqual && thisInvoiceLineSequence.equals(thatInvoiceLineSequence);
250                }
251            }
252            
253            if(objectsEqual) {
254                InvoiceLinePK thisParentInvoiceLinePK = getParentInvoiceLinePK();
255                InvoiceLinePK thatParentInvoiceLinePK = that.getParentInvoiceLinePK();
256                
257                if(thisParentInvoiceLinePK == null) {
258                    objectsEqual = objectsEqual && (thatParentInvoiceLinePK == null);
259                } else {
260                    objectsEqual = objectsEqual && thisParentInvoiceLinePK.equals(thatParentInvoiceLinePK);
261                }
262            }
263            
264            if(objectsEqual) {
265                InvoiceLineTypePK thisInvoiceLineTypePK = getInvoiceLineTypePK();
266                InvoiceLineTypePK thatInvoiceLineTypePK = that.getInvoiceLineTypePK();
267                
268                if(thisInvoiceLineTypePK == null) {
269                    objectsEqual = objectsEqual && (thatInvoiceLineTypePK == null);
270                } else {
271                    objectsEqual = objectsEqual && thisInvoiceLineTypePK.equals(thatInvoiceLineTypePK);
272                }
273            }
274            
275            if(objectsEqual) {
276                InvoiceLineUseTypePK thisInvoiceLineUseTypePK = getInvoiceLineUseTypePK();
277                InvoiceLineUseTypePK thatInvoiceLineUseTypePK = that.getInvoiceLineUseTypePK();
278                
279                if(thisInvoiceLineUseTypePK == null) {
280                    objectsEqual = objectsEqual && (thatInvoiceLineUseTypePK == null);
281                } else {
282                    objectsEqual = objectsEqual && thisInvoiceLineUseTypePK.equals(thatInvoiceLineUseTypePK);
283                }
284            }
285            
286            if(objectsEqual) {
287                Long thisAmount = getAmount();
288                Long thatAmount = that.getAmount();
289                
290                if(thisAmount == null) {
291                    objectsEqual = objectsEqual && (thatAmount == null);
292                } else {
293                    objectsEqual = objectsEqual && thisAmount.equals(thatAmount);
294                }
295            }
296            
297            if(objectsEqual) {
298                String thisDescription = getDescription();
299                String thatDescription = that.getDescription();
300                
301                if(thisDescription == null) {
302                    objectsEqual = objectsEqual && (thatDescription == null);
303                } else {
304                    objectsEqual = objectsEqual && thisDescription.equals(thatDescription);
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 invoiceLinePKHasBeenModified || invoicePKHasBeenModified || invoiceLineSequenceHasBeenModified || parentInvoiceLinePKHasBeenModified || invoiceLineTypePKHasBeenModified || invoiceLineUseTypePKHasBeenModified || amountHasBeenModified || descriptionHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
339    }
340    
341    @Override
342    public void clearHasBeenModified() {
343        invoiceLinePKHasBeenModified = false;
344        invoicePKHasBeenModified = false;
345        invoiceLineSequenceHasBeenModified = false;
346        parentInvoiceLinePKHasBeenModified = false;
347        invoiceLineTypePKHasBeenModified = false;
348        invoiceLineUseTypePKHasBeenModified = false;
349        amountHasBeenModified = false;
350        descriptionHasBeenModified = false;
351        fromTimeHasBeenModified = false;
352        thruTimeHasBeenModified = false;
353    }
354    
355    public InvoiceLinePK getInvoiceLinePK() {
356        return invoiceLinePK;
357    }
358    
359    public void setInvoiceLinePK(InvoiceLinePK invoiceLinePK)
360            throws PersistenceNotNullException {
361        checkForNull(invoiceLinePK);
362        
363        boolean update = true;
364        
365        if(this.invoiceLinePK != null) {
366            if(this.invoiceLinePK.equals(invoiceLinePK)) {
367                update = false;
368            }
369        } else if(invoiceLinePK == null) {
370            update = false;
371        }
372        
373        if(update) {
374            this.invoiceLinePK = invoiceLinePK;
375            invoiceLinePKHasBeenModified = true;
376            clearHashAndString();
377        }
378    }
379    
380    public boolean getInvoiceLinePKHasBeenModified() {
381        return invoiceLinePKHasBeenModified;
382    }
383    
384    public InvoicePK getInvoicePK() {
385        return invoicePK;
386    }
387    
388    public void setInvoicePK(InvoicePK invoicePK)
389            throws PersistenceNotNullException {
390        checkForNull(invoicePK);
391        
392        boolean update = true;
393        
394        if(this.invoicePK != null) {
395            if(this.invoicePK.equals(invoicePK)) {
396                update = false;
397            }
398        } else if(invoicePK == null) {
399            update = false;
400        }
401        
402        if(update) {
403            this.invoicePK = invoicePK;
404            invoicePKHasBeenModified = true;
405            clearHashAndString();
406        }
407    }
408    
409    public boolean getInvoicePKHasBeenModified() {
410        return invoicePKHasBeenModified;
411    }
412    
413    public Integer getInvoiceLineSequence() {
414        return invoiceLineSequence;
415    }
416    
417    public void setInvoiceLineSequence(Integer invoiceLineSequence)
418            throws PersistenceNotNullException {
419        checkForNull(invoiceLineSequence);
420        
421        boolean update = true;
422        
423        if(this.invoiceLineSequence != null) {
424            if(this.invoiceLineSequence.equals(invoiceLineSequence)) {
425                update = false;
426            }
427        } else if(invoiceLineSequence == null) {
428            update = false;
429        }
430        
431        if(update) {
432            this.invoiceLineSequence = invoiceLineSequence;
433            invoiceLineSequenceHasBeenModified = true;
434            clearHashAndString();
435        }
436    }
437    
438    public boolean getInvoiceLineSequenceHasBeenModified() {
439        return invoiceLineSequenceHasBeenModified;
440    }
441    
442    public InvoiceLinePK getParentInvoiceLinePK() {
443        return parentInvoiceLinePK;
444    }
445    
446    public void setParentInvoiceLinePK(InvoiceLinePK parentInvoiceLinePK) {
447        boolean update = true;
448        
449        if(this.parentInvoiceLinePK != null) {
450            if(this.parentInvoiceLinePK.equals(parentInvoiceLinePK)) {
451                update = false;
452            }
453        } else if(parentInvoiceLinePK == null) {
454            update = false;
455        }
456        
457        if(update) {
458            this.parentInvoiceLinePK = parentInvoiceLinePK;
459            parentInvoiceLinePKHasBeenModified = true;
460            clearHashAndString();
461        }
462    }
463    
464    public boolean getParentInvoiceLinePKHasBeenModified() {
465        return parentInvoiceLinePKHasBeenModified;
466    }
467    
468    public InvoiceLineTypePK getInvoiceLineTypePK() {
469        return invoiceLineTypePK;
470    }
471    
472    public void setInvoiceLineTypePK(InvoiceLineTypePK invoiceLineTypePK)
473            throws PersistenceNotNullException {
474        checkForNull(invoiceLineTypePK);
475        
476        boolean update = true;
477        
478        if(this.invoiceLineTypePK != null) {
479            if(this.invoiceLineTypePK.equals(invoiceLineTypePK)) {
480                update = false;
481            }
482        } else if(invoiceLineTypePK == null) {
483            update = false;
484        }
485        
486        if(update) {
487            this.invoiceLineTypePK = invoiceLineTypePK;
488            invoiceLineTypePKHasBeenModified = true;
489            clearHashAndString();
490        }
491    }
492    
493    public boolean getInvoiceLineTypePKHasBeenModified() {
494        return invoiceLineTypePKHasBeenModified;
495    }
496    
497    public InvoiceLineUseTypePK getInvoiceLineUseTypePK() {
498        return invoiceLineUseTypePK;
499    }
500    
501    public void setInvoiceLineUseTypePK(InvoiceLineUseTypePK invoiceLineUseTypePK)
502            throws PersistenceNotNullException {
503        checkForNull(invoiceLineUseTypePK);
504        
505        boolean update = true;
506        
507        if(this.invoiceLineUseTypePK != null) {
508            if(this.invoiceLineUseTypePK.equals(invoiceLineUseTypePK)) {
509                update = false;
510            }
511        } else if(invoiceLineUseTypePK == null) {
512            update = false;
513        }
514        
515        if(update) {
516            this.invoiceLineUseTypePK = invoiceLineUseTypePK;
517            invoiceLineUseTypePKHasBeenModified = true;
518            clearHashAndString();
519        }
520    }
521    
522    public boolean getInvoiceLineUseTypePKHasBeenModified() {
523        return invoiceLineUseTypePKHasBeenModified;
524    }
525    
526    public Long getAmount() {
527        return amount;
528    }
529    
530    public void setAmount(Long amount)
531            throws PersistenceNotNullException {
532        checkForNull(amount);
533        
534        boolean update = true;
535        
536        if(this.amount != null) {
537            if(this.amount.equals(amount)) {
538                update = false;
539            }
540        } else if(amount == null) {
541            update = false;
542        }
543        
544        if(update) {
545            this.amount = amount;
546            amountHasBeenModified = true;
547            clearHashAndString();
548        }
549    }
550    
551    public boolean getAmountHasBeenModified() {
552        return amountHasBeenModified;
553    }
554    
555    public String getDescription() {
556        return description;
557    }
558    
559    public void setDescription(String description) {
560        boolean update = true;
561        
562        if(this.description != null) {
563            if(this.description.equals(description)) {
564                update = false;
565            }
566        } else if(description == null) {
567            update = false;
568        }
569        
570        if(update) {
571            this.description = description;
572            descriptionHasBeenModified = true;
573            clearHashAndString();
574        }
575    }
576    
577    public boolean getDescriptionHasBeenModified() {
578        return descriptionHasBeenModified;
579    }
580    
581    public Long getFromTime() {
582        return fromTime;
583    }
584    
585    public void setFromTime(Long fromTime)
586            throws PersistenceNotNullException {
587        checkForNull(fromTime);
588        
589        boolean update = true;
590        
591        if(this.fromTime != null) {
592            if(this.fromTime.equals(fromTime)) {
593                update = false;
594            }
595        } else if(fromTime == null) {
596            update = false;
597        }
598        
599        if(update) {
600            this.fromTime = fromTime;
601            fromTimeHasBeenModified = true;
602            clearHashAndString();
603        }
604    }
605    
606    public boolean getFromTimeHasBeenModified() {
607        return fromTimeHasBeenModified;
608    }
609    
610    public Long getThruTime() {
611        return thruTime;
612    }
613    
614    public void setThruTime(Long thruTime)
615            throws PersistenceNotNullException {
616        checkForNull(thruTime);
617        
618        boolean update = true;
619        
620        if(this.thruTime != null) {
621            if(this.thruTime.equals(thruTime)) {
622                update = false;
623            }
624        } else if(thruTime == null) {
625            update = false;
626        }
627        
628        if(update) {
629            this.thruTime = thruTime;
630            thruTimeHasBeenModified = true;
631            clearHashAndString();
632        }
633    }
634    
635    public boolean getThruTimeHasBeenModified() {
636        return thruTimeHasBeenModified;
637    }
638    
639}