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 * PartyDetail.java
021 */
022
023package com.echothree.model.data.party.server.entity;
024
025import com.echothree.model.data.party.common.pk.PartyDetailPK;
026
027import com.echothree.model.data.party.common.pk.PartyPK;
028import com.echothree.model.data.party.common.pk.PartyTypePK;
029import com.echothree.model.data.party.common.pk.LanguagePK;
030import com.echothree.model.data.accounting.common.pk.CurrencyPK;
031import com.echothree.model.data.party.common.pk.TimeZonePK;
032import com.echothree.model.data.party.common.pk.DateTimeFormatPK;
033
034import com.echothree.model.data.party.server.entity.Party;
035import com.echothree.model.data.party.server.entity.PartyType;
036import com.echothree.model.data.party.server.entity.Language;
037import com.echothree.model.data.accounting.server.entity.Currency;
038import com.echothree.model.data.party.server.entity.TimeZone;
039import com.echothree.model.data.party.server.entity.DateTimeFormat;
040
041import com.echothree.model.data.party.server.factory.PartyFactory;
042import com.echothree.model.data.party.server.factory.PartyTypeFactory;
043import com.echothree.model.data.party.server.factory.LanguageFactory;
044import com.echothree.model.data.accounting.server.factory.CurrencyFactory;
045import com.echothree.model.data.party.server.factory.TimeZoneFactory;
046import com.echothree.model.data.party.server.factory.DateTimeFormatFactory;
047
048import com.echothree.model.data.party.common.pk.PartyDetailPK;
049
050import com.echothree.model.data.party.server.value.PartyDetailValue;
051
052import com.echothree.model.data.party.server.factory.PartyDetailFactory;
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 PartyDetail
071        extends BaseEntity
072        implements Serializable {
073    
074    private PartyDetailPK _pk;
075    private PartyDetailValue _value;
076    
077    /** Creates a new instance of PartyDetail */
078    public PartyDetail()
079            throws PersistenceException {
080        super();
081    }
082    
083    /** Creates a new instance of PartyDetail */
084    public PartyDetail(PartyDetailValue value, EntityPermission entityPermission) {
085        super(entityPermission);
086        
087        _value = value;
088        _pk = value.getPrimaryKey();
089    }
090    
091    @Override
092    public PartyDetailFactory getBaseFactoryInstance() {
093        return PartyDetailFactory.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 PartyDetail) {
117            PartyDetail that = (PartyDetail)other;
118            
119            PartyDetailValue thatValue = that.getPartyDetailValue();
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 PartyDetailValue getPartyDetailValue() {
145        return _value;
146    }
147    
148    public void setPartyDetailValue(PartyDetailValue value)
149            throws PersistenceReadOnlyException {
150        checkReadWrite();
151        _value = value;
152    }
153    
154    @Override
155    public PartyDetailPK getPrimaryKey() {
156        return _pk;
157    }
158    
159    public PartyPK getPartyPK() {
160        return _value.getPartyPK();
161    }
162    
163    public Party getParty(Session session, EntityPermission entityPermission) {
164        return PartyFactory.getInstance().getEntityFromPK(session, entityPermission, getPartyPK());
165    }
166    
167    public Party getParty(EntityPermission entityPermission) {
168        return getParty(ThreadSession.currentSession(), entityPermission);
169    }
170    
171    public Party getParty(Session session) {
172        return getParty(session, EntityPermission.READ_ONLY);
173    }
174    
175    public Party getParty() {
176        return getParty(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
177    }
178    
179    public Party getPartyForUpdate(Session session) {
180        return getParty(session, EntityPermission.READ_WRITE);
181    }
182    
183    public Party getPartyForUpdate() {
184        return getParty(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
185    }
186    
187    public void setPartyPK(PartyPK partyPK)
188            throws PersistenceNotNullException, PersistenceReadOnlyException {
189        checkReadWrite();
190        _value.setPartyPK(partyPK);
191    }
192    
193    public void setParty(Party entity) {
194        setPartyPK(entity == null? null: entity.getPrimaryKey());
195    }
196    
197    public boolean getPartyPKHasBeenModified() {
198        return _value.getPartyPKHasBeenModified();
199    }
200    
201    public String getPartyName() {
202        return _value.getPartyName();
203    }
204    
205    public void setPartyName(String partyName)
206            throws PersistenceNotNullException, PersistenceReadOnlyException {
207        checkReadWrite();
208        _value.setPartyName(partyName);
209    }
210    
211    public boolean getPartyNameHasBeenModified() {
212        return _value.getPartyNameHasBeenModified();
213    }
214    
215    public PartyTypePK getPartyTypePK() {
216        return _value.getPartyTypePK();
217    }
218    
219    public PartyType getPartyType(Session session, EntityPermission entityPermission) {
220        return PartyTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getPartyTypePK());
221    }
222    
223    public PartyType getPartyType(EntityPermission entityPermission) {
224        return getPartyType(ThreadSession.currentSession(), entityPermission);
225    }
226    
227    public PartyType getPartyType(Session session) {
228        return getPartyType(session, EntityPermission.READ_ONLY);
229    }
230    
231    public PartyType getPartyType() {
232        return getPartyType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
233    }
234    
235    public PartyType getPartyTypeForUpdate(Session session) {
236        return getPartyType(session, EntityPermission.READ_WRITE);
237    }
238    
239    public PartyType getPartyTypeForUpdate() {
240        return getPartyType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
241    }
242    
243    public void setPartyTypePK(PartyTypePK partyTypePK)
244            throws PersistenceNotNullException, PersistenceReadOnlyException {
245        checkReadWrite();
246        _value.setPartyTypePK(partyTypePK);
247    }
248    
249    public void setPartyType(PartyType entity) {
250        setPartyTypePK(entity == null? null: entity.getPrimaryKey());
251    }
252    
253    public boolean getPartyTypePKHasBeenModified() {
254        return _value.getPartyTypePKHasBeenModified();
255    }
256    
257    public LanguagePK getPreferredLanguagePK() {
258        return _value.getPreferredLanguagePK();
259    }
260    
261    public Language getPreferredLanguage(Session session, EntityPermission entityPermission) {
262        LanguagePK pk = getPreferredLanguagePK();
263        Language entity = pk == null? null: LanguageFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
264        
265        return entity;
266    }
267    
268    public Language getPreferredLanguage(EntityPermission entityPermission) {
269        return getPreferredLanguage(ThreadSession.currentSession(), entityPermission);
270    }
271    
272    public Language getPreferredLanguage(Session session) {
273        return getPreferredLanguage(session, EntityPermission.READ_ONLY);
274    }
275    
276    public Language getPreferredLanguage() {
277        return getPreferredLanguage(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
278    }
279    
280    public Language getPreferredLanguageForUpdate(Session session) {
281        return getPreferredLanguage(session, EntityPermission.READ_WRITE);
282    }
283    
284    public Language getPreferredLanguageForUpdate() {
285        return getPreferredLanguage(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
286    }
287    
288    public void setPreferredLanguagePK(LanguagePK preferredLanguagePK)
289            throws PersistenceNotNullException, PersistenceReadOnlyException {
290        checkReadWrite();
291        _value.setPreferredLanguagePK(preferredLanguagePK);
292    }
293    
294    public void setPreferredLanguage(Language entity) {
295        setPreferredLanguagePK(entity == null? null: entity.getPrimaryKey());
296    }
297    
298    public boolean getPreferredLanguagePKHasBeenModified() {
299        return _value.getPreferredLanguagePKHasBeenModified();
300    }
301    
302    public CurrencyPK getPreferredCurrencyPK() {
303        return _value.getPreferredCurrencyPK();
304    }
305    
306    public Currency getPreferredCurrency(Session session, EntityPermission entityPermission) {
307        CurrencyPK pk = getPreferredCurrencyPK();
308        Currency entity = pk == null? null: CurrencyFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
309        
310        return entity;
311    }
312    
313    public Currency getPreferredCurrency(EntityPermission entityPermission) {
314        return getPreferredCurrency(ThreadSession.currentSession(), entityPermission);
315    }
316    
317    public Currency getPreferredCurrency(Session session) {
318        return getPreferredCurrency(session, EntityPermission.READ_ONLY);
319    }
320    
321    public Currency getPreferredCurrency() {
322        return getPreferredCurrency(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
323    }
324    
325    public Currency getPreferredCurrencyForUpdate(Session session) {
326        return getPreferredCurrency(session, EntityPermission.READ_WRITE);
327    }
328    
329    public Currency getPreferredCurrencyForUpdate() {
330        return getPreferredCurrency(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
331    }
332    
333    public void setPreferredCurrencyPK(CurrencyPK preferredCurrencyPK)
334            throws PersistenceNotNullException, PersistenceReadOnlyException {
335        checkReadWrite();
336        _value.setPreferredCurrencyPK(preferredCurrencyPK);
337    }
338    
339    public void setPreferredCurrency(Currency entity) {
340        setPreferredCurrencyPK(entity == null? null: entity.getPrimaryKey());
341    }
342    
343    public boolean getPreferredCurrencyPKHasBeenModified() {
344        return _value.getPreferredCurrencyPKHasBeenModified();
345    }
346    
347    public TimeZonePK getPreferredTimeZonePK() {
348        return _value.getPreferredTimeZonePK();
349    }
350    
351    public TimeZone getPreferredTimeZone(Session session, EntityPermission entityPermission) {
352        TimeZonePK pk = getPreferredTimeZonePK();
353        TimeZone entity = pk == null? null: TimeZoneFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
354        
355        return entity;
356    }
357    
358    public TimeZone getPreferredTimeZone(EntityPermission entityPermission) {
359        return getPreferredTimeZone(ThreadSession.currentSession(), entityPermission);
360    }
361    
362    public TimeZone getPreferredTimeZone(Session session) {
363        return getPreferredTimeZone(session, EntityPermission.READ_ONLY);
364    }
365    
366    public TimeZone getPreferredTimeZone() {
367        return getPreferredTimeZone(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
368    }
369    
370    public TimeZone getPreferredTimeZoneForUpdate(Session session) {
371        return getPreferredTimeZone(session, EntityPermission.READ_WRITE);
372    }
373    
374    public TimeZone getPreferredTimeZoneForUpdate() {
375        return getPreferredTimeZone(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
376    }
377    
378    public void setPreferredTimeZonePK(TimeZonePK preferredTimeZonePK)
379            throws PersistenceNotNullException, PersistenceReadOnlyException {
380        checkReadWrite();
381        _value.setPreferredTimeZonePK(preferredTimeZonePK);
382    }
383    
384    public void setPreferredTimeZone(TimeZone entity) {
385        setPreferredTimeZonePK(entity == null? null: entity.getPrimaryKey());
386    }
387    
388    public boolean getPreferredTimeZonePKHasBeenModified() {
389        return _value.getPreferredTimeZonePKHasBeenModified();
390    }
391    
392    public DateTimeFormatPK getPreferredDateTimeFormatPK() {
393        return _value.getPreferredDateTimeFormatPK();
394    }
395    
396    public DateTimeFormat getPreferredDateTimeFormat(Session session, EntityPermission entityPermission) {
397        DateTimeFormatPK pk = getPreferredDateTimeFormatPK();
398        DateTimeFormat entity = pk == null? null: DateTimeFormatFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
399        
400        return entity;
401    }
402    
403    public DateTimeFormat getPreferredDateTimeFormat(EntityPermission entityPermission) {
404        return getPreferredDateTimeFormat(ThreadSession.currentSession(), entityPermission);
405    }
406    
407    public DateTimeFormat getPreferredDateTimeFormat(Session session) {
408        return getPreferredDateTimeFormat(session, EntityPermission.READ_ONLY);
409    }
410    
411    public DateTimeFormat getPreferredDateTimeFormat() {
412        return getPreferredDateTimeFormat(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
413    }
414    
415    public DateTimeFormat getPreferredDateTimeFormatForUpdate(Session session) {
416        return getPreferredDateTimeFormat(session, EntityPermission.READ_WRITE);
417    }
418    
419    public DateTimeFormat getPreferredDateTimeFormatForUpdate() {
420        return getPreferredDateTimeFormat(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
421    }
422    
423    public void setPreferredDateTimeFormatPK(DateTimeFormatPK preferredDateTimeFormatPK)
424            throws PersistenceNotNullException, PersistenceReadOnlyException {
425        checkReadWrite();
426        _value.setPreferredDateTimeFormatPK(preferredDateTimeFormatPK);
427    }
428    
429    public void setPreferredDateTimeFormat(DateTimeFormat entity) {
430        setPreferredDateTimeFormatPK(entity == null? null: entity.getPrimaryKey());
431    }
432    
433    public boolean getPreferredDateTimeFormatPKHasBeenModified() {
434        return _value.getPreferredDateTimeFormatPKHasBeenModified();
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}