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 * AssociateReferralDetail.java
021 */
022
023package com.echothree.model.data.associate.server.entity;
024
025import com.echothree.model.data.associate.common.pk.AssociateReferralDetailPK;
026
027import com.echothree.model.data.associate.common.pk.AssociateReferralPK;
028import com.echothree.model.data.associate.common.pk.AssociatePK;
029import com.echothree.model.data.associate.common.pk.AssociatePartyContactMechanismPK;
030import com.echothree.model.data.core.common.pk.EntityInstancePK;
031
032import com.echothree.model.data.associate.server.entity.AssociateReferral;
033import com.echothree.model.data.associate.server.entity.Associate;
034import com.echothree.model.data.associate.server.entity.AssociatePartyContactMechanism;
035import com.echothree.model.data.core.server.entity.EntityInstance;
036
037import com.echothree.model.data.associate.server.factory.AssociateReferralFactory;
038import com.echothree.model.data.associate.server.factory.AssociateFactory;
039import com.echothree.model.data.associate.server.factory.AssociatePartyContactMechanismFactory;
040import com.echothree.model.data.core.server.factory.EntityInstanceFactory;
041
042import com.echothree.model.data.associate.common.pk.AssociateReferralDetailPK;
043
044import com.echothree.model.data.associate.server.value.AssociateReferralDetailValue;
045
046import com.echothree.model.data.associate.server.factory.AssociateReferralDetailFactory;
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 AssociateReferralDetail
065        extends BaseEntity
066        implements Serializable {
067    
068    private AssociateReferralDetailPK _pk;
069    private AssociateReferralDetailValue _value;
070    
071    /** Creates a new instance of AssociateReferralDetail */
072    public AssociateReferralDetail()
073            throws PersistenceException {
074        super();
075    }
076    
077    /** Creates a new instance of AssociateReferralDetail */
078    public AssociateReferralDetail(AssociateReferralDetailValue value, EntityPermission entityPermission) {
079        super(entityPermission);
080        
081        _value = value;
082        _pk = value.getPrimaryKey();
083    }
084    
085    @Override
086    public AssociateReferralDetailFactory getBaseFactoryInstance() {
087        return AssociateReferralDetailFactory.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 AssociateReferralDetail) {
111            AssociateReferralDetail that = (AssociateReferralDetail)other;
112            
113            AssociateReferralDetailValue thatValue = that.getAssociateReferralDetailValue();
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 AssociateReferralDetailValue getAssociateReferralDetailValue() {
139        return _value;
140    }
141    
142    public void setAssociateReferralDetailValue(AssociateReferralDetailValue value)
143            throws PersistenceReadOnlyException {
144        checkReadWrite();
145        _value = value;
146    }
147    
148    @Override
149    public AssociateReferralDetailPK getPrimaryKey() {
150        return _pk;
151    }
152    
153    public AssociateReferralPK getAssociateReferralPK() {
154        return _value.getAssociateReferralPK();
155    }
156    
157    public AssociateReferral getAssociateReferral(Session session, EntityPermission entityPermission) {
158        AssociateReferralPK pk = getAssociateReferralPK();
159        AssociateReferral entity = pk == null? null: AssociateReferralFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
160        
161        return entity;
162    }
163    
164    public AssociateReferral getAssociateReferral(EntityPermission entityPermission) {
165        return getAssociateReferral(ThreadSession.currentSession(), entityPermission);
166    }
167    
168    public AssociateReferral getAssociateReferral(Session session) {
169        return getAssociateReferral(session, EntityPermission.READ_ONLY);
170    }
171    
172    public AssociateReferral getAssociateReferral() {
173        return getAssociateReferral(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
174    }
175    
176    public AssociateReferral getAssociateReferralForUpdate(Session session) {
177        return getAssociateReferral(session, EntityPermission.READ_WRITE);
178    }
179    
180    public AssociateReferral getAssociateReferralForUpdate() {
181        return getAssociateReferral(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
182    }
183    
184    public void setAssociateReferralPK(AssociateReferralPK associateReferralPK)
185            throws PersistenceNotNullException, PersistenceReadOnlyException {
186        checkReadWrite();
187        _value.setAssociateReferralPK(associateReferralPK);
188    }
189    
190    public void setAssociateReferral(AssociateReferral entity) {
191        setAssociateReferralPK(entity == null? null: entity.getPrimaryKey());
192    }
193    
194    public boolean getAssociateReferralPKHasBeenModified() {
195        return _value.getAssociateReferralPKHasBeenModified();
196    }
197    
198    public String getAssociateReferralName() {
199        return _value.getAssociateReferralName();
200    }
201    
202    public void setAssociateReferralName(String associateReferralName)
203            throws PersistenceNotNullException, PersistenceReadOnlyException {
204        checkReadWrite();
205        _value.setAssociateReferralName(associateReferralName);
206    }
207    
208    public boolean getAssociateReferralNameHasBeenModified() {
209        return _value.getAssociateReferralNameHasBeenModified();
210    }
211    
212    public AssociatePK getAssociatePK() {
213        return _value.getAssociatePK();
214    }
215    
216    public Associate getAssociate(Session session, EntityPermission entityPermission) {
217        return AssociateFactory.getInstance().getEntityFromPK(session, entityPermission, getAssociatePK());
218    }
219    
220    public Associate getAssociate(EntityPermission entityPermission) {
221        return getAssociate(ThreadSession.currentSession(), entityPermission);
222    }
223    
224    public Associate getAssociate(Session session) {
225        return getAssociate(session, EntityPermission.READ_ONLY);
226    }
227    
228    public Associate getAssociate() {
229        return getAssociate(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
230    }
231    
232    public Associate getAssociateForUpdate(Session session) {
233        return getAssociate(session, EntityPermission.READ_WRITE);
234    }
235    
236    public Associate getAssociateForUpdate() {
237        return getAssociate(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
238    }
239    
240    public void setAssociatePK(AssociatePK associatePK)
241            throws PersistenceNotNullException, PersistenceReadOnlyException {
242        checkReadWrite();
243        _value.setAssociatePK(associatePK);
244    }
245    
246    public void setAssociate(Associate entity) {
247        setAssociatePK(entity == null? null: entity.getPrimaryKey());
248    }
249    
250    public boolean getAssociatePKHasBeenModified() {
251        return _value.getAssociatePKHasBeenModified();
252    }
253    
254    public AssociatePartyContactMechanismPK getAssociatePartyContactMechanismPK() {
255        return _value.getAssociatePartyContactMechanismPK();
256    }
257    
258    public AssociatePartyContactMechanism getAssociatePartyContactMechanism(Session session, EntityPermission entityPermission) {
259        AssociatePartyContactMechanismPK pk = getAssociatePartyContactMechanismPK();
260        AssociatePartyContactMechanism entity = pk == null? null: AssociatePartyContactMechanismFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
261        
262        return entity;
263    }
264    
265    public AssociatePartyContactMechanism getAssociatePartyContactMechanism(EntityPermission entityPermission) {
266        return getAssociatePartyContactMechanism(ThreadSession.currentSession(), entityPermission);
267    }
268    
269    public AssociatePartyContactMechanism getAssociatePartyContactMechanism(Session session) {
270        return getAssociatePartyContactMechanism(session, EntityPermission.READ_ONLY);
271    }
272    
273    public AssociatePartyContactMechanism getAssociatePartyContactMechanism() {
274        return getAssociatePartyContactMechanism(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
275    }
276    
277    public AssociatePartyContactMechanism getAssociatePartyContactMechanismForUpdate(Session session) {
278        return getAssociatePartyContactMechanism(session, EntityPermission.READ_WRITE);
279    }
280    
281    public AssociatePartyContactMechanism getAssociatePartyContactMechanismForUpdate() {
282        return getAssociatePartyContactMechanism(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
283    }
284    
285    public void setAssociatePartyContactMechanismPK(AssociatePartyContactMechanismPK associatePartyContactMechanismPK)
286            throws PersistenceNotNullException, PersistenceReadOnlyException {
287        checkReadWrite();
288        _value.setAssociatePartyContactMechanismPK(associatePartyContactMechanismPK);
289    }
290    
291    public void setAssociatePartyContactMechanism(AssociatePartyContactMechanism entity) {
292        setAssociatePartyContactMechanismPK(entity == null? null: entity.getPrimaryKey());
293    }
294    
295    public boolean getAssociatePartyContactMechanismPKHasBeenModified() {
296        return _value.getAssociatePartyContactMechanismPKHasBeenModified();
297    }
298    
299    public EntityInstancePK getTargetEntityInstancePK() {
300        return _value.getTargetEntityInstancePK();
301    }
302    
303    public EntityInstance getTargetEntityInstance(Session session, EntityPermission entityPermission) {
304        EntityInstancePK pk = getTargetEntityInstancePK();
305        EntityInstance entity = pk == null? null: EntityInstanceFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
306        
307        return entity;
308    }
309    
310    public EntityInstance getTargetEntityInstance(EntityPermission entityPermission) {
311        return getTargetEntityInstance(ThreadSession.currentSession(), entityPermission);
312    }
313    
314    public EntityInstance getTargetEntityInstance(Session session) {
315        return getTargetEntityInstance(session, EntityPermission.READ_ONLY);
316    }
317    
318    public EntityInstance getTargetEntityInstance() {
319        return getTargetEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
320    }
321    
322    public EntityInstance getTargetEntityInstanceForUpdate(Session session) {
323        return getTargetEntityInstance(session, EntityPermission.READ_WRITE);
324    }
325    
326    public EntityInstance getTargetEntityInstanceForUpdate() {
327        return getTargetEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
328    }
329    
330    public void setTargetEntityInstancePK(EntityInstancePK targetEntityInstancePK)
331            throws PersistenceNotNullException, PersistenceReadOnlyException {
332        checkReadWrite();
333        _value.setTargetEntityInstancePK(targetEntityInstancePK);
334    }
335    
336    public void setTargetEntityInstance(EntityInstance entity) {
337        setTargetEntityInstancePK(entity == null? null: entity.getPrimaryKey());
338    }
339    
340    public boolean getTargetEntityInstancePKHasBeenModified() {
341        return _value.getTargetEntityInstancePKHasBeenModified();
342    }
343    
344    public Long getAssociateReferralTime() {
345        return _value.getAssociateReferralTime();
346    }
347    
348    public void setAssociateReferralTime(Long associateReferralTime)
349            throws PersistenceNotNullException, PersistenceReadOnlyException {
350        checkReadWrite();
351        _value.setAssociateReferralTime(associateReferralTime);
352    }
353    
354    public boolean getAssociateReferralTimeHasBeenModified() {
355        return _value.getAssociateReferralTimeHasBeenModified();
356    }
357    
358    public Long getFromTime() {
359        return _value.getFromTime();
360    }
361    
362    public void setFromTime(Long fromTime)
363            throws PersistenceNotNullException, PersistenceReadOnlyException {
364        checkReadWrite();
365        _value.setFromTime(fromTime);
366    }
367    
368    public boolean getFromTimeHasBeenModified() {
369        return _value.getFromTimeHasBeenModified();
370    }
371    
372    public Long getThruTime() {
373        return _value.getThruTime();
374    }
375    
376    public void setThruTime(Long thruTime)
377            throws PersistenceNotNullException, PersistenceReadOnlyException {
378        checkReadWrite();
379        _value.setThruTime(thruTime);
380    }
381    
382    public boolean getThruTimeHasBeenModified() {
383        return _value.getThruTimeHasBeenModified();
384    }
385    
386}