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 * InvoiceDetail.java
021 */
022
023package com.echothree.model.data.invoice.server.entity;
024
025import com.echothree.model.data.invoice.common.pk.InvoiceDetailPK;
026
027import com.echothree.model.data.invoice.common.pk.InvoicePK;
028import com.echothree.model.data.invoice.common.pk.InvoiceTypePK;
029import com.echothree.model.data.payment.common.pk.BillingAccountPK;
030import com.echothree.model.data.accounting.common.pk.GlAccountPK;
031import com.echothree.model.data.term.common.pk.TermPK;
032import com.echothree.model.data.shipment.common.pk.FreeOnBoardPK;
033
034import com.echothree.model.data.invoice.server.entity.Invoice;
035import com.echothree.model.data.invoice.server.entity.InvoiceType;
036import com.echothree.model.data.payment.server.entity.BillingAccount;
037import com.echothree.model.data.accounting.server.entity.GlAccount;
038import com.echothree.model.data.term.server.entity.Term;
039import com.echothree.model.data.shipment.server.entity.FreeOnBoard;
040
041import com.echothree.model.data.invoice.server.factory.InvoiceFactory;
042import com.echothree.model.data.invoice.server.factory.InvoiceTypeFactory;
043import com.echothree.model.data.payment.server.factory.BillingAccountFactory;
044import com.echothree.model.data.accounting.server.factory.GlAccountFactory;
045import com.echothree.model.data.term.server.factory.TermFactory;
046import com.echothree.model.data.shipment.server.factory.FreeOnBoardFactory;
047
048import com.echothree.model.data.invoice.common.pk.InvoiceDetailPK;
049
050import com.echothree.model.data.invoice.server.value.InvoiceDetailValue;
051
052import com.echothree.model.data.invoice.server.factory.InvoiceDetailFactory;
053
054import com.echothree.util.common.exception.PersistenceException;
055import com.echothree.util.common.exception.PersistenceDatabaseException;
056import com.echothree.util.common.exception.PersistenceNotNullException;
057import com.echothree.util.common.exception.PersistenceReadOnlyException;
058
059import com.echothree.util.common.persistence.BasePK;
060
061import com.echothree.util.common.persistence.type.ByteArray;
062
063import com.echothree.util.server.persistence.BaseEntity;
064import com.echothree.util.server.persistence.EntityPermission;
065import com.echothree.util.server.persistence.Session;
066import com.echothree.util.server.persistence.ThreadSession;
067
068import java.io.Serializable;
069
070public class InvoiceDetail
071        extends BaseEntity
072        implements Serializable {
073    
074    private InvoiceDetailPK _pk;
075    private InvoiceDetailValue _value;
076    
077    /** Creates a new instance of InvoiceDetail */
078    public InvoiceDetail()
079            throws PersistenceException {
080        super();
081    }
082    
083    /** Creates a new instance of InvoiceDetail */
084    public InvoiceDetail(InvoiceDetailValue value, EntityPermission entityPermission) {
085        super(entityPermission);
086        
087        _value = value;
088        _pk = value.getPrimaryKey();
089    }
090    
091    @Override
092    public InvoiceDetailFactory getBaseFactoryInstance() {
093        return InvoiceDetailFactory.getInstance();
094    }
095    
096    @Override
097    public boolean hasBeenModified() {
098        return _value.hasBeenModified();
099    }
100    
101    @Override
102    public int hashCode() {
103        return _pk.hashCode();
104    }
105    
106    @Override
107    public String toString() {
108        return _pk.toString();
109    }
110    
111    @Override
112    public boolean equals(Object other) {
113        if(this == other)
114            return true;
115        
116        if(other instanceof InvoiceDetail that) {
117            InvoiceDetailValue thatValue = that.getInvoiceDetailValue();
118            return _value.equals(thatValue);
119        } else {
120            return false;
121        }
122    }
123    
124    @Override
125    public void store()
126            throws PersistenceDatabaseException {
127        getBaseFactoryInstance().store(this);
128    }
129    
130    @Override
131    public void remove()
132            throws PersistenceDatabaseException {
133        getBaseFactoryInstance().remove(this);
134    }
135    
136    public InvoiceDetailValue getInvoiceDetailValue() {
137        return _value;
138    }
139    
140    public void setInvoiceDetailValue(InvoiceDetailValue value)
141            throws PersistenceReadOnlyException {
142        checkReadWrite();
143        _value = value;
144    }
145    
146    @Override
147    public InvoiceDetailPK getPrimaryKey() {
148        return _pk;
149    }
150    
151    public InvoicePK getInvoicePK() {
152        return _value.getInvoicePK();
153    }
154    
155    public Invoice getInvoice(EntityPermission entityPermission) {
156        return InvoiceFactory.getInstance().getEntityFromPK(entityPermission, getInvoicePK());
157    }
158    
159    public Invoice getInvoice() {
160        return getInvoice(EntityPermission.READ_ONLY);
161    }
162    
163    public Invoice getInvoiceForUpdate() {
164        return getInvoice(EntityPermission.READ_WRITE);
165    }
166    
167    public void setInvoicePK(InvoicePK invoicePK)
168            throws PersistenceNotNullException, PersistenceReadOnlyException {
169        checkReadWrite();
170        _value.setInvoicePK(invoicePK);
171    }
172    
173    public void setInvoice(Invoice entity) {
174        setInvoicePK(entity == null? null: entity.getPrimaryKey());
175    }
176    
177    public boolean getInvoicePKHasBeenModified() {
178        return _value.getInvoicePKHasBeenModified();
179    }
180    
181    public InvoiceTypePK getInvoiceTypePK() {
182        return _value.getInvoiceTypePK();
183    }
184    
185    public InvoiceType getInvoiceType(EntityPermission entityPermission) {
186        return InvoiceTypeFactory.getInstance().getEntityFromPK(entityPermission, getInvoiceTypePK());
187    }
188    
189    public InvoiceType getInvoiceType() {
190        return getInvoiceType(EntityPermission.READ_ONLY);
191    }
192    
193    public InvoiceType getInvoiceTypeForUpdate() {
194        return getInvoiceType(EntityPermission.READ_WRITE);
195    }
196    
197    public void setInvoiceTypePK(InvoiceTypePK invoiceTypePK)
198            throws PersistenceNotNullException, PersistenceReadOnlyException {
199        checkReadWrite();
200        _value.setInvoiceTypePK(invoiceTypePK);
201    }
202    
203    public void setInvoiceType(InvoiceType entity) {
204        setInvoiceTypePK(entity == null? null: entity.getPrimaryKey());
205    }
206    
207    public boolean getInvoiceTypePKHasBeenModified() {
208        return _value.getInvoiceTypePKHasBeenModified();
209    }
210    
211    public String getInvoiceName() {
212        return _value.getInvoiceName();
213    }
214    
215    public void setInvoiceName(String invoiceName)
216            throws PersistenceNotNullException, PersistenceReadOnlyException {
217        checkReadWrite();
218        _value.setInvoiceName(invoiceName);
219    }
220    
221    public boolean getInvoiceNameHasBeenModified() {
222        return _value.getInvoiceNameHasBeenModified();
223    }
224    
225    public BillingAccountPK getBillingAccountPK() {
226        return _value.getBillingAccountPK();
227    }
228    
229    public BillingAccount getBillingAccount(EntityPermission entityPermission) {
230        return BillingAccountFactory.getInstance().getEntityFromPK(entityPermission, getBillingAccountPK());
231    }
232    
233    public BillingAccount getBillingAccount() {
234        return getBillingAccount(EntityPermission.READ_ONLY);
235    }
236    
237    public BillingAccount getBillingAccountForUpdate() {
238        return getBillingAccount(EntityPermission.READ_WRITE);
239    }
240    
241    public void setBillingAccountPK(BillingAccountPK billingAccountPK)
242            throws PersistenceNotNullException, PersistenceReadOnlyException {
243        checkReadWrite();
244        _value.setBillingAccountPK(billingAccountPK);
245    }
246    
247    public void setBillingAccount(BillingAccount entity) {
248        setBillingAccountPK(entity == null? null: entity.getPrimaryKey());
249    }
250    
251    public boolean getBillingAccountPKHasBeenModified() {
252        return _value.getBillingAccountPKHasBeenModified();
253    }
254    
255    public GlAccountPK getGlAccountPK() {
256        return _value.getGlAccountPK();
257    }
258    
259    public GlAccount getGlAccount(EntityPermission entityPermission) {
260        return GlAccountFactory.getInstance().getEntityFromPK(entityPermission, getGlAccountPK());
261    }
262    
263    public GlAccount getGlAccount() {
264        return getGlAccount(EntityPermission.READ_ONLY);
265    }
266    
267    public GlAccount getGlAccountForUpdate() {
268        return getGlAccount(EntityPermission.READ_WRITE);
269    }
270    
271    public void setGlAccountPK(GlAccountPK glAccountPK)
272            throws PersistenceNotNullException, PersistenceReadOnlyException {
273        checkReadWrite();
274        _value.setGlAccountPK(glAccountPK);
275    }
276    
277    public void setGlAccount(GlAccount entity) {
278        setGlAccountPK(entity == null? null: entity.getPrimaryKey());
279    }
280    
281    public boolean getGlAccountPKHasBeenModified() {
282        return _value.getGlAccountPKHasBeenModified();
283    }
284    
285    public TermPK getTermPK() {
286        return _value.getTermPK();
287    }
288    
289    public Term getTerm(EntityPermission entityPermission) {
290        return TermFactory.getInstance().getEntityFromPK(entityPermission, getTermPK());
291    }
292    
293    public Term getTerm() {
294        return getTerm(EntityPermission.READ_ONLY);
295    }
296    
297    public Term getTermForUpdate() {
298        return getTerm(EntityPermission.READ_WRITE);
299    }
300    
301    public void setTermPK(TermPK termPK)
302            throws PersistenceNotNullException, PersistenceReadOnlyException {
303        checkReadWrite();
304        _value.setTermPK(termPK);
305    }
306    
307    public void setTerm(Term entity) {
308        setTermPK(entity == null? null: entity.getPrimaryKey());
309    }
310    
311    public boolean getTermPKHasBeenModified() {
312        return _value.getTermPKHasBeenModified();
313    }
314    
315    public FreeOnBoardPK getFreeOnBoardPK() {
316        return _value.getFreeOnBoardPK();
317    }
318    
319    public FreeOnBoard getFreeOnBoard(EntityPermission entityPermission) {
320        FreeOnBoardPK pk = getFreeOnBoardPK();
321        FreeOnBoard entity = pk == null? null: FreeOnBoardFactory.getInstance().getEntityFromPK(entityPermission, pk);
322        
323        return entity;
324    }
325    
326    public FreeOnBoard getFreeOnBoard() {
327        return getFreeOnBoard(EntityPermission.READ_ONLY);
328    }
329    
330    public FreeOnBoard getFreeOnBoardForUpdate() {
331        return getFreeOnBoard(EntityPermission.READ_WRITE);
332    }
333    
334    public void setFreeOnBoardPK(FreeOnBoardPK freeOnBoardPK)
335            throws PersistenceNotNullException, PersistenceReadOnlyException {
336        checkReadWrite();
337        _value.setFreeOnBoardPK(freeOnBoardPK);
338    }
339    
340    public void setFreeOnBoard(FreeOnBoard entity) {
341        setFreeOnBoardPK(entity == null? null: entity.getPrimaryKey());
342    }
343    
344    public boolean getFreeOnBoardPKHasBeenModified() {
345        return _value.getFreeOnBoardPKHasBeenModified();
346    }
347    
348    public String getReference() {
349        return _value.getReference();
350    }
351    
352    public void setReference(String reference)
353            throws PersistenceNotNullException, PersistenceReadOnlyException {
354        checkReadWrite();
355        _value.setReference(reference);
356    }
357    
358    public boolean getReferenceHasBeenModified() {
359        return _value.getReferenceHasBeenModified();
360    }
361    
362    public String getDescription() {
363        return _value.getDescription();
364    }
365    
366    public void setDescription(String description)
367            throws PersistenceNotNullException, PersistenceReadOnlyException {
368        checkReadWrite();
369        _value.setDescription(description);
370    }
371    
372    public boolean getDescriptionHasBeenModified() {
373        return _value.getDescriptionHasBeenModified();
374    }
375    
376    public Long getFromTime() {
377        return _value.getFromTime();
378    }
379    
380    public void setFromTime(Long fromTime)
381            throws PersistenceNotNullException, PersistenceReadOnlyException {
382        checkReadWrite();
383        _value.setFromTime(fromTime);
384    }
385    
386    public boolean getFromTimeHasBeenModified() {
387        return _value.getFromTimeHasBeenModified();
388    }
389    
390    public Long getThruTime() {
391        return _value.getThruTime();
392    }
393    
394    public void setThruTime(Long thruTime)
395            throws PersistenceNotNullException, PersistenceReadOnlyException {
396        checkReadWrite();
397        _value.setThruTime(thruTime);
398    }
399    
400    public boolean getThruTimeHasBeenModified() {
401        return _value.getThruTimeHasBeenModified();
402    }
403    
404}