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