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 * 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
064public class CommunicationEmailSource
065        extends BaseEntity
066        implements Serializable {
067    
068    private CommunicationEmailSourcePK _pk;
069    private CommunicationEmailSourceValue _value;
070    
071    /** Creates a new instance of CommunicationEmailSource */
072    public CommunicationEmailSource()
073            throws PersistenceException {
074        super();
075    }
076    
077    /** Creates a new instance of CommunicationEmailSource */
078    public CommunicationEmailSource(CommunicationEmailSourceValue value, EntityPermission entityPermission) {
079        super(entityPermission);
080        
081        _value = value;
082        _pk = value.getPrimaryKey();
083    }
084    
085    @Override
086    public CommunicationEmailSourceFactory getBaseFactoryInstance() {
087        return CommunicationEmailSourceFactory.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 CommunicationEmailSource) {
111            CommunicationEmailSource that = (CommunicationEmailSource)other;
112            
113            CommunicationEmailSourceValue thatValue = that.getCommunicationEmailSourceValue();
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 CommunicationEmailSourceValue getCommunicationEmailSourceValue() {
139        return _value;
140    }
141    
142    public void setCommunicationEmailSourceValue(CommunicationEmailSourceValue value)
143            throws PersistenceReadOnlyException {
144        checkReadWrite();
145        _value = value;
146    }
147    
148    @Override
149    public CommunicationEmailSourcePK getPrimaryKey() {
150        return _pk;
151    }
152    
153    public CommunicationSourcePK getCommunicationSourcePK() {
154        return _value.getCommunicationSourcePK();
155    }
156    
157    public CommunicationSource getCommunicationSource(Session session, EntityPermission entityPermission) {
158        return CommunicationSourceFactory.getInstance().getEntityFromPK(session, entityPermission, getCommunicationSourcePK());
159    }
160    
161    public CommunicationSource getCommunicationSource(EntityPermission entityPermission) {
162        return getCommunicationSource(ThreadSession.currentSession(), entityPermission);
163    }
164    
165    public CommunicationSource getCommunicationSource(Session session) {
166        return getCommunicationSource(session, EntityPermission.READ_ONLY);
167    }
168    
169    public CommunicationSource getCommunicationSource() {
170        return getCommunicationSource(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
171    }
172    
173    public CommunicationSource getCommunicationSourceForUpdate(Session session) {
174        return getCommunicationSource(session, EntityPermission.READ_WRITE);
175    }
176    
177    public CommunicationSource getCommunicationSourceForUpdate() {
178        return getCommunicationSource(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
179    }
180    
181    public void setCommunicationSourcePK(CommunicationSourcePK communicationSourcePK)
182            throws PersistenceNotNullException, PersistenceReadOnlyException {
183        checkReadWrite();
184        _value.setCommunicationSourcePK(communicationSourcePK);
185    }
186    
187    public void setCommunicationSource(CommunicationSource entity) {
188        setCommunicationSourcePK(entity == null? null: entity.getPrimaryKey());
189    }
190    
191    public boolean getCommunicationSourcePKHasBeenModified() {
192        return _value.getCommunicationSourcePKHasBeenModified();
193    }
194    
195    public ServerPK getServerPK() {
196        return _value.getServerPK();
197    }
198    
199    public Server getServer(Session session, EntityPermission entityPermission) {
200        return ServerFactory.getInstance().getEntityFromPK(session, entityPermission, getServerPK());
201    }
202    
203    public Server getServer(EntityPermission entityPermission) {
204        return getServer(ThreadSession.currentSession(), entityPermission);
205    }
206    
207    public Server getServer(Session session) {
208        return getServer(session, EntityPermission.READ_ONLY);
209    }
210    
211    public Server getServer() {
212        return getServer(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
213    }
214    
215    public Server getServerForUpdate(Session session) {
216        return getServer(session, EntityPermission.READ_WRITE);
217    }
218    
219    public Server getServerForUpdate() {
220        return getServer(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
221    }
222    
223    public void setServerPK(ServerPK serverPK)
224            throws PersistenceNotNullException, PersistenceReadOnlyException {
225        checkReadWrite();
226        _value.setServerPK(serverPK);
227    }
228    
229    public void setServer(Server entity) {
230        setServerPK(entity == null? null: entity.getPrimaryKey());
231    }
232    
233    public boolean getServerPKHasBeenModified() {
234        return _value.getServerPKHasBeenModified();
235    }
236    
237    public String getUsername() {
238        return _value.getUsername();
239    }
240    
241    public void setUsername(String username)
242            throws PersistenceNotNullException, PersistenceReadOnlyException {
243        checkReadWrite();
244        _value.setUsername(username);
245    }
246    
247    public boolean getUsernameHasBeenModified() {
248        return _value.getUsernameHasBeenModified();
249    }
250    
251    public String getPassword() {
252        return _value.getPassword();
253    }
254    
255    public void setPassword(String password)
256            throws PersistenceNotNullException, PersistenceReadOnlyException {
257        checkReadWrite();
258        _value.setPassword(password);
259    }
260    
261    public boolean getPasswordHasBeenModified() {
262        return _value.getPasswordHasBeenModified();
263    }
264    
265    public WorkEffortScopePK getReceiveWorkEffortScopePK() {
266        return _value.getReceiveWorkEffortScopePK();
267    }
268    
269    public WorkEffortScope getReceiveWorkEffortScope(Session session, EntityPermission entityPermission) {
270        return WorkEffortScopeFactory.getInstance().getEntityFromPK(session, entityPermission, getReceiveWorkEffortScopePK());
271    }
272    
273    public WorkEffortScope getReceiveWorkEffortScope(EntityPermission entityPermission) {
274        return getReceiveWorkEffortScope(ThreadSession.currentSession(), entityPermission);
275    }
276    
277    public WorkEffortScope getReceiveWorkEffortScope(Session session) {
278        return getReceiveWorkEffortScope(session, EntityPermission.READ_ONLY);
279    }
280    
281    public WorkEffortScope getReceiveWorkEffortScope() {
282        return getReceiveWorkEffortScope(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
283    }
284    
285    public WorkEffortScope getReceiveWorkEffortScopeForUpdate(Session session) {
286        return getReceiveWorkEffortScope(session, EntityPermission.READ_WRITE);
287    }
288    
289    public WorkEffortScope getReceiveWorkEffortScopeForUpdate() {
290        return getReceiveWorkEffortScope(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
291    }
292    
293    public void setReceiveWorkEffortScopePK(WorkEffortScopePK receiveWorkEffortScopePK)
294            throws PersistenceNotNullException, PersistenceReadOnlyException {
295        checkReadWrite();
296        _value.setReceiveWorkEffortScopePK(receiveWorkEffortScopePK);
297    }
298    
299    public void setReceiveWorkEffortScope(WorkEffortScope entity) {
300        setReceiveWorkEffortScopePK(entity == null? null: entity.getPrimaryKey());
301    }
302    
303    public boolean getReceiveWorkEffortScopePKHasBeenModified() {
304        return _value.getReceiveWorkEffortScopePKHasBeenModified();
305    }
306    
307    public WorkEffortScopePK getSendWorkEffortScopePK() {
308        return _value.getSendWorkEffortScopePK();
309    }
310    
311    public WorkEffortScope getSendWorkEffortScope(Session session, EntityPermission entityPermission) {
312        return WorkEffortScopeFactory.getInstance().getEntityFromPK(session, entityPermission, getSendWorkEffortScopePK());
313    }
314    
315    public WorkEffortScope getSendWorkEffortScope(EntityPermission entityPermission) {
316        return getSendWorkEffortScope(ThreadSession.currentSession(), entityPermission);
317    }
318    
319    public WorkEffortScope getSendWorkEffortScope(Session session) {
320        return getSendWorkEffortScope(session, EntityPermission.READ_ONLY);
321    }
322    
323    public WorkEffortScope getSendWorkEffortScope() {
324        return getSendWorkEffortScope(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
325    }
326    
327    public WorkEffortScope getSendWorkEffortScopeForUpdate(Session session) {
328        return getSendWorkEffortScope(session, EntityPermission.READ_WRITE);
329    }
330    
331    public WorkEffortScope getSendWorkEffortScopeForUpdate() {
332        return getSendWorkEffortScope(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
333    }
334    
335    public void setSendWorkEffortScopePK(WorkEffortScopePK sendWorkEffortScopePK)
336            throws PersistenceNotNullException, PersistenceReadOnlyException {
337        checkReadWrite();
338        _value.setSendWorkEffortScopePK(sendWorkEffortScopePK);
339    }
340    
341    public void setSendWorkEffortScope(WorkEffortScope entity) {
342        setSendWorkEffortScopePK(entity == null? null: entity.getPrimaryKey());
343    }
344    
345    public boolean getSendWorkEffortScopePKHasBeenModified() {
346        return _value.getSendWorkEffortScopePKHasBeenModified();
347    }
348    
349    public SelectorPK getReviewEmployeeSelectorPK() {
350        return _value.getReviewEmployeeSelectorPK();
351    }
352    
353    public Selector getReviewEmployeeSelector(Session session, EntityPermission entityPermission) {
354        SelectorPK pk = getReviewEmployeeSelectorPK();
355        Selector entity = pk == null? null: SelectorFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
356        
357        return entity;
358    }
359    
360    public Selector getReviewEmployeeSelector(EntityPermission entityPermission) {
361        return getReviewEmployeeSelector(ThreadSession.currentSession(), entityPermission);
362    }
363    
364    public Selector getReviewEmployeeSelector(Session session) {
365        return getReviewEmployeeSelector(session, EntityPermission.READ_ONLY);
366    }
367    
368    public Selector getReviewEmployeeSelector() {
369        return getReviewEmployeeSelector(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
370    }
371    
372    public Selector getReviewEmployeeSelectorForUpdate(Session session) {
373        return getReviewEmployeeSelector(session, EntityPermission.READ_WRITE);
374    }
375    
376    public Selector getReviewEmployeeSelectorForUpdate() {
377        return getReviewEmployeeSelector(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
378    }
379    
380    public void setReviewEmployeeSelectorPK(SelectorPK reviewEmployeeSelectorPK)
381            throws PersistenceNotNullException, PersistenceReadOnlyException {
382        checkReadWrite();
383        _value.setReviewEmployeeSelectorPK(reviewEmployeeSelectorPK);
384    }
385    
386    public void setReviewEmployeeSelector(Selector entity) {
387        setReviewEmployeeSelectorPK(entity == null? null: entity.getPrimaryKey());
388    }
389    
390    public boolean getReviewEmployeeSelectorPKHasBeenModified() {
391        return _value.getReviewEmployeeSelectorPKHasBeenModified();
392    }
393    
394    public Long getFromTime() {
395        return _value.getFromTime();
396    }
397    
398    public void setFromTime(Long fromTime)
399            throws PersistenceNotNullException, PersistenceReadOnlyException {
400        checkReadWrite();
401        _value.setFromTime(fromTime);
402    }
403    
404    public boolean getFromTimeHasBeenModified() {
405        return _value.getFromTimeHasBeenModified();
406    }
407    
408    public Long getThruTime() {
409        return _value.getThruTime();
410    }
411    
412    public void setThruTime(Long thruTime)
413            throws PersistenceNotNullException, PersistenceReadOnlyException {
414        checkReadWrite();
415        _value.setThruTime(thruTime);
416    }
417    
418    public boolean getThruTimeHasBeenModified() {
419        return _value.getThruTimeHasBeenModified();
420    }
421    
422}