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 * 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) {
111            FinancialAccountDetail that = (FinancialAccountDetail)other;
112            
113            FinancialAccountDetailValue thatValue = that.getFinancialAccountDetailValue();
114            return _value.equals(thatValue);
115        } else {
116            return false;
117        }
118    }
119    
120    @Override
121    public void store(Session session)
122            throws PersistenceDatabaseException {
123        getBaseFactoryInstance().store(session, this);
124    }
125    
126    @Override
127    public void remove(Session session)
128            throws PersistenceDatabaseException {
129        getBaseFactoryInstance().remove(session, this);
130    }
131    
132    @Override
133    public void remove()
134            throws PersistenceDatabaseException {
135        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
136    }
137    
138    public FinancialAccountDetailValue getFinancialAccountDetailValue() {
139        return _value;
140    }
141    
142    public void setFinancialAccountDetailValue(FinancialAccountDetailValue value)
143            throws PersistenceReadOnlyException {
144        checkReadWrite();
145        _value = value;
146    }
147    
148    @Override
149    public FinancialAccountDetailPK getPrimaryKey() {
150        return _pk;
151    }
152    
153    public FinancialAccountPK getFinancialAccountPK() {
154        return _value.getFinancialAccountPK();
155    }
156    
157    public FinancialAccount getFinancialAccount(Session session, EntityPermission entityPermission) {
158        return FinancialAccountFactory.getInstance().getEntityFromPK(session, entityPermission, getFinancialAccountPK());
159    }
160    
161    public FinancialAccount getFinancialAccount(EntityPermission entityPermission) {
162        return getFinancialAccount(ThreadSession.currentSession(), entityPermission);
163    }
164    
165    public FinancialAccount getFinancialAccount(Session session) {
166        return getFinancialAccount(session, EntityPermission.READ_ONLY);
167    }
168    
169    public FinancialAccount getFinancialAccount() {
170        return getFinancialAccount(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
171    }
172    
173    public FinancialAccount getFinancialAccountForUpdate(Session session) {
174        return getFinancialAccount(session, EntityPermission.READ_WRITE);
175    }
176    
177    public FinancialAccount getFinancialAccountForUpdate() {
178        return getFinancialAccount(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
179    }
180    
181    public void setFinancialAccountPK(FinancialAccountPK financialAccountPK)
182            throws PersistenceNotNullException, PersistenceReadOnlyException {
183        checkReadWrite();
184        _value.setFinancialAccountPK(financialAccountPK);
185    }
186    
187    public void setFinancialAccount(FinancialAccount entity) {
188        setFinancialAccountPK(entity == null? null: entity.getPrimaryKey());
189    }
190    
191    public boolean getFinancialAccountPKHasBeenModified() {
192        return _value.getFinancialAccountPKHasBeenModified();
193    }
194    
195    public FinancialAccountTypePK getFinancialAccountTypePK() {
196        return _value.getFinancialAccountTypePK();
197    }
198    
199    public FinancialAccountType getFinancialAccountType(Session session, EntityPermission entityPermission) {
200        return FinancialAccountTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getFinancialAccountTypePK());
201    }
202    
203    public FinancialAccountType getFinancialAccountType(EntityPermission entityPermission) {
204        return getFinancialAccountType(ThreadSession.currentSession(), entityPermission);
205    }
206    
207    public FinancialAccountType getFinancialAccountType(Session session) {
208        return getFinancialAccountType(session, EntityPermission.READ_ONLY);
209    }
210    
211    public FinancialAccountType getFinancialAccountType() {
212        return getFinancialAccountType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
213    }
214    
215    public FinancialAccountType getFinancialAccountTypeForUpdate(Session session) {
216        return getFinancialAccountType(session, EntityPermission.READ_WRITE);
217    }
218    
219    public FinancialAccountType getFinancialAccountTypeForUpdate() {
220        return getFinancialAccountType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
221    }
222    
223    public void setFinancialAccountTypePK(FinancialAccountTypePK financialAccountTypePK)
224            throws PersistenceNotNullException, PersistenceReadOnlyException {
225        checkReadWrite();
226        _value.setFinancialAccountTypePK(financialAccountTypePK);
227    }
228    
229    public void setFinancialAccountType(FinancialAccountType entity) {
230        setFinancialAccountTypePK(entity == null? null: entity.getPrimaryKey());
231    }
232    
233    public boolean getFinancialAccountTypePKHasBeenModified() {
234        return _value.getFinancialAccountTypePKHasBeenModified();
235    }
236    
237    public String getFinancialAccountName() {
238        return _value.getFinancialAccountName();
239    }
240    
241    public void setFinancialAccountName(String financialAccountName)
242            throws PersistenceNotNullException, PersistenceReadOnlyException {
243        checkReadWrite();
244        _value.setFinancialAccountName(financialAccountName);
245    }
246    
247    public boolean getFinancialAccountNameHasBeenModified() {
248        return _value.getFinancialAccountNameHasBeenModified();
249    }
250    
251    public CurrencyPK getCurrencyPK() {
252        return _value.getCurrencyPK();
253    }
254    
255    public Currency getCurrency(Session session, EntityPermission entityPermission) {
256        return CurrencyFactory.getInstance().getEntityFromPK(session, entityPermission, getCurrencyPK());
257    }
258    
259    public Currency getCurrency(EntityPermission entityPermission) {
260        return getCurrency(ThreadSession.currentSession(), entityPermission);
261    }
262    
263    public Currency getCurrency(Session session) {
264        return getCurrency(session, EntityPermission.READ_ONLY);
265    }
266    
267    public Currency getCurrency() {
268        return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
269    }
270    
271    public Currency getCurrencyForUpdate(Session session) {
272        return getCurrency(session, EntityPermission.READ_WRITE);
273    }
274    
275    public Currency getCurrencyForUpdate() {
276        return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
277    }
278    
279    public void setCurrencyPK(CurrencyPK currencyPK)
280            throws PersistenceNotNullException, PersistenceReadOnlyException {
281        checkReadWrite();
282        _value.setCurrencyPK(currencyPK);
283    }
284    
285    public void setCurrency(Currency entity) {
286        setCurrencyPK(entity == null? null: entity.getPrimaryKey());
287    }
288    
289    public boolean getCurrencyPKHasBeenModified() {
290        return _value.getCurrencyPKHasBeenModified();
291    }
292    
293    public GlAccountPK getGlAccountPK() {
294        return _value.getGlAccountPK();
295    }
296    
297    public GlAccount getGlAccount(Session session, EntityPermission entityPermission) {
298        return GlAccountFactory.getInstance().getEntityFromPK(session, entityPermission, getGlAccountPK());
299    }
300    
301    public GlAccount getGlAccount(EntityPermission entityPermission) {
302        return getGlAccount(ThreadSession.currentSession(), entityPermission);
303    }
304    
305    public GlAccount getGlAccount(Session session) {
306        return getGlAccount(session, EntityPermission.READ_ONLY);
307    }
308    
309    public GlAccount getGlAccount() {
310        return getGlAccount(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
311    }
312    
313    public GlAccount getGlAccountForUpdate(Session session) {
314        return getGlAccount(session, EntityPermission.READ_WRITE);
315    }
316    
317    public GlAccount getGlAccountForUpdate() {
318        return getGlAccount(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
319    }
320    
321    public void setGlAccountPK(GlAccountPK glAccountPK)
322            throws PersistenceNotNullException, PersistenceReadOnlyException {
323        checkReadWrite();
324        _value.setGlAccountPK(glAccountPK);
325    }
326    
327    public void setGlAccount(GlAccount entity) {
328        setGlAccountPK(entity == null? null: entity.getPrimaryKey());
329    }
330    
331    public boolean getGlAccountPKHasBeenModified() {
332        return _value.getGlAccountPKHasBeenModified();
333    }
334    
335    public String getReference() {
336        return _value.getReference();
337    }
338    
339    public void setReference(String reference)
340            throws PersistenceNotNullException, PersistenceReadOnlyException {
341        checkReadWrite();
342        _value.setReference(reference);
343    }
344    
345    public boolean getReferenceHasBeenModified() {
346        return _value.getReferenceHasBeenModified();
347    }
348    
349    public String getDescription() {
350        return _value.getDescription();
351    }
352    
353    public void setDescription(String description)
354            throws PersistenceNotNullException, PersistenceReadOnlyException {
355        checkReadWrite();
356        _value.setDescription(description);
357    }
358    
359    public boolean getDescriptionHasBeenModified() {
360        return _value.getDescriptionHasBeenModified();
361    }
362    
363    public Long getFromTime() {
364        return _value.getFromTime();
365    }
366    
367    public void setFromTime(Long fromTime)
368            throws PersistenceNotNullException, PersistenceReadOnlyException {
369        checkReadWrite();
370        _value.setFromTime(fromTime);
371    }
372    
373    public boolean getFromTimeHasBeenModified() {
374        return _value.getFromTimeHasBeenModified();
375    }
376    
377    public Long getThruTime() {
378        return _value.getThruTime();
379    }
380    
381    public void setThruTime(Long thruTime)
382            throws PersistenceNotNullException, PersistenceReadOnlyException {
383        checkReadWrite();
384        _value.setThruTime(thruTime);
385    }
386    
387    public boolean getThruTimeHasBeenModified() {
388        return _value.getThruTimeHasBeenModified();
389    }
390    
391}