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