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 * 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
067import javax.annotation.Nonnull;
068import javax.annotation.Nullable;
069
070public class TransactionGlEntry
071        extends BaseEntity
072        implements Serializable {
073    
074    private TransactionGlEntryPK _pk;
075    private TransactionGlEntryValue _value;
076    
077    /** Creates a new instance of TransactionGlEntry */
078    public TransactionGlEntry()
079            throws PersistenceException {
080        super();
081    }
082    
083    /** Creates a new instance of TransactionGlEntry */
084    public TransactionGlEntry(TransactionGlEntryValue value, EntityPermission entityPermission) {
085        super(entityPermission);
086        
087        _value = value;
088        _pk = value.getPrimaryKey();
089    }
090    
091    @Override
092    @Nonnull
093    public TransactionGlEntryFactory getBaseFactoryInstance() {
094        return TransactionGlEntryFactory.getInstance();
095    }
096    
097    @Override
098    public boolean hasBeenModified() {
099        return _value.hasBeenModified();
100    }
101    
102    @Override
103    public int hashCode() {
104        return _pk.hashCode();
105    }
106    
107    @Override
108    @Nonnull
109    public String toString() {
110        return _pk.toString();
111    }
112    
113    @Override
114    public boolean equals(Object other) {
115        if(this == other)
116            return true;
117        
118        if(other instanceof TransactionGlEntry that) {
119            TransactionGlEntryValue thatValue = that.getTransactionGlEntryValue();
120            return _value.equals(thatValue);
121        } else {
122            return false;
123        }
124    }
125    
126    @Override
127    public void store()
128            throws PersistenceDatabaseException {
129        getBaseFactoryInstance().store(this);
130    }
131    
132    @Override
133    public void remove()
134            throws PersistenceDatabaseException {
135        getBaseFactoryInstance().remove(this);
136    }
137    
138    @Nonnull
139    public TransactionGlEntryValue getTransactionGlEntryValue() {
140        return _value;
141    }
142    
143    public void setTransactionGlEntryValue(@Nonnull TransactionGlEntryValue value)
144            throws PersistenceReadOnlyException {
145        checkReadWrite();
146        _value = value;
147    }
148    
149    @Override
150    @Nonnull
151    public TransactionGlEntryPK getPrimaryKey() {
152        return _pk;
153    }
154    
155    @Nonnull
156    public TransactionPK getTransactionPK() {
157        return _value.getTransactionPK();
158    }
159    
160    @Nonnull
161    public Transaction getTransaction(EntityPermission entityPermission) {
162        return TransactionFactory.getInstance().getEntityFromPK(entityPermission, getTransactionPK());
163    }
164    
165    @Nonnull
166    public Transaction getTransaction() {
167        return getTransaction(EntityPermission.READ_ONLY);
168    }
169    
170    @Nonnull
171    public Transaction getTransactionForUpdate() {
172        return getTransaction(EntityPermission.READ_WRITE);
173    }
174    
175    public void setTransactionPK(@Nonnull TransactionPK transactionPK)
176            throws PersistenceNotNullException, PersistenceReadOnlyException {
177        checkReadWrite();
178        _value.setTransactionPK(transactionPK);
179    }
180    
181    public void setTransaction(@Nonnull Transaction entity) {
182        setTransactionPK(entity == null ? null : entity.getPrimaryKey());
183    }
184    
185    public boolean getTransactionPKHasBeenModified() {
186        return _value.getTransactionPKHasBeenModified();
187    }
188    
189    @Nonnull
190    public Integer getTransactionGlEntrySequence() {
191        return _value.getTransactionGlEntrySequence();
192    }
193    
194    public void setTransactionGlEntrySequence(@Nonnull Integer transactionGlEntrySequence)
195            throws PersistenceNotNullException, PersistenceReadOnlyException {
196        checkReadWrite();
197        _value.setTransactionGlEntrySequence(transactionGlEntrySequence);
198    }
199    
200    public boolean getTransactionGlEntrySequenceHasBeenModified() {
201        return _value.getTransactionGlEntrySequenceHasBeenModified();
202    }
203    
204    @Nonnull
205    public PartyPK getGroupPartyPK() {
206        return _value.getGroupPartyPK();
207    }
208    
209    @Nonnull
210    public Party getGroupParty(EntityPermission entityPermission) {
211        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getGroupPartyPK());
212    }
213    
214    @Nonnull
215    public Party getGroupParty() {
216        return getGroupParty(EntityPermission.READ_ONLY);
217    }
218    
219    @Nonnull
220    public Party getGroupPartyForUpdate() {
221        return getGroupParty(EntityPermission.READ_WRITE);
222    }
223    
224    public void setGroupPartyPK(@Nonnull PartyPK groupPartyPK)
225            throws PersistenceNotNullException, PersistenceReadOnlyException {
226        checkReadWrite();
227        _value.setGroupPartyPK(groupPartyPK);
228    }
229    
230    public void setGroupParty(@Nonnull Party entity) {
231        setGroupPartyPK(entity == null ? null : entity.getPrimaryKey());
232    }
233    
234    public boolean getGroupPartyPKHasBeenModified() {
235        return _value.getGroupPartyPKHasBeenModified();
236    }
237    
238    @Nullable
239    public TransactionGlAccountCategoryPK getTransactionGlAccountCategoryPK() {
240        return _value.getTransactionGlAccountCategoryPK();
241    }
242    
243    @Nullable
244    public TransactionGlAccountCategory getTransactionGlAccountCategory(EntityPermission entityPermission) {
245        TransactionGlAccountCategoryPK pk = getTransactionGlAccountCategoryPK();
246        TransactionGlAccountCategory entity = pk == null? null: TransactionGlAccountCategoryFactory.getInstance().getEntityFromPK(entityPermission, pk);
247        
248        return entity;
249    }
250    
251    @Nullable
252    public TransactionGlAccountCategory getTransactionGlAccountCategory() {
253        return getTransactionGlAccountCategory(EntityPermission.READ_ONLY);
254    }
255    
256    @Nullable
257    public TransactionGlAccountCategory getTransactionGlAccountCategoryForUpdate() {
258        return getTransactionGlAccountCategory(EntityPermission.READ_WRITE);
259    }
260    
261    public void setTransactionGlAccountCategoryPK(@Nullable TransactionGlAccountCategoryPK transactionGlAccountCategoryPK)
262            throws PersistenceNotNullException, PersistenceReadOnlyException {
263        checkReadWrite();
264        _value.setTransactionGlAccountCategoryPK(transactionGlAccountCategoryPK);
265    }
266    
267    public void setTransactionGlAccountCategory(@Nullable TransactionGlAccountCategory entity) {
268        setTransactionGlAccountCategoryPK(entity == null ? null : entity.getPrimaryKey());
269    }
270    
271    public boolean getTransactionGlAccountCategoryPKHasBeenModified() {
272        return _value.getTransactionGlAccountCategoryPKHasBeenModified();
273    }
274    
275    @Nonnull
276    public GlAccountPK getGlAccountPK() {
277        return _value.getGlAccountPK();
278    }
279    
280    @Nonnull
281    public GlAccount getGlAccount(EntityPermission entityPermission) {
282        return GlAccountFactory.getInstance().getEntityFromPK(entityPermission, getGlAccountPK());
283    }
284    
285    @Nonnull
286    public GlAccount getGlAccount() {
287        return getGlAccount(EntityPermission.READ_ONLY);
288    }
289    
290    @Nonnull
291    public GlAccount getGlAccountForUpdate() {
292        return getGlAccount(EntityPermission.READ_WRITE);
293    }
294    
295    public void setGlAccountPK(@Nonnull GlAccountPK glAccountPK)
296            throws PersistenceNotNullException, PersistenceReadOnlyException {
297        checkReadWrite();
298        _value.setGlAccountPK(glAccountPK);
299    }
300    
301    public void setGlAccount(@Nonnull GlAccount entity) {
302        setGlAccountPK(entity == null ? null : entity.getPrimaryKey());
303    }
304    
305    public boolean getGlAccountPKHasBeenModified() {
306        return _value.getGlAccountPKHasBeenModified();
307    }
308    
309    @Nonnull
310    public CurrencyPK getOriginalCurrencyPK() {
311        return _value.getOriginalCurrencyPK();
312    }
313    
314    @Nonnull
315    public Currency getOriginalCurrency(EntityPermission entityPermission) {
316        return CurrencyFactory.getInstance().getEntityFromPK(entityPermission, getOriginalCurrencyPK());
317    }
318    
319    @Nonnull
320    public Currency getOriginalCurrency() {
321        return getOriginalCurrency(EntityPermission.READ_ONLY);
322    }
323    
324    @Nonnull
325    public Currency getOriginalCurrencyForUpdate() {
326        return getOriginalCurrency(EntityPermission.READ_WRITE);
327    }
328    
329    public void setOriginalCurrencyPK(@Nonnull CurrencyPK originalCurrencyPK)
330            throws PersistenceNotNullException, PersistenceReadOnlyException {
331        checkReadWrite();
332        _value.setOriginalCurrencyPK(originalCurrencyPK);
333    }
334    
335    public void setOriginalCurrency(@Nonnull Currency entity) {
336        setOriginalCurrencyPK(entity == null ? null : entity.getPrimaryKey());
337    }
338    
339    public boolean getOriginalCurrencyPKHasBeenModified() {
340        return _value.getOriginalCurrencyPKHasBeenModified();
341    }
342    
343    @Nullable
344    public Long getOriginalDebit() {
345        return _value.getOriginalDebit();
346    }
347    
348    public void setOriginalDebit(@Nullable Long originalDebit)
349            throws PersistenceNotNullException, PersistenceReadOnlyException {
350        checkReadWrite();
351        _value.setOriginalDebit(originalDebit);
352    }
353    
354    public boolean getOriginalDebitHasBeenModified() {
355        return _value.getOriginalDebitHasBeenModified();
356    }
357    
358    @Nullable
359    public Long getOriginalCredit() {
360        return _value.getOriginalCredit();
361    }
362    
363    public void setOriginalCredit(@Nullable Long originalCredit)
364            throws PersistenceNotNullException, PersistenceReadOnlyException {
365        checkReadWrite();
366        _value.setOriginalCredit(originalCredit);
367    }
368    
369    public boolean getOriginalCreditHasBeenModified() {
370        return _value.getOriginalCreditHasBeenModified();
371    }
372    
373    @Nullable
374    public Long getDebit() {
375        return _value.getDebit();
376    }
377    
378    public void setDebit(@Nullable Long debit)
379            throws PersistenceNotNullException, PersistenceReadOnlyException {
380        checkReadWrite();
381        _value.setDebit(debit);
382    }
383    
384    public boolean getDebitHasBeenModified() {
385        return _value.getDebitHasBeenModified();
386    }
387    
388    @Nullable
389    public Long getCredit() {
390        return _value.getCredit();
391    }
392    
393    public void setCredit(@Nullable Long credit)
394            throws PersistenceNotNullException, PersistenceReadOnlyException {
395        checkReadWrite();
396        _value.setCredit(credit);
397    }
398    
399    public boolean getCreditHasBeenModified() {
400        return _value.getCreditHasBeenModified();
401    }
402    
403    @Nonnull
404    public Long getFromTime() {
405        return _value.getFromTime();
406    }
407    
408    public void setFromTime(@Nonnull Long fromTime)
409            throws PersistenceNotNullException, PersistenceReadOnlyException {
410        checkReadWrite();
411        _value.setFromTime(fromTime);
412    }
413    
414    public boolean getFromTimeHasBeenModified() {
415        return _value.getFromTimeHasBeenModified();
416    }
417    
418    @Nonnull
419    public Long getThruTime() {
420        return _value.getThruTime();
421    }
422    
423    public void setThruTime(@Nonnull Long thruTime)
424            throws PersistenceNotNullException, PersistenceReadOnlyException {
425        checkReadWrite();
426        _value.setThruTime(thruTime);
427    }
428    
429    public boolean getThruTimeHasBeenModified() {
430        return _value.getThruTimeHasBeenModified();
431    }
432    
433}