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