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 * CommunicationEventDetail.java
021 */
022
023package com.echothree.model.data.communication.server.entity;
024
025import com.echothree.model.data.communication.common.pk.CommunicationEventDetailPK;
026
027import com.echothree.model.data.communication.common.pk.CommunicationEventPK;
028import com.echothree.model.data.communication.common.pk.CommunicationEventTypePK;
029import com.echothree.model.data.communication.common.pk.CommunicationSourcePK;
030import com.echothree.model.data.communication.common.pk.CommunicationEventPurposePK;
031import com.echothree.model.data.contact.common.pk.PartyContactMechanismPK;
032import com.echothree.model.data.document.common.pk.DocumentPK;
033
034import com.echothree.model.data.communication.server.entity.CommunicationEvent;
035import com.echothree.model.data.communication.server.entity.CommunicationEventType;
036import com.echothree.model.data.communication.server.entity.CommunicationSource;
037import com.echothree.model.data.communication.server.entity.CommunicationEventPurpose;
038import com.echothree.model.data.contact.server.entity.PartyContactMechanism;
039import com.echothree.model.data.document.server.entity.Document;
040
041import com.echothree.model.data.communication.server.factory.CommunicationEventFactory;
042import com.echothree.model.data.communication.server.factory.CommunicationEventTypeFactory;
043import com.echothree.model.data.communication.server.factory.CommunicationSourceFactory;
044import com.echothree.model.data.communication.server.factory.CommunicationEventPurposeFactory;
045import com.echothree.model.data.contact.server.factory.PartyContactMechanismFactory;
046import com.echothree.model.data.document.server.factory.DocumentFactory;
047
048import com.echothree.model.data.communication.common.pk.CommunicationEventDetailPK;
049
050import com.echothree.model.data.communication.server.value.CommunicationEventDetailValue;
051
052import com.echothree.model.data.communication.server.factory.CommunicationEventDetailFactory;
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
070import javax.annotation.Nonnull;
071import javax.annotation.Nullable;
072
073public class CommunicationEventDetail
074        extends BaseEntity
075        implements Serializable {
076    
077    private CommunicationEventDetailPK _pk;
078    private CommunicationEventDetailValue _value;
079    
080    /** Creates a new instance of CommunicationEventDetail */
081    public CommunicationEventDetail()
082            throws PersistenceException {
083        super();
084    }
085    
086    /** Creates a new instance of CommunicationEventDetail */
087    public CommunicationEventDetail(CommunicationEventDetailValue value, EntityPermission entityPermission) {
088        super(entityPermission);
089        
090        _value = value;
091        _pk = value.getPrimaryKey();
092    }
093    
094    @Override
095    @Nonnull
096    public CommunicationEventDetailFactory getBaseFactoryInstance() {
097        return CommunicationEventDetailFactory.getInstance();
098    }
099    
100    @Override
101    public boolean hasBeenModified() {
102        return _value.hasBeenModified();
103    }
104    
105    @Override
106    public int hashCode() {
107        return _pk.hashCode();
108    }
109    
110    @Override
111    @Nonnull
112    public String toString() {
113        return _pk.toString();
114    }
115    
116    @Override
117    public boolean equals(Object other) {
118        if(this == other)
119            return true;
120        
121        if(other instanceof CommunicationEventDetail that) {
122            CommunicationEventDetailValue thatValue = that.getCommunicationEventDetailValue();
123            return _value.equals(thatValue);
124        } else {
125            return false;
126        }
127    }
128    
129    @Override
130    public void store()
131            throws PersistenceDatabaseException {
132        getBaseFactoryInstance().store(this);
133    }
134    
135    @Override
136    public void remove()
137            throws PersistenceDatabaseException {
138        getBaseFactoryInstance().remove(this);
139    }
140    
141    @Nonnull
142    public CommunicationEventDetailValue getCommunicationEventDetailValue() {
143        return _value;
144    }
145    
146    public void setCommunicationEventDetailValue(@Nonnull CommunicationEventDetailValue value)
147            throws PersistenceReadOnlyException {
148        checkReadWrite();
149        _value = value;
150    }
151    
152    @Override
153    @Nonnull
154    public CommunicationEventDetailPK getPrimaryKey() {
155        return _pk;
156    }
157    
158    @Nonnull
159    public CommunicationEventPK getCommunicationEventPK() {
160        return _value.getCommunicationEventPK();
161    }
162    
163    @Nonnull
164    public CommunicationEvent getCommunicationEvent(EntityPermission entityPermission) {
165        return CommunicationEventFactory.getInstance().getEntityFromPK(entityPermission, getCommunicationEventPK());
166    }
167    
168    @Nonnull
169    public CommunicationEvent getCommunicationEvent() {
170        return getCommunicationEvent(EntityPermission.READ_ONLY);
171    }
172    
173    @Nonnull
174    public CommunicationEvent getCommunicationEventForUpdate() {
175        return getCommunicationEvent(EntityPermission.READ_WRITE);
176    }
177    
178    public void setCommunicationEventPK(@Nonnull CommunicationEventPK communicationEventPK)
179            throws PersistenceNotNullException, PersistenceReadOnlyException {
180        checkReadWrite();
181        _value.setCommunicationEventPK(communicationEventPK);
182    }
183    
184    public void setCommunicationEvent(@Nonnull CommunicationEvent entity) {
185        setCommunicationEventPK(entity == null ? null : entity.getPrimaryKey());
186    }
187    
188    public boolean getCommunicationEventPKHasBeenModified() {
189        return _value.getCommunicationEventPKHasBeenModified();
190    }
191    
192    @Nonnull
193    public String getCommunicationEventName() {
194        return _value.getCommunicationEventName();
195    }
196    
197    public void setCommunicationEventName(@Nonnull String communicationEventName)
198            throws PersistenceNotNullException, PersistenceReadOnlyException {
199        checkReadWrite();
200        _value.setCommunicationEventName(communicationEventName);
201    }
202    
203    public boolean getCommunicationEventNameHasBeenModified() {
204        return _value.getCommunicationEventNameHasBeenModified();
205    }
206    
207    @Nonnull
208    public CommunicationEventTypePK getCommunicationEventTypePK() {
209        return _value.getCommunicationEventTypePK();
210    }
211    
212    @Nonnull
213    public CommunicationEventType getCommunicationEventType(EntityPermission entityPermission) {
214        return CommunicationEventTypeFactory.getInstance().getEntityFromPK(entityPermission, getCommunicationEventTypePK());
215    }
216    
217    @Nonnull
218    public CommunicationEventType getCommunicationEventType() {
219        return getCommunicationEventType(EntityPermission.READ_ONLY);
220    }
221    
222    @Nonnull
223    public CommunicationEventType getCommunicationEventTypeForUpdate() {
224        return getCommunicationEventType(EntityPermission.READ_WRITE);
225    }
226    
227    public void setCommunicationEventTypePK(@Nonnull CommunicationEventTypePK communicationEventTypePK)
228            throws PersistenceNotNullException, PersistenceReadOnlyException {
229        checkReadWrite();
230        _value.setCommunicationEventTypePK(communicationEventTypePK);
231    }
232    
233    public void setCommunicationEventType(@Nonnull CommunicationEventType entity) {
234        setCommunicationEventTypePK(entity == null ? null : entity.getPrimaryKey());
235    }
236    
237    public boolean getCommunicationEventTypePKHasBeenModified() {
238        return _value.getCommunicationEventTypePKHasBeenModified();
239    }
240    
241    @Nullable
242    public CommunicationSourcePK getCommunicationSourcePK() {
243        return _value.getCommunicationSourcePK();
244    }
245    
246    @Nullable
247    public CommunicationSource getCommunicationSource(EntityPermission entityPermission) {
248        CommunicationSourcePK pk = getCommunicationSourcePK();
249        CommunicationSource entity = pk == null? null: CommunicationSourceFactory.getInstance().getEntityFromPK(entityPermission, pk);
250        
251        return entity;
252    }
253    
254    @Nullable
255    public CommunicationSource getCommunicationSource() {
256        return getCommunicationSource(EntityPermission.READ_ONLY);
257    }
258    
259    @Nullable
260    public CommunicationSource getCommunicationSourceForUpdate() {
261        return getCommunicationSource(EntityPermission.READ_WRITE);
262    }
263    
264    public void setCommunicationSourcePK(@Nullable CommunicationSourcePK communicationSourcePK)
265            throws PersistenceNotNullException, PersistenceReadOnlyException {
266        checkReadWrite();
267        _value.setCommunicationSourcePK(communicationSourcePK);
268    }
269    
270    public void setCommunicationSource(@Nullable CommunicationSource entity) {
271        setCommunicationSourcePK(entity == null ? null : entity.getPrimaryKey());
272    }
273    
274    public boolean getCommunicationSourcePKHasBeenModified() {
275        return _value.getCommunicationSourcePKHasBeenModified();
276    }
277    
278    @Nonnull
279    public CommunicationEventPurposePK getCommunicationEventPurposePK() {
280        return _value.getCommunicationEventPurposePK();
281    }
282    
283    @Nonnull
284    public CommunicationEventPurpose getCommunicationEventPurpose(EntityPermission entityPermission) {
285        return CommunicationEventPurposeFactory.getInstance().getEntityFromPK(entityPermission, getCommunicationEventPurposePK());
286    }
287    
288    @Nonnull
289    public CommunicationEventPurpose getCommunicationEventPurpose() {
290        return getCommunicationEventPurpose(EntityPermission.READ_ONLY);
291    }
292    
293    @Nonnull
294    public CommunicationEventPurpose getCommunicationEventPurposeForUpdate() {
295        return getCommunicationEventPurpose(EntityPermission.READ_WRITE);
296    }
297    
298    public void setCommunicationEventPurposePK(@Nonnull CommunicationEventPurposePK communicationEventPurposePK)
299            throws PersistenceNotNullException, PersistenceReadOnlyException {
300        checkReadWrite();
301        _value.setCommunicationEventPurposePK(communicationEventPurposePK);
302    }
303    
304    public void setCommunicationEventPurpose(@Nonnull CommunicationEventPurpose entity) {
305        setCommunicationEventPurposePK(entity == null ? null : entity.getPrimaryKey());
306    }
307    
308    public boolean getCommunicationEventPurposePKHasBeenModified() {
309        return _value.getCommunicationEventPurposePKHasBeenModified();
310    }
311    
312    @Nullable
313    public CommunicationEventPK getOriginalCommunicationEventPK() {
314        return _value.getOriginalCommunicationEventPK();
315    }
316    
317    @Nullable
318    public CommunicationEvent getOriginalCommunicationEvent(EntityPermission entityPermission) {
319        CommunicationEventPK pk = getOriginalCommunicationEventPK();
320        CommunicationEvent entity = pk == null? null: CommunicationEventFactory.getInstance().getEntityFromPK(entityPermission, pk);
321        
322        return entity;
323    }
324    
325    @Nullable
326    public CommunicationEvent getOriginalCommunicationEvent() {
327        return getOriginalCommunicationEvent(EntityPermission.READ_ONLY);
328    }
329    
330    @Nullable
331    public CommunicationEvent getOriginalCommunicationEventForUpdate() {
332        return getOriginalCommunicationEvent(EntityPermission.READ_WRITE);
333    }
334    
335    public void setOriginalCommunicationEventPK(@Nullable CommunicationEventPK originalCommunicationEventPK)
336            throws PersistenceNotNullException, PersistenceReadOnlyException {
337        checkReadWrite();
338        _value.setOriginalCommunicationEventPK(originalCommunicationEventPK);
339    }
340    
341    public void setOriginalCommunicationEvent(@Nullable CommunicationEvent entity) {
342        setOriginalCommunicationEventPK(entity == null ? null : entity.getPrimaryKey());
343    }
344    
345    public boolean getOriginalCommunicationEventPKHasBeenModified() {
346        return _value.getOriginalCommunicationEventPKHasBeenModified();
347    }
348    
349    @Nullable
350    public CommunicationEventPK getParentCommunicationEventPK() {
351        return _value.getParentCommunicationEventPK();
352    }
353    
354    @Nullable
355    public CommunicationEvent getParentCommunicationEvent(EntityPermission entityPermission) {
356        CommunicationEventPK pk = getParentCommunicationEventPK();
357        CommunicationEvent entity = pk == null? null: CommunicationEventFactory.getInstance().getEntityFromPK(entityPermission, pk);
358        
359        return entity;
360    }
361    
362    @Nullable
363    public CommunicationEvent getParentCommunicationEvent() {
364        return getParentCommunicationEvent(EntityPermission.READ_ONLY);
365    }
366    
367    @Nullable
368    public CommunicationEvent getParentCommunicationEventForUpdate() {
369        return getParentCommunicationEvent(EntityPermission.READ_WRITE);
370    }
371    
372    public void setParentCommunicationEventPK(@Nullable CommunicationEventPK parentCommunicationEventPK)
373            throws PersistenceNotNullException, PersistenceReadOnlyException {
374        checkReadWrite();
375        _value.setParentCommunicationEventPK(parentCommunicationEventPK);
376    }
377    
378    public void setParentCommunicationEvent(@Nullable CommunicationEvent entity) {
379        setParentCommunicationEventPK(entity == null ? null : entity.getPrimaryKey());
380    }
381    
382    public boolean getParentCommunicationEventPKHasBeenModified() {
383        return _value.getParentCommunicationEventPKHasBeenModified();
384    }
385    
386    @Nonnull
387    public PartyContactMechanismPK getPartyContactMechanismPK() {
388        return _value.getPartyContactMechanismPK();
389    }
390    
391    @Nonnull
392    public PartyContactMechanism getPartyContactMechanism(EntityPermission entityPermission) {
393        return PartyContactMechanismFactory.getInstance().getEntityFromPK(entityPermission, getPartyContactMechanismPK());
394    }
395    
396    @Nonnull
397    public PartyContactMechanism getPartyContactMechanism() {
398        return getPartyContactMechanism(EntityPermission.READ_ONLY);
399    }
400    
401    @Nonnull
402    public PartyContactMechanism getPartyContactMechanismForUpdate() {
403        return getPartyContactMechanism(EntityPermission.READ_WRITE);
404    }
405    
406    public void setPartyContactMechanismPK(@Nonnull PartyContactMechanismPK partyContactMechanismPK)
407            throws PersistenceNotNullException, PersistenceReadOnlyException {
408        checkReadWrite();
409        _value.setPartyContactMechanismPK(partyContactMechanismPK);
410    }
411    
412    public void setPartyContactMechanism(@Nonnull PartyContactMechanism entity) {
413        setPartyContactMechanismPK(entity == null ? null : entity.getPrimaryKey());
414    }
415    
416    public boolean getPartyContactMechanismPKHasBeenModified() {
417        return _value.getPartyContactMechanismPKHasBeenModified();
418    }
419    
420    @Nonnull
421    public DocumentPK getDocumentPK() {
422        return _value.getDocumentPK();
423    }
424    
425    @Nonnull
426    public Document getDocument(EntityPermission entityPermission) {
427        return DocumentFactory.getInstance().getEntityFromPK(entityPermission, getDocumentPK());
428    }
429    
430    @Nonnull
431    public Document getDocument() {
432        return getDocument(EntityPermission.READ_ONLY);
433    }
434    
435    @Nonnull
436    public Document getDocumentForUpdate() {
437        return getDocument(EntityPermission.READ_WRITE);
438    }
439    
440    public void setDocumentPK(@Nonnull DocumentPK documentPK)
441            throws PersistenceNotNullException, PersistenceReadOnlyException {
442        checkReadWrite();
443        _value.setDocumentPK(documentPK);
444    }
445    
446    public void setDocument(@Nonnull Document entity) {
447        setDocumentPK(entity == null ? null : entity.getPrimaryKey());
448    }
449    
450    public boolean getDocumentPKHasBeenModified() {
451        return _value.getDocumentPKHasBeenModified();
452    }
453    
454    @Nonnull
455    public Long getFromTime() {
456        return _value.getFromTime();
457    }
458    
459    public void setFromTime(@Nonnull Long fromTime)
460            throws PersistenceNotNullException, PersistenceReadOnlyException {
461        checkReadWrite();
462        _value.setFromTime(fromTime);
463    }
464    
465    public boolean getFromTimeHasBeenModified() {
466        return _value.getFromTimeHasBeenModified();
467    }
468    
469    @Nonnull
470    public Long getThruTime() {
471        return _value.getThruTime();
472    }
473    
474    public void setThruTime(@Nonnull Long thruTime)
475            throws PersistenceNotNullException, PersistenceReadOnlyException {
476        checkReadWrite();
477        _value.setThruTime(thruTime);
478    }
479    
480    public boolean getThruTimeHasBeenModified() {
481        return _value.getThruTimeHasBeenModified();
482    }
483    
484}