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 * LetterDetail.java
021 */
022
023package com.echothree.model.data.letter.server.entity;
024
025import com.echothree.model.data.letter.common.pk.LetterDetailPK;
026
027import com.echothree.model.data.letter.common.pk.LetterPK;
028import com.echothree.model.data.chain.common.pk.ChainTypePK;
029import com.echothree.model.data.letter.common.pk.LetterSourcePK;
030import com.echothree.model.data.contactlist.common.pk.ContactListPK;
031
032import com.echothree.model.data.letter.server.entity.Letter;
033import com.echothree.model.data.chain.server.entity.ChainType;
034import com.echothree.model.data.letter.server.entity.LetterSource;
035import com.echothree.model.data.contactlist.server.entity.ContactList;
036
037import com.echothree.model.data.letter.server.factory.LetterFactory;
038import com.echothree.model.data.chain.server.factory.ChainTypeFactory;
039import com.echothree.model.data.letter.server.factory.LetterSourceFactory;
040import com.echothree.model.data.contactlist.server.factory.ContactListFactory;
041
042import com.echothree.model.data.letter.common.pk.LetterDetailPK;
043
044import com.echothree.model.data.letter.server.value.LetterDetailValue;
045
046import com.echothree.model.data.letter.server.factory.LetterDetailFactory;
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 LetterDetail
065        extends BaseEntity
066        implements Serializable {
067    
068    private LetterDetailPK _pk;
069    private LetterDetailValue _value;
070    
071    /** Creates a new instance of LetterDetail */
072    public LetterDetail()
073            throws PersistenceException {
074        super();
075    }
076    
077    /** Creates a new instance of LetterDetail */
078    public LetterDetail(LetterDetailValue value, EntityPermission entityPermission) {
079        super(entityPermission);
080        
081        _value = value;
082        _pk = value.getPrimaryKey();
083    }
084    
085    @Override
086    public LetterDetailFactory getBaseFactoryInstance() {
087        return LetterDetailFactory.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 LetterDetail) {
111            LetterDetail that = (LetterDetail)other;
112            
113            LetterDetailValue thatValue = that.getLetterDetailValue();
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 LetterDetailValue getLetterDetailValue() {
139        return _value;
140    }
141    
142    public void setLetterDetailValue(LetterDetailValue value)
143            throws PersistenceReadOnlyException {
144        checkReadWrite();
145        _value = value;
146    }
147    
148    @Override
149    public LetterDetailPK getPrimaryKey() {
150        return _pk;
151    }
152    
153    public LetterPK getLetterPK() {
154        return _value.getLetterPK();
155    }
156    
157    public Letter getLetter(Session session, EntityPermission entityPermission) {
158        return LetterFactory.getInstance().getEntityFromPK(session, entityPermission, getLetterPK());
159    }
160    
161    public Letter getLetter(EntityPermission entityPermission) {
162        return getLetter(ThreadSession.currentSession(), entityPermission);
163    }
164    
165    public Letter getLetter(Session session) {
166        return getLetter(session, EntityPermission.READ_ONLY);
167    }
168    
169    public Letter getLetter() {
170        return getLetter(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
171    }
172    
173    public Letter getLetterForUpdate(Session session) {
174        return getLetter(session, EntityPermission.READ_WRITE);
175    }
176    
177    public Letter getLetterForUpdate() {
178        return getLetter(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
179    }
180    
181    public void setLetterPK(LetterPK letterPK)
182            throws PersistenceNotNullException, PersistenceReadOnlyException {
183        checkReadWrite();
184        _value.setLetterPK(letterPK);
185    }
186    
187    public void setLetter(Letter entity) {
188        setLetterPK(entity == null? null: entity.getPrimaryKey());
189    }
190    
191    public boolean getLetterPKHasBeenModified() {
192        return _value.getLetterPKHasBeenModified();
193    }
194    
195    public ChainTypePK getChainTypePK() {
196        return _value.getChainTypePK();
197    }
198    
199    public ChainType getChainType(Session session, EntityPermission entityPermission) {
200        return ChainTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getChainTypePK());
201    }
202    
203    public ChainType getChainType(EntityPermission entityPermission) {
204        return getChainType(ThreadSession.currentSession(), entityPermission);
205    }
206    
207    public ChainType getChainType(Session session) {
208        return getChainType(session, EntityPermission.READ_ONLY);
209    }
210    
211    public ChainType getChainType() {
212        return getChainType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
213    }
214    
215    public ChainType getChainTypeForUpdate(Session session) {
216        return getChainType(session, EntityPermission.READ_WRITE);
217    }
218    
219    public ChainType getChainTypeForUpdate() {
220        return getChainType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
221    }
222    
223    public void setChainTypePK(ChainTypePK chainTypePK)
224            throws PersistenceNotNullException, PersistenceReadOnlyException {
225        checkReadWrite();
226        _value.setChainTypePK(chainTypePK);
227    }
228    
229    public void setChainType(ChainType entity) {
230        setChainTypePK(entity == null? null: entity.getPrimaryKey());
231    }
232    
233    public boolean getChainTypePKHasBeenModified() {
234        return _value.getChainTypePKHasBeenModified();
235    }
236    
237    public String getLetterName() {
238        return _value.getLetterName();
239    }
240    
241    public void setLetterName(String letterName)
242            throws PersistenceNotNullException, PersistenceReadOnlyException {
243        checkReadWrite();
244        _value.setLetterName(letterName);
245    }
246    
247    public boolean getLetterNameHasBeenModified() {
248        return _value.getLetterNameHasBeenModified();
249    }
250    
251    public LetterSourcePK getLetterSourcePK() {
252        return _value.getLetterSourcePK();
253    }
254    
255    public LetterSource getLetterSource(Session session, EntityPermission entityPermission) {
256        return LetterSourceFactory.getInstance().getEntityFromPK(session, entityPermission, getLetterSourcePK());
257    }
258    
259    public LetterSource getLetterSource(EntityPermission entityPermission) {
260        return getLetterSource(ThreadSession.currentSession(), entityPermission);
261    }
262    
263    public LetterSource getLetterSource(Session session) {
264        return getLetterSource(session, EntityPermission.READ_ONLY);
265    }
266    
267    public LetterSource getLetterSource() {
268        return getLetterSource(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
269    }
270    
271    public LetterSource getLetterSourceForUpdate(Session session) {
272        return getLetterSource(session, EntityPermission.READ_WRITE);
273    }
274    
275    public LetterSource getLetterSourceForUpdate() {
276        return getLetterSource(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
277    }
278    
279    public void setLetterSourcePK(LetterSourcePK letterSourcePK)
280            throws PersistenceNotNullException, PersistenceReadOnlyException {
281        checkReadWrite();
282        _value.setLetterSourcePK(letterSourcePK);
283    }
284    
285    public void setLetterSource(LetterSource entity) {
286        setLetterSourcePK(entity == null? null: entity.getPrimaryKey());
287    }
288    
289    public boolean getLetterSourcePKHasBeenModified() {
290        return _value.getLetterSourcePKHasBeenModified();
291    }
292    
293    public ContactListPK getContactListPK() {
294        return _value.getContactListPK();
295    }
296    
297    public ContactList getContactList(Session session, EntityPermission entityPermission) {
298        ContactListPK pk = getContactListPK();
299        ContactList entity = pk == null? null: ContactListFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
300        
301        return entity;
302    }
303    
304    public ContactList getContactList(EntityPermission entityPermission) {
305        return getContactList(ThreadSession.currentSession(), entityPermission);
306    }
307    
308    public ContactList getContactList(Session session) {
309        return getContactList(session, EntityPermission.READ_ONLY);
310    }
311    
312    public ContactList getContactList() {
313        return getContactList(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
314    }
315    
316    public ContactList getContactListForUpdate(Session session) {
317        return getContactList(session, EntityPermission.READ_WRITE);
318    }
319    
320    public ContactList getContactListForUpdate() {
321        return getContactList(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
322    }
323    
324    public void setContactListPK(ContactListPK contactListPK)
325            throws PersistenceNotNullException, PersistenceReadOnlyException {
326        checkReadWrite();
327        _value.setContactListPK(contactListPK);
328    }
329    
330    public void setContactList(ContactList entity) {
331        setContactListPK(entity == null? null: entity.getPrimaryKey());
332    }
333    
334    public boolean getContactListPKHasBeenModified() {
335        return _value.getContactListPKHasBeenModified();
336    }
337    
338    public Boolean getIsDefault() {
339        return _value.getIsDefault();
340    }
341    
342    public void setIsDefault(Boolean isDefault)
343            throws PersistenceNotNullException, PersistenceReadOnlyException {
344        checkReadWrite();
345        _value.setIsDefault(isDefault);
346    }
347    
348    public boolean getIsDefaultHasBeenModified() {
349        return _value.getIsDefaultHasBeenModified();
350    }
351    
352    public Integer getSortOrder() {
353        return _value.getSortOrder();
354    }
355    
356    public void setSortOrder(Integer sortOrder)
357            throws PersistenceNotNullException, PersistenceReadOnlyException {
358        checkReadWrite();
359        _value.setSortOrder(sortOrder);
360    }
361    
362    public boolean getSortOrderHasBeenModified() {
363        return _value.getSortOrderHasBeenModified();
364    }
365    
366    public Long getFromTime() {
367        return _value.getFromTime();
368    }
369    
370    public void setFromTime(Long fromTime)
371            throws PersistenceNotNullException, PersistenceReadOnlyException {
372        checkReadWrite();
373        _value.setFromTime(fromTime);
374    }
375    
376    public boolean getFromTimeHasBeenModified() {
377        return _value.getFromTimeHasBeenModified();
378    }
379    
380    public Long getThruTime() {
381        return _value.getThruTime();
382    }
383    
384    public void setThruTime(Long thruTime)
385            throws PersistenceNotNullException, PersistenceReadOnlyException {
386        checkReadWrite();
387        _value.setThruTime(thruTime);
388    }
389    
390    public boolean getThruTimeHasBeenModified() {
391        return _value.getThruTimeHasBeenModified();
392    }
393    
394}