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 * 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(Session session)
126            throws PersistenceDatabaseException {
127        getBaseFactoryInstance().store(session, this);
128    }
129    
130    @Override
131    public void remove(Session session)
132            throws PersistenceDatabaseException {
133        getBaseFactoryInstance().remove(session, this);
134    }
135    
136    @Override
137    public void remove()
138            throws PersistenceDatabaseException {
139        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
140    }
141    
142    public InvoiceDetailValue getInvoiceDetailValue() {
143        return _value;
144    }
145    
146    public void setInvoiceDetailValue(InvoiceDetailValue value)
147            throws PersistenceReadOnlyException {
148        checkReadWrite();
149        _value = value;
150    }
151    
152    @Override
153    public InvoiceDetailPK getPrimaryKey() {
154        return _pk;
155    }
156    
157    public InvoicePK getInvoicePK() {
158        return _value.getInvoicePK();
159    }
160    
161    public Invoice getInvoice(Session session, EntityPermission entityPermission) {
162        return InvoiceFactory.getInstance().getEntityFromPK(session, entityPermission, getInvoicePK());
163    }
164    
165    public Invoice getInvoice(EntityPermission entityPermission) {
166        return getInvoice(ThreadSession.currentSession(), entityPermission);
167    }
168    
169    public Invoice getInvoice(Session session) {
170        return getInvoice(session, EntityPermission.READ_ONLY);
171    }
172    
173    public Invoice getInvoice() {
174        return getInvoice(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
175    }
176    
177    public Invoice getInvoiceForUpdate(Session session) {
178        return getInvoice(session, EntityPermission.READ_WRITE);
179    }
180    
181    public Invoice getInvoiceForUpdate() {
182        return getInvoice(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
183    }
184    
185    public void setInvoicePK(InvoicePK invoicePK)
186            throws PersistenceNotNullException, PersistenceReadOnlyException {
187        checkReadWrite();
188        _value.setInvoicePK(invoicePK);
189    }
190    
191    public void setInvoice(Invoice entity) {
192        setInvoicePK(entity == null? null: entity.getPrimaryKey());
193    }
194    
195    public boolean getInvoicePKHasBeenModified() {
196        return _value.getInvoicePKHasBeenModified();
197    }
198    
199    public InvoiceTypePK getInvoiceTypePK() {
200        return _value.getInvoiceTypePK();
201    }
202    
203    public InvoiceType getInvoiceType(Session session, EntityPermission entityPermission) {
204        return InvoiceTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getInvoiceTypePK());
205    }
206    
207    public InvoiceType getInvoiceType(EntityPermission entityPermission) {
208        return getInvoiceType(ThreadSession.currentSession(), entityPermission);
209    }
210    
211    public InvoiceType getInvoiceType(Session session) {
212        return getInvoiceType(session, EntityPermission.READ_ONLY);
213    }
214    
215    public InvoiceType getInvoiceType() {
216        return getInvoiceType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
217    }
218    
219    public InvoiceType getInvoiceTypeForUpdate(Session session) {
220        return getInvoiceType(session, EntityPermission.READ_WRITE);
221    }
222    
223    public InvoiceType getInvoiceTypeForUpdate() {
224        return getInvoiceType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
225    }
226    
227    public void setInvoiceTypePK(InvoiceTypePK invoiceTypePK)
228            throws PersistenceNotNullException, PersistenceReadOnlyException {
229        checkReadWrite();
230        _value.setInvoiceTypePK(invoiceTypePK);
231    }
232    
233    public void setInvoiceType(InvoiceType entity) {
234        setInvoiceTypePK(entity == null? null: entity.getPrimaryKey());
235    }
236    
237    public boolean getInvoiceTypePKHasBeenModified() {
238        return _value.getInvoiceTypePKHasBeenModified();
239    }
240    
241    public String getInvoiceName() {
242        return _value.getInvoiceName();
243    }
244    
245    public void setInvoiceName(String invoiceName)
246            throws PersistenceNotNullException, PersistenceReadOnlyException {
247        checkReadWrite();
248        _value.setInvoiceName(invoiceName);
249    }
250    
251    public boolean getInvoiceNameHasBeenModified() {
252        return _value.getInvoiceNameHasBeenModified();
253    }
254    
255    public BillingAccountPK getBillingAccountPK() {
256        return _value.getBillingAccountPK();
257    }
258    
259    public BillingAccount getBillingAccount(Session session, EntityPermission entityPermission) {
260        return BillingAccountFactory.getInstance().getEntityFromPK(session, entityPermission, getBillingAccountPK());
261    }
262    
263    public BillingAccount getBillingAccount(EntityPermission entityPermission) {
264        return getBillingAccount(ThreadSession.currentSession(), entityPermission);
265    }
266    
267    public BillingAccount getBillingAccount(Session session) {
268        return getBillingAccount(session, EntityPermission.READ_ONLY);
269    }
270    
271    public BillingAccount getBillingAccount() {
272        return getBillingAccount(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
273    }
274    
275    public BillingAccount getBillingAccountForUpdate(Session session) {
276        return getBillingAccount(session, EntityPermission.READ_WRITE);
277    }
278    
279    public BillingAccount getBillingAccountForUpdate() {
280        return getBillingAccount(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
281    }
282    
283    public void setBillingAccountPK(BillingAccountPK billingAccountPK)
284            throws PersistenceNotNullException, PersistenceReadOnlyException {
285        checkReadWrite();
286        _value.setBillingAccountPK(billingAccountPK);
287    }
288    
289    public void setBillingAccount(BillingAccount entity) {
290        setBillingAccountPK(entity == null? null: entity.getPrimaryKey());
291    }
292    
293    public boolean getBillingAccountPKHasBeenModified() {
294        return _value.getBillingAccountPKHasBeenModified();
295    }
296    
297    public GlAccountPK getGlAccountPK() {
298        return _value.getGlAccountPK();
299    }
300    
301    public GlAccount getGlAccount(Session session, EntityPermission entityPermission) {
302        return GlAccountFactory.getInstance().getEntityFromPK(session, entityPermission, getGlAccountPK());
303    }
304    
305    public GlAccount getGlAccount(EntityPermission entityPermission) {
306        return getGlAccount(ThreadSession.currentSession(), entityPermission);
307    }
308    
309    public GlAccount getGlAccount(Session session) {
310        return getGlAccount(session, EntityPermission.READ_ONLY);
311    }
312    
313    public GlAccount getGlAccount() {
314        return getGlAccount(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
315    }
316    
317    public GlAccount getGlAccountForUpdate(Session session) {
318        return getGlAccount(session, EntityPermission.READ_WRITE);
319    }
320    
321    public GlAccount getGlAccountForUpdate() {
322        return getGlAccount(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
323    }
324    
325    public void setGlAccountPK(GlAccountPK glAccountPK)
326            throws PersistenceNotNullException, PersistenceReadOnlyException {
327        checkReadWrite();
328        _value.setGlAccountPK(glAccountPK);
329    }
330    
331    public void setGlAccount(GlAccount entity) {
332        setGlAccountPK(entity == null? null: entity.getPrimaryKey());
333    }
334    
335    public boolean getGlAccountPKHasBeenModified() {
336        return _value.getGlAccountPKHasBeenModified();
337    }
338    
339    public TermPK getTermPK() {
340        return _value.getTermPK();
341    }
342    
343    public Term getTerm(Session session, EntityPermission entityPermission) {
344        return TermFactory.getInstance().getEntityFromPK(session, entityPermission, getTermPK());
345    }
346    
347    public Term getTerm(EntityPermission entityPermission) {
348        return getTerm(ThreadSession.currentSession(), entityPermission);
349    }
350    
351    public Term getTerm(Session session) {
352        return getTerm(session, EntityPermission.READ_ONLY);
353    }
354    
355    public Term getTerm() {
356        return getTerm(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
357    }
358    
359    public Term getTermForUpdate(Session session) {
360        return getTerm(session, EntityPermission.READ_WRITE);
361    }
362    
363    public Term getTermForUpdate() {
364        return getTerm(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
365    }
366    
367    public void setTermPK(TermPK termPK)
368            throws PersistenceNotNullException, PersistenceReadOnlyException {
369        checkReadWrite();
370        _value.setTermPK(termPK);
371    }
372    
373    public void setTerm(Term entity) {
374        setTermPK(entity == null? null: entity.getPrimaryKey());
375    }
376    
377    public boolean getTermPKHasBeenModified() {
378        return _value.getTermPKHasBeenModified();
379    }
380    
381    public FreeOnBoardPK getFreeOnBoardPK() {
382        return _value.getFreeOnBoardPK();
383    }
384    
385    public FreeOnBoard getFreeOnBoard(Session session, EntityPermission entityPermission) {
386        FreeOnBoardPK pk = getFreeOnBoardPK();
387        FreeOnBoard entity = pk == null? null: FreeOnBoardFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
388        
389        return entity;
390    }
391    
392    public FreeOnBoard getFreeOnBoard(EntityPermission entityPermission) {
393        return getFreeOnBoard(ThreadSession.currentSession(), entityPermission);
394    }
395    
396    public FreeOnBoard getFreeOnBoard(Session session) {
397        return getFreeOnBoard(session, EntityPermission.READ_ONLY);
398    }
399    
400    public FreeOnBoard getFreeOnBoard() {
401        return getFreeOnBoard(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
402    }
403    
404    public FreeOnBoard getFreeOnBoardForUpdate(Session session) {
405        return getFreeOnBoard(session, EntityPermission.READ_WRITE);
406    }
407    
408    public FreeOnBoard getFreeOnBoardForUpdate() {
409        return getFreeOnBoard(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
410    }
411    
412    public void setFreeOnBoardPK(FreeOnBoardPK freeOnBoardPK)
413            throws PersistenceNotNullException, PersistenceReadOnlyException {
414        checkReadWrite();
415        _value.setFreeOnBoardPK(freeOnBoardPK);
416    }
417    
418    public void setFreeOnBoard(FreeOnBoard entity) {
419        setFreeOnBoardPK(entity == null? null: entity.getPrimaryKey());
420    }
421    
422    public boolean getFreeOnBoardPKHasBeenModified() {
423        return _value.getFreeOnBoardPKHasBeenModified();
424    }
425    
426    public String getReference() {
427        return _value.getReference();
428    }
429    
430    public void setReference(String reference)
431            throws PersistenceNotNullException, PersistenceReadOnlyException {
432        checkReadWrite();
433        _value.setReference(reference);
434    }
435    
436    public boolean getReferenceHasBeenModified() {
437        return _value.getReferenceHasBeenModified();
438    }
439    
440    public String getDescription() {
441        return _value.getDescription();
442    }
443    
444    public void setDescription(String description)
445            throws PersistenceNotNullException, PersistenceReadOnlyException {
446        checkReadWrite();
447        _value.setDescription(description);
448    }
449    
450    public boolean getDescriptionHasBeenModified() {
451        return _value.getDescriptionHasBeenModified();
452    }
453    
454    public Long getFromTime() {
455        return _value.getFromTime();
456    }
457    
458    public void setFromTime(Long fromTime)
459            throws PersistenceNotNullException, PersistenceReadOnlyException {
460        checkReadWrite();
461        _value.setFromTime(fromTime);
462    }
463    
464    public boolean getFromTimeHasBeenModified() {
465        return _value.getFromTimeHasBeenModified();
466    }
467    
468    public Long getThruTime() {
469        return _value.getThruTime();
470    }
471    
472    public void setThruTime(Long thruTime)
473            throws PersistenceNotNullException, PersistenceReadOnlyException {
474        checkReadWrite();
475        _value.setThruTime(thruTime);
476    }
477    
478    public boolean getThruTimeHasBeenModified() {
479        return _value.getThruTimeHasBeenModified();
480    }
481    
482}