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 * LetterSourceDetail.java
021 */
022
023package com.echothree.model.data.letter.server.entity;
024
025import com.echothree.model.data.letter.common.pk.LetterSourceDetailPK;
026
027import com.echothree.model.data.letter.common.pk.LetterSourcePK;
028import com.echothree.model.data.party.common.pk.PartyPK;
029import com.echothree.model.data.contact.common.pk.PartyContactMechanismPK;
030
031import com.echothree.model.data.letter.server.entity.LetterSource;
032import com.echothree.model.data.party.server.entity.Party;
033import com.echothree.model.data.contact.server.entity.PartyContactMechanism;
034
035import com.echothree.model.data.letter.server.factory.LetterSourceFactory;
036import com.echothree.model.data.party.server.factory.PartyFactory;
037import com.echothree.model.data.contact.server.factory.PartyContactMechanismFactory;
038
039import com.echothree.model.data.letter.common.pk.LetterSourceDetailPK;
040
041import com.echothree.model.data.letter.server.value.LetterSourceDetailValue;
042
043import com.echothree.model.data.letter.server.factory.LetterSourceDetailFactory;
044
045import com.echothree.util.common.exception.PersistenceException;
046import com.echothree.util.common.exception.PersistenceDatabaseException;
047import com.echothree.util.common.exception.PersistenceNotNullException;
048import com.echothree.util.common.exception.PersistenceReadOnlyException;
049
050import com.echothree.util.common.persistence.BasePK;
051
052import com.echothree.util.common.persistence.type.ByteArray;
053
054import com.echothree.util.server.persistence.BaseEntity;
055import com.echothree.util.server.persistence.EntityPermission;
056import com.echothree.util.server.persistence.Session;
057import com.echothree.util.server.persistence.ThreadSession;
058
059import java.io.Serializable;
060
061public class LetterSourceDetail
062        extends BaseEntity
063        implements Serializable {
064    
065    private LetterSourceDetailPK _pk;
066    private LetterSourceDetailValue _value;
067    
068    /** Creates a new instance of LetterSourceDetail */
069    public LetterSourceDetail()
070            throws PersistenceException {
071        super();
072    }
073    
074    /** Creates a new instance of LetterSourceDetail */
075    public LetterSourceDetail(LetterSourceDetailValue value, EntityPermission entityPermission) {
076        super(entityPermission);
077        
078        _value = value;
079        _pk = value.getPrimaryKey();
080    }
081    
082    @Override
083    public LetterSourceDetailFactory getBaseFactoryInstance() {
084        return LetterSourceDetailFactory.getInstance();
085    }
086    
087    @Override
088    public boolean hasBeenModified() {
089        return _value.hasBeenModified();
090    }
091    
092    @Override
093    public int hashCode() {
094        return _pk.hashCode();
095    }
096    
097    @Override
098    public String toString() {
099        return _pk.toString();
100    }
101    
102    @Override
103    public boolean equals(Object other) {
104        if(this == other)
105            return true;
106        
107        if(other instanceof LetterSourceDetail that) {
108            LetterSourceDetailValue thatValue = that.getLetterSourceDetailValue();
109            return _value.equals(thatValue);
110        } else {
111            return false;
112        }
113    }
114    
115    @Override
116    public void store()
117            throws PersistenceDatabaseException {
118        getBaseFactoryInstance().store(this);
119    }
120    
121    @Override
122    public void remove()
123            throws PersistenceDatabaseException {
124        getBaseFactoryInstance().remove(this);
125    }
126    
127    public LetterSourceDetailValue getLetterSourceDetailValue() {
128        return _value;
129    }
130    
131    public void setLetterSourceDetailValue(LetterSourceDetailValue value)
132            throws PersistenceReadOnlyException {
133        checkReadWrite();
134        _value = value;
135    }
136    
137    @Override
138    public LetterSourceDetailPK getPrimaryKey() {
139        return _pk;
140    }
141    
142    public LetterSourcePK getLetterSourcePK() {
143        return _value.getLetterSourcePK();
144    }
145    
146    public LetterSource getLetterSource(EntityPermission entityPermission) {
147        return LetterSourceFactory.getInstance().getEntityFromPK(entityPermission, getLetterSourcePK());
148    }
149    
150    public LetterSource getLetterSource() {
151        return getLetterSource(EntityPermission.READ_ONLY);
152    }
153    
154    public LetterSource getLetterSourceForUpdate() {
155        return getLetterSource(EntityPermission.READ_WRITE);
156    }
157    
158    public void setLetterSourcePK(LetterSourcePK letterSourcePK)
159            throws PersistenceNotNullException, PersistenceReadOnlyException {
160        checkReadWrite();
161        _value.setLetterSourcePK(letterSourcePK);
162    }
163    
164    public void setLetterSource(LetterSource entity) {
165        setLetterSourcePK(entity == null? null: entity.getPrimaryKey());
166    }
167    
168    public boolean getLetterSourcePKHasBeenModified() {
169        return _value.getLetterSourcePKHasBeenModified();
170    }
171    
172    public String getLetterSourceName() {
173        return _value.getLetterSourceName();
174    }
175    
176    public void setLetterSourceName(String letterSourceName)
177            throws PersistenceNotNullException, PersistenceReadOnlyException {
178        checkReadWrite();
179        _value.setLetterSourceName(letterSourceName);
180    }
181    
182    public boolean getLetterSourceNameHasBeenModified() {
183        return _value.getLetterSourceNameHasBeenModified();
184    }
185    
186    public PartyPK getCompanyPartyPK() {
187        return _value.getCompanyPartyPK();
188    }
189    
190    public Party getCompanyParty(EntityPermission entityPermission) {
191        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getCompanyPartyPK());
192    }
193    
194    public Party getCompanyParty() {
195        return getCompanyParty(EntityPermission.READ_ONLY);
196    }
197    
198    public Party getCompanyPartyForUpdate() {
199        return getCompanyParty(EntityPermission.READ_WRITE);
200    }
201    
202    public void setCompanyPartyPK(PartyPK companyPartyPK)
203            throws PersistenceNotNullException, PersistenceReadOnlyException {
204        checkReadWrite();
205        _value.setCompanyPartyPK(companyPartyPK);
206    }
207    
208    public void setCompanyParty(Party entity) {
209        setCompanyPartyPK(entity == null? null: entity.getPrimaryKey());
210    }
211    
212    public boolean getCompanyPartyPKHasBeenModified() {
213        return _value.getCompanyPartyPKHasBeenModified();
214    }
215    
216    public PartyContactMechanismPK getEmailAddressPartyContactMechanismPK() {
217        return _value.getEmailAddressPartyContactMechanismPK();
218    }
219    
220    public PartyContactMechanism getEmailAddressPartyContactMechanism(EntityPermission entityPermission) {
221        return PartyContactMechanismFactory.getInstance().getEntityFromPK(entityPermission, getEmailAddressPartyContactMechanismPK());
222    }
223    
224    public PartyContactMechanism getEmailAddressPartyContactMechanism() {
225        return getEmailAddressPartyContactMechanism(EntityPermission.READ_ONLY);
226    }
227    
228    public PartyContactMechanism getEmailAddressPartyContactMechanismForUpdate() {
229        return getEmailAddressPartyContactMechanism(EntityPermission.READ_WRITE);
230    }
231    
232    public void setEmailAddressPartyContactMechanismPK(PartyContactMechanismPK emailAddressPartyContactMechanismPK)
233            throws PersistenceNotNullException, PersistenceReadOnlyException {
234        checkReadWrite();
235        _value.setEmailAddressPartyContactMechanismPK(emailAddressPartyContactMechanismPK);
236    }
237    
238    public void setEmailAddressPartyContactMechanism(PartyContactMechanism entity) {
239        setEmailAddressPartyContactMechanismPK(entity == null? null: entity.getPrimaryKey());
240    }
241    
242    public boolean getEmailAddressPartyContactMechanismPKHasBeenModified() {
243        return _value.getEmailAddressPartyContactMechanismPKHasBeenModified();
244    }
245    
246    public PartyContactMechanismPK getPostalAddressPartyContactMechanismPK() {
247        return _value.getPostalAddressPartyContactMechanismPK();
248    }
249    
250    public PartyContactMechanism getPostalAddressPartyContactMechanism(EntityPermission entityPermission) {
251        return PartyContactMechanismFactory.getInstance().getEntityFromPK(entityPermission, getPostalAddressPartyContactMechanismPK());
252    }
253    
254    public PartyContactMechanism getPostalAddressPartyContactMechanism() {
255        return getPostalAddressPartyContactMechanism(EntityPermission.READ_ONLY);
256    }
257    
258    public PartyContactMechanism getPostalAddressPartyContactMechanismForUpdate() {
259        return getPostalAddressPartyContactMechanism(EntityPermission.READ_WRITE);
260    }
261    
262    public void setPostalAddressPartyContactMechanismPK(PartyContactMechanismPK postalAddressPartyContactMechanismPK)
263            throws PersistenceNotNullException, PersistenceReadOnlyException {
264        checkReadWrite();
265        _value.setPostalAddressPartyContactMechanismPK(postalAddressPartyContactMechanismPK);
266    }
267    
268    public void setPostalAddressPartyContactMechanism(PartyContactMechanism entity) {
269        setPostalAddressPartyContactMechanismPK(entity == null? null: entity.getPrimaryKey());
270    }
271    
272    public boolean getPostalAddressPartyContactMechanismPKHasBeenModified() {
273        return _value.getPostalAddressPartyContactMechanismPKHasBeenModified();
274    }
275    
276    public PartyContactMechanismPK getLetterSourcePartyContactMechanismPK() {
277        return _value.getLetterSourcePartyContactMechanismPK();
278    }
279    
280    public PartyContactMechanism getLetterSourcePartyContactMechanism(EntityPermission entityPermission) {
281        return PartyContactMechanismFactory.getInstance().getEntityFromPK(entityPermission, getLetterSourcePartyContactMechanismPK());
282    }
283    
284    public PartyContactMechanism getLetterSourcePartyContactMechanism() {
285        return getLetterSourcePartyContactMechanism(EntityPermission.READ_ONLY);
286    }
287    
288    public PartyContactMechanism getLetterSourcePartyContactMechanismForUpdate() {
289        return getLetterSourcePartyContactMechanism(EntityPermission.READ_WRITE);
290    }
291    
292    public void setLetterSourcePartyContactMechanismPK(PartyContactMechanismPK letterSourcePartyContactMechanismPK)
293            throws PersistenceNotNullException, PersistenceReadOnlyException {
294        checkReadWrite();
295        _value.setLetterSourcePartyContactMechanismPK(letterSourcePartyContactMechanismPK);
296    }
297    
298    public void setLetterSourcePartyContactMechanism(PartyContactMechanism entity) {
299        setLetterSourcePartyContactMechanismPK(entity == null? null: entity.getPrimaryKey());
300    }
301    
302    public boolean getLetterSourcePartyContactMechanismPKHasBeenModified() {
303        return _value.getLetterSourcePartyContactMechanismPKHasBeenModified();
304    }
305    
306    public Boolean getIsDefault() {
307        return _value.getIsDefault();
308    }
309    
310    public void setIsDefault(Boolean isDefault)
311            throws PersistenceNotNullException, PersistenceReadOnlyException {
312        checkReadWrite();
313        _value.setIsDefault(isDefault);
314    }
315    
316    public boolean getIsDefaultHasBeenModified() {
317        return _value.getIsDefaultHasBeenModified();
318    }
319    
320    public Integer getSortOrder() {
321        return _value.getSortOrder();
322    }
323    
324    public void setSortOrder(Integer sortOrder)
325            throws PersistenceNotNullException, PersistenceReadOnlyException {
326        checkReadWrite();
327        _value.setSortOrder(sortOrder);
328    }
329    
330    public boolean getSortOrderHasBeenModified() {
331        return _value.getSortOrderHasBeenModified();
332    }
333    
334    public Long getFromTime() {
335        return _value.getFromTime();
336    }
337    
338    public void setFromTime(Long fromTime)
339            throws PersistenceNotNullException, PersistenceReadOnlyException {
340        checkReadWrite();
341        _value.setFromTime(fromTime);
342    }
343    
344    public boolean getFromTimeHasBeenModified() {
345        return _value.getFromTimeHasBeenModified();
346    }
347    
348    public Long getThruTime() {
349        return _value.getThruTime();
350    }
351    
352    public void setThruTime(Long thruTime)
353            throws PersistenceNotNullException, PersistenceReadOnlyException {
354        checkReadWrite();
355        _value.setThruTime(thruTime);
356    }
357    
358    public boolean getThruTimeHasBeenModified() {
359        return _value.getThruTimeHasBeenModified();
360    }
361    
362}