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 * CommunicationEmailSource.java
021 */
022
023package com.echothree.model.data.communication.server.entity;
024
025import com.echothree.model.data.communication.common.pk.CommunicationEmailSourcePK;
026
027import com.echothree.model.data.communication.common.pk.CommunicationSourcePK;
028import com.echothree.model.data.core.common.pk.ServerPK;
029import com.echothree.model.data.workeffort.common.pk.WorkEffortScopePK;
030import com.echothree.model.data.selector.common.pk.SelectorPK;
031
032import com.echothree.model.data.communication.server.entity.CommunicationSource;
033import com.echothree.model.data.core.server.entity.Server;
034import com.echothree.model.data.workeffort.server.entity.WorkEffortScope;
035import com.echothree.model.data.selector.server.entity.Selector;
036
037import com.echothree.model.data.communication.server.factory.CommunicationSourceFactory;
038import com.echothree.model.data.core.server.factory.ServerFactory;
039import com.echothree.model.data.workeffort.server.factory.WorkEffortScopeFactory;
040import com.echothree.model.data.selector.server.factory.SelectorFactory;
041
042import com.echothree.model.data.communication.common.pk.CommunicationEmailSourcePK;
043
044import com.echothree.model.data.communication.server.value.CommunicationEmailSourceValue;
045
046import com.echothree.model.data.communication.server.factory.CommunicationEmailSourceFactory;
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
064import javax.annotation.Nonnull;
065import javax.annotation.Nullable;
066
067public class CommunicationEmailSource
068        extends BaseEntity
069        implements Serializable {
070    
071    private CommunicationEmailSourcePK _pk;
072    private CommunicationEmailSourceValue _value;
073    
074    /** Creates a new instance of CommunicationEmailSource */
075    public CommunicationEmailSource()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of CommunicationEmailSource */
081    public CommunicationEmailSource(CommunicationEmailSourceValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    @Nonnull
090    public CommunicationEmailSourceFactory getBaseFactoryInstance() {
091        return CommunicationEmailSourceFactory.getInstance();
092    }
093    
094    @Override
095    public boolean hasBeenModified() {
096        return _value.hasBeenModified();
097    }
098    
099    @Override
100    public int hashCode() {
101        return _pk.hashCode();
102    }
103    
104    @Override
105    @Nonnull
106    public String toString() {
107        return _pk.toString();
108    }
109    
110    @Override
111    public boolean equals(Object other) {
112        if(this == other)
113            return true;
114        
115        if(other instanceof CommunicationEmailSource that) {
116            CommunicationEmailSourceValue thatValue = that.getCommunicationEmailSourceValue();
117            return _value.equals(thatValue);
118        } else {
119            return false;
120        }
121    }
122    
123    @Override
124    public void store()
125            throws PersistenceDatabaseException {
126        getBaseFactoryInstance().store(this);
127    }
128    
129    @Override
130    public void remove()
131            throws PersistenceDatabaseException {
132        getBaseFactoryInstance().remove(this);
133    }
134    
135    @Nonnull
136    public CommunicationEmailSourceValue getCommunicationEmailSourceValue() {
137        return _value;
138    }
139    
140    public void setCommunicationEmailSourceValue(@Nonnull CommunicationEmailSourceValue value)
141            throws PersistenceReadOnlyException {
142        checkReadWrite();
143        _value = value;
144    }
145    
146    @Override
147    @Nonnull
148    public CommunicationEmailSourcePK getPrimaryKey() {
149        return _pk;
150    }
151    
152    @Nonnull
153    public CommunicationSourcePK getCommunicationSourcePK() {
154        return _value.getCommunicationSourcePK();
155    }
156    
157    @Nonnull
158    public CommunicationSource getCommunicationSource(EntityPermission entityPermission) {
159        return CommunicationSourceFactory.getInstance().getEntityFromPK(entityPermission, getCommunicationSourcePK());
160    }
161    
162    @Nonnull
163    public CommunicationSource getCommunicationSource() {
164        return getCommunicationSource(EntityPermission.READ_ONLY);
165    }
166    
167    @Nonnull
168    public CommunicationSource getCommunicationSourceForUpdate() {
169        return getCommunicationSource(EntityPermission.READ_WRITE);
170    }
171    
172    public void setCommunicationSourcePK(@Nonnull CommunicationSourcePK communicationSourcePK)
173            throws PersistenceNotNullException, PersistenceReadOnlyException {
174        checkReadWrite();
175        _value.setCommunicationSourcePK(communicationSourcePK);
176    }
177    
178    public void setCommunicationSource(@Nonnull CommunicationSource entity) {
179        setCommunicationSourcePK(entity == null ? null : entity.getPrimaryKey());
180    }
181    
182    public boolean getCommunicationSourcePKHasBeenModified() {
183        return _value.getCommunicationSourcePKHasBeenModified();
184    }
185    
186    @Nonnull
187    public ServerPK getServerPK() {
188        return _value.getServerPK();
189    }
190    
191    @Nonnull
192    public Server getServer(EntityPermission entityPermission) {
193        return ServerFactory.getInstance().getEntityFromPK(entityPermission, getServerPK());
194    }
195    
196    @Nonnull
197    public Server getServer() {
198        return getServer(EntityPermission.READ_ONLY);
199    }
200    
201    @Nonnull
202    public Server getServerForUpdate() {
203        return getServer(EntityPermission.READ_WRITE);
204    }
205    
206    public void setServerPK(@Nonnull ServerPK serverPK)
207            throws PersistenceNotNullException, PersistenceReadOnlyException {
208        checkReadWrite();
209        _value.setServerPK(serverPK);
210    }
211    
212    public void setServer(@Nonnull Server entity) {
213        setServerPK(entity == null ? null : entity.getPrimaryKey());
214    }
215    
216    public boolean getServerPKHasBeenModified() {
217        return _value.getServerPKHasBeenModified();
218    }
219    
220    @Nonnull
221    public String getUsername() {
222        return _value.getUsername();
223    }
224    
225    public void setUsername(@Nonnull String username)
226            throws PersistenceNotNullException, PersistenceReadOnlyException {
227        checkReadWrite();
228        _value.setUsername(username);
229    }
230    
231    public boolean getUsernameHasBeenModified() {
232        return _value.getUsernameHasBeenModified();
233    }
234    
235    @Nonnull
236    public String getPassword() {
237        return _value.getPassword();
238    }
239    
240    public void setPassword(@Nonnull String password)
241            throws PersistenceNotNullException, PersistenceReadOnlyException {
242        checkReadWrite();
243        _value.setPassword(password);
244    }
245    
246    public boolean getPasswordHasBeenModified() {
247        return _value.getPasswordHasBeenModified();
248    }
249    
250    @Nonnull
251    public WorkEffortScopePK getReceiveWorkEffortScopePK() {
252        return _value.getReceiveWorkEffortScopePK();
253    }
254    
255    @Nonnull
256    public WorkEffortScope getReceiveWorkEffortScope(EntityPermission entityPermission) {
257        return WorkEffortScopeFactory.getInstance().getEntityFromPK(entityPermission, getReceiveWorkEffortScopePK());
258    }
259    
260    @Nonnull
261    public WorkEffortScope getReceiveWorkEffortScope() {
262        return getReceiveWorkEffortScope(EntityPermission.READ_ONLY);
263    }
264    
265    @Nonnull
266    public WorkEffortScope getReceiveWorkEffortScopeForUpdate() {
267        return getReceiveWorkEffortScope(EntityPermission.READ_WRITE);
268    }
269    
270    public void setReceiveWorkEffortScopePK(@Nonnull WorkEffortScopePK receiveWorkEffortScopePK)
271            throws PersistenceNotNullException, PersistenceReadOnlyException {
272        checkReadWrite();
273        _value.setReceiveWorkEffortScopePK(receiveWorkEffortScopePK);
274    }
275    
276    public void setReceiveWorkEffortScope(@Nonnull WorkEffortScope entity) {
277        setReceiveWorkEffortScopePK(entity == null ? null : entity.getPrimaryKey());
278    }
279    
280    public boolean getReceiveWorkEffortScopePKHasBeenModified() {
281        return _value.getReceiveWorkEffortScopePKHasBeenModified();
282    }
283    
284    @Nonnull
285    public WorkEffortScopePK getSendWorkEffortScopePK() {
286        return _value.getSendWorkEffortScopePK();
287    }
288    
289    @Nonnull
290    public WorkEffortScope getSendWorkEffortScope(EntityPermission entityPermission) {
291        return WorkEffortScopeFactory.getInstance().getEntityFromPK(entityPermission, getSendWorkEffortScopePK());
292    }
293    
294    @Nonnull
295    public WorkEffortScope getSendWorkEffortScope() {
296        return getSendWorkEffortScope(EntityPermission.READ_ONLY);
297    }
298    
299    @Nonnull
300    public WorkEffortScope getSendWorkEffortScopeForUpdate() {
301        return getSendWorkEffortScope(EntityPermission.READ_WRITE);
302    }
303    
304    public void setSendWorkEffortScopePK(@Nonnull WorkEffortScopePK sendWorkEffortScopePK)
305            throws PersistenceNotNullException, PersistenceReadOnlyException {
306        checkReadWrite();
307        _value.setSendWorkEffortScopePK(sendWorkEffortScopePK);
308    }
309    
310    public void setSendWorkEffortScope(@Nonnull WorkEffortScope entity) {
311        setSendWorkEffortScopePK(entity == null ? null : entity.getPrimaryKey());
312    }
313    
314    public boolean getSendWorkEffortScopePKHasBeenModified() {
315        return _value.getSendWorkEffortScopePKHasBeenModified();
316    }
317    
318    @Nullable
319    public SelectorPK getReviewEmployeeSelectorPK() {
320        return _value.getReviewEmployeeSelectorPK();
321    }
322    
323    @Nullable
324    public Selector getReviewEmployeeSelector(EntityPermission entityPermission) {
325        SelectorPK pk = getReviewEmployeeSelectorPK();
326        Selector entity = pk == null? null: SelectorFactory.getInstance().getEntityFromPK(entityPermission, pk);
327        
328        return entity;
329    }
330    
331    @Nullable
332    public Selector getReviewEmployeeSelector() {
333        return getReviewEmployeeSelector(EntityPermission.READ_ONLY);
334    }
335    
336    @Nullable
337    public Selector getReviewEmployeeSelectorForUpdate() {
338        return getReviewEmployeeSelector(EntityPermission.READ_WRITE);
339    }
340    
341    public void setReviewEmployeeSelectorPK(@Nullable SelectorPK reviewEmployeeSelectorPK)
342            throws PersistenceNotNullException, PersistenceReadOnlyException {
343        checkReadWrite();
344        _value.setReviewEmployeeSelectorPK(reviewEmployeeSelectorPK);
345    }
346    
347    public void setReviewEmployeeSelector(@Nullable Selector entity) {
348        setReviewEmployeeSelectorPK(entity == null ? null : entity.getPrimaryKey());
349    }
350    
351    public boolean getReviewEmployeeSelectorPKHasBeenModified() {
352        return _value.getReviewEmployeeSelectorPKHasBeenModified();
353    }
354    
355    @Nonnull
356    public Long getFromTime() {
357        return _value.getFromTime();
358    }
359    
360    public void setFromTime(@Nonnull Long fromTime)
361            throws PersistenceNotNullException, PersistenceReadOnlyException {
362        checkReadWrite();
363        _value.setFromTime(fromTime);
364    }
365    
366    public boolean getFromTimeHasBeenModified() {
367        return _value.getFromTimeHasBeenModified();
368    }
369    
370    @Nonnull
371    public Long getThruTime() {
372        return _value.getThruTime();
373    }
374    
375    public void setThruTime(@Nonnull Long thruTime)
376            throws PersistenceNotNullException, PersistenceReadOnlyException {
377        checkReadWrite();
378        _value.setThruTime(thruTime);
379    }
380    
381    public boolean getThruTimeHasBeenModified() {
382        return _value.getThruTimeHasBeenModified();
383    }
384    
385}