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