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 * TransactionGlEntry.java
021 */
022
023package com.echothree.model.data.accounting.server.entity;
024
025import com.echothree.model.data.accounting.common.pk.TransactionGlEntryPK;
026
027import com.echothree.model.data.accounting.common.pk.TransactionPK;
028import com.echothree.model.data.party.common.pk.PartyPK;
029import com.echothree.model.data.accounting.common.pk.TransactionGlAccountCategoryPK;
030import com.echothree.model.data.accounting.common.pk.GlAccountPK;
031import com.echothree.model.data.accounting.common.pk.CurrencyPK;
032
033import com.echothree.model.data.accounting.server.entity.Transaction;
034import com.echothree.model.data.party.server.entity.Party;
035import com.echothree.model.data.accounting.server.entity.TransactionGlAccountCategory;
036import com.echothree.model.data.accounting.server.entity.GlAccount;
037import com.echothree.model.data.accounting.server.entity.Currency;
038
039import com.echothree.model.data.accounting.server.factory.TransactionFactory;
040import com.echothree.model.data.party.server.factory.PartyFactory;
041import com.echothree.model.data.accounting.server.factory.TransactionGlAccountCategoryFactory;
042import com.echothree.model.data.accounting.server.factory.GlAccountFactory;
043import com.echothree.model.data.accounting.server.factory.CurrencyFactory;
044
045import com.echothree.model.data.accounting.common.pk.TransactionGlEntryPK;
046
047import com.echothree.model.data.accounting.server.value.TransactionGlEntryValue;
048
049import com.echothree.model.data.accounting.server.factory.TransactionGlEntryFactory;
050
051import com.echothree.util.common.exception.PersistenceException;
052import com.echothree.util.common.exception.PersistenceDatabaseException;
053import com.echothree.util.common.exception.PersistenceNotNullException;
054import com.echothree.util.common.exception.PersistenceReadOnlyException;
055
056import com.echothree.util.common.persistence.BasePK;
057
058import com.echothree.util.common.persistence.type.ByteArray;
059
060import com.echothree.util.server.persistence.BaseEntity;
061import com.echothree.util.server.persistence.EntityPermission;
062import com.echothree.util.server.persistence.Session;
063import com.echothree.util.server.persistence.ThreadSession;
064
065import java.io.Serializable;
066
067public class TransactionGlEntry
068        extends BaseEntity
069        implements Serializable {
070    
071    private TransactionGlEntryPK _pk;
072    private TransactionGlEntryValue _value;
073    
074    /** Creates a new instance of TransactionGlEntry */
075    public TransactionGlEntry()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of TransactionGlEntry */
081    public TransactionGlEntry(TransactionGlEntryValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    public TransactionGlEntryFactory getBaseFactoryInstance() {
090        return TransactionGlEntryFactory.getInstance();
091    }
092    
093    @Override
094    public boolean hasBeenModified() {
095        return _value.hasBeenModified();
096    }
097    
098    @Override
099    public int hashCode() {
100        return _pk.hashCode();
101    }
102    
103    @Override
104    public String toString() {
105        return _pk.toString();
106    }
107    
108    @Override
109    public boolean equals(Object other) {
110        if(this == other)
111            return true;
112        
113        if(other instanceof TransactionGlEntry that) {
114            TransactionGlEntryValue thatValue = that.getTransactionGlEntryValue();
115            return _value.equals(thatValue);
116        } else {
117            return false;
118        }
119    }
120    
121    @Override
122    public void store(Session session)
123            throws PersistenceDatabaseException {
124        getBaseFactoryInstance().store(session, this);
125    }
126    
127    @Override
128    public void remove(Session session)
129            throws PersistenceDatabaseException {
130        getBaseFactoryInstance().remove(session, this);
131    }
132    
133    @Override
134    public void remove()
135            throws PersistenceDatabaseException {
136        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
137    }
138    
139    public TransactionGlEntryValue getTransactionGlEntryValue() {
140        return _value;
141    }
142    
143    public void setTransactionGlEntryValue(TransactionGlEntryValue value)
144            throws PersistenceReadOnlyException {
145        checkReadWrite();
146        _value = value;
147    }
148    
149    @Override
150    public TransactionGlEntryPK getPrimaryKey() {
151        return _pk;
152    }
153    
154    public TransactionPK getTransactionPK() {
155        return _value.getTransactionPK();
156    }
157    
158    public Transaction getTransaction(Session session, EntityPermission entityPermission) {
159        return TransactionFactory.getInstance().getEntityFromPK(session, entityPermission, getTransactionPK());
160    }
161    
162    public Transaction getTransaction(EntityPermission entityPermission) {
163        return getTransaction(ThreadSession.currentSession(), entityPermission);
164    }
165    
166    public Transaction getTransaction(Session session) {
167        return getTransaction(session, EntityPermission.READ_ONLY);
168    }
169    
170    public Transaction getTransaction() {
171        return getTransaction(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
172    }
173    
174    public Transaction getTransactionForUpdate(Session session) {
175        return getTransaction(session, EntityPermission.READ_WRITE);
176    }
177    
178    public Transaction getTransactionForUpdate() {
179        return getTransaction(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
180    }
181    
182    public void setTransactionPK(TransactionPK transactionPK)
183            throws PersistenceNotNullException, PersistenceReadOnlyException {
184        checkReadWrite();
185        _value.setTransactionPK(transactionPK);
186    }
187    
188    public void setTransaction(Transaction entity) {
189        setTransactionPK(entity == null? null: entity.getPrimaryKey());
190    }
191    
192    public boolean getTransactionPKHasBeenModified() {
193        return _value.getTransactionPKHasBeenModified();
194    }
195    
196    public Integer getTransactionGlEntrySequence() {
197        return _value.getTransactionGlEntrySequence();
198    }
199    
200    public void setTransactionGlEntrySequence(Integer transactionGlEntrySequence)
201            throws PersistenceNotNullException, PersistenceReadOnlyException {
202        checkReadWrite();
203        _value.setTransactionGlEntrySequence(transactionGlEntrySequence);
204    }
205    
206    public boolean getTransactionGlEntrySequenceHasBeenModified() {
207        return _value.getTransactionGlEntrySequenceHasBeenModified();
208    }
209    
210    public PartyPK getGroupPartyPK() {
211        return _value.getGroupPartyPK();
212    }
213    
214    public Party getGroupParty(Session session, EntityPermission entityPermission) {
215        return PartyFactory.getInstance().getEntityFromPK(session, entityPermission, getGroupPartyPK());
216    }
217    
218    public Party getGroupParty(EntityPermission entityPermission) {
219        return getGroupParty(ThreadSession.currentSession(), entityPermission);
220    }
221    
222    public Party getGroupParty(Session session) {
223        return getGroupParty(session, EntityPermission.READ_ONLY);
224    }
225    
226    public Party getGroupParty() {
227        return getGroupParty(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
228    }
229    
230    public Party getGroupPartyForUpdate(Session session) {
231        return getGroupParty(session, EntityPermission.READ_WRITE);
232    }
233    
234    public Party getGroupPartyForUpdate() {
235        return getGroupParty(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
236    }
237    
238    public void setGroupPartyPK(PartyPK groupPartyPK)
239            throws PersistenceNotNullException, PersistenceReadOnlyException {
240        checkReadWrite();
241        _value.setGroupPartyPK(groupPartyPK);
242    }
243    
244    public void setGroupParty(Party entity) {
245        setGroupPartyPK(entity == null? null: entity.getPrimaryKey());
246    }
247    
248    public boolean getGroupPartyPKHasBeenModified() {
249        return _value.getGroupPartyPKHasBeenModified();
250    }
251    
252    public TransactionGlAccountCategoryPK getTransactionGlAccountCategoryPK() {
253        return _value.getTransactionGlAccountCategoryPK();
254    }
255    
256    public TransactionGlAccountCategory getTransactionGlAccountCategory(Session session, EntityPermission entityPermission) {
257        TransactionGlAccountCategoryPK pk = getTransactionGlAccountCategoryPK();
258        TransactionGlAccountCategory entity = pk == null? null: TransactionGlAccountCategoryFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
259        
260        return entity;
261    }
262    
263    public TransactionGlAccountCategory getTransactionGlAccountCategory(EntityPermission entityPermission) {
264        return getTransactionGlAccountCategory(ThreadSession.currentSession(), entityPermission);
265    }
266    
267    public TransactionGlAccountCategory getTransactionGlAccountCategory(Session session) {
268        return getTransactionGlAccountCategory(session, EntityPermission.READ_ONLY);
269    }
270    
271    public TransactionGlAccountCategory getTransactionGlAccountCategory() {
272        return getTransactionGlAccountCategory(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
273    }
274    
275    public TransactionGlAccountCategory getTransactionGlAccountCategoryForUpdate(Session session) {
276        return getTransactionGlAccountCategory(session, EntityPermission.READ_WRITE);
277    }
278    
279    public TransactionGlAccountCategory getTransactionGlAccountCategoryForUpdate() {
280        return getTransactionGlAccountCategory(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
281    }
282    
283    public void setTransactionGlAccountCategoryPK(TransactionGlAccountCategoryPK transactionGlAccountCategoryPK)
284            throws PersistenceNotNullException, PersistenceReadOnlyException {
285        checkReadWrite();
286        _value.setTransactionGlAccountCategoryPK(transactionGlAccountCategoryPK);
287    }
288    
289    public void setTransactionGlAccountCategory(TransactionGlAccountCategory entity) {
290        setTransactionGlAccountCategoryPK(entity == null? null: entity.getPrimaryKey());
291    }
292    
293    public boolean getTransactionGlAccountCategoryPKHasBeenModified() {
294        return _value.getTransactionGlAccountCategoryPKHasBeenModified();
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 CurrencyPK getOriginalCurrencyPK() {
340        return _value.getOriginalCurrencyPK();
341    }
342    
343    public Currency getOriginalCurrency(Session session, EntityPermission entityPermission) {
344        return CurrencyFactory.getInstance().getEntityFromPK(session, entityPermission, getOriginalCurrencyPK());
345    }
346    
347    public Currency getOriginalCurrency(EntityPermission entityPermission) {
348        return getOriginalCurrency(ThreadSession.currentSession(), entityPermission);
349    }
350    
351    public Currency getOriginalCurrency(Session session) {
352        return getOriginalCurrency(session, EntityPermission.READ_ONLY);
353    }
354    
355    public Currency getOriginalCurrency() {
356        return getOriginalCurrency(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
357    }
358    
359    public Currency getOriginalCurrencyForUpdate(Session session) {
360        return getOriginalCurrency(session, EntityPermission.READ_WRITE);
361    }
362    
363    public Currency getOriginalCurrencyForUpdate() {
364        return getOriginalCurrency(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
365    }
366    
367    public void setOriginalCurrencyPK(CurrencyPK originalCurrencyPK)
368            throws PersistenceNotNullException, PersistenceReadOnlyException {
369        checkReadWrite();
370        _value.setOriginalCurrencyPK(originalCurrencyPK);
371    }
372    
373    public void setOriginalCurrency(Currency entity) {
374        setOriginalCurrencyPK(entity == null? null: entity.getPrimaryKey());
375    }
376    
377    public boolean getOriginalCurrencyPKHasBeenModified() {
378        return _value.getOriginalCurrencyPKHasBeenModified();
379    }
380    
381    public Long getOriginalDebit() {
382        return _value.getOriginalDebit();
383    }
384    
385    public void setOriginalDebit(Long originalDebit)
386            throws PersistenceNotNullException, PersistenceReadOnlyException {
387        checkReadWrite();
388        _value.setOriginalDebit(originalDebit);
389    }
390    
391    public boolean getOriginalDebitHasBeenModified() {
392        return _value.getOriginalDebitHasBeenModified();
393    }
394    
395    public Long getOriginalCredit() {
396        return _value.getOriginalCredit();
397    }
398    
399    public void setOriginalCredit(Long originalCredit)
400            throws PersistenceNotNullException, PersistenceReadOnlyException {
401        checkReadWrite();
402        _value.setOriginalCredit(originalCredit);
403    }
404    
405    public boolean getOriginalCreditHasBeenModified() {
406        return _value.getOriginalCreditHasBeenModified();
407    }
408    
409    public Long getDebit() {
410        return _value.getDebit();
411    }
412    
413    public void setDebit(Long debit)
414            throws PersistenceNotNullException, PersistenceReadOnlyException {
415        checkReadWrite();
416        _value.setDebit(debit);
417    }
418    
419    public boolean getDebitHasBeenModified() {
420        return _value.getDebitHasBeenModified();
421    }
422    
423    public Long getCredit() {
424        return _value.getCredit();
425    }
426    
427    public void setCredit(Long credit)
428            throws PersistenceNotNullException, PersistenceReadOnlyException {
429        checkReadWrite();
430        _value.setCredit(credit);
431    }
432    
433    public boolean getCreditHasBeenModified() {
434        return _value.getCreditHasBeenModified();
435    }
436    
437    public Long getFromTime() {
438        return _value.getFromTime();
439    }
440    
441    public void setFromTime(Long fromTime)
442            throws PersistenceNotNullException, PersistenceReadOnlyException {
443        checkReadWrite();
444        _value.setFromTime(fromTime);
445    }
446    
447    public boolean getFromTimeHasBeenModified() {
448        return _value.getFromTimeHasBeenModified();
449    }
450    
451    public Long getThruTime() {
452        return _value.getThruTime();
453    }
454    
455    public void setThruTime(Long thruTime)
456            throws PersistenceNotNullException, PersistenceReadOnlyException {
457        checkReadWrite();
458        _value.setThruTime(thruTime);
459    }
460    
461    public boolean getThruTimeHasBeenModified() {
462        return _value.getThruTimeHasBeenModified();
463    }
464    
465}