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 * AssociateDetail.java
021 */
022
023package com.echothree.model.data.associate.server.entity;
024
025import com.echothree.model.data.associate.common.pk.AssociateDetailPK;
026
027import com.echothree.model.data.associate.common.pk.AssociatePK;
028import com.echothree.model.data.associate.common.pk.AssociateProgramPK;
029import com.echothree.model.data.party.common.pk.PartyPK;
030import com.echothree.model.data.core.common.pk.MimeTypePK;
031
032import com.echothree.model.data.associate.server.entity.Associate;
033import com.echothree.model.data.associate.server.entity.AssociateProgram;
034import com.echothree.model.data.party.server.entity.Party;
035import com.echothree.model.data.core.server.entity.MimeType;
036
037import com.echothree.model.data.associate.server.factory.AssociateFactory;
038import com.echothree.model.data.associate.server.factory.AssociateProgramFactory;
039import com.echothree.model.data.party.server.factory.PartyFactory;
040import com.echothree.model.data.core.server.factory.MimeTypeFactory;
041
042import com.echothree.model.data.associate.common.pk.AssociateDetailPK;
043
044import com.echothree.model.data.associate.server.value.AssociateDetailValue;
045
046import com.echothree.model.data.associate.server.factory.AssociateDetailFactory;
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 AssociateDetail
068        extends BaseEntity
069        implements Serializable {
070    
071    private AssociateDetailPK _pk;
072    private AssociateDetailValue _value;
073    
074    /** Creates a new instance of AssociateDetail */
075    public AssociateDetail()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of AssociateDetail */
081    public AssociateDetail(AssociateDetailValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    @Nonnull
090    public AssociateDetailFactory getBaseFactoryInstance() {
091        return AssociateDetailFactory.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 AssociateDetail that) {
116            AssociateDetailValue thatValue = that.getAssociateDetailValue();
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 AssociateDetailValue getAssociateDetailValue() {
137        return _value;
138    }
139    
140    public void setAssociateDetailValue(@Nonnull AssociateDetailValue value)
141            throws PersistenceReadOnlyException {
142        checkReadWrite();
143        _value = value;
144    }
145    
146    @Override
147    @Nonnull
148    public AssociateDetailPK getPrimaryKey() {
149        return _pk;
150    }
151    
152    @Nullable
153    public AssociatePK getAssociatePK() {
154        return _value.getAssociatePK();
155    }
156    
157    @Nullable
158    public Associate getAssociate(EntityPermission entityPermission) {
159        AssociatePK pk = getAssociatePK();
160        Associate entity = pk == null? null: AssociateFactory.getInstance().getEntityFromPK(entityPermission, pk);
161        
162        return entity;
163    }
164    
165    @Nullable
166    public Associate getAssociate() {
167        return getAssociate(EntityPermission.READ_ONLY);
168    }
169    
170    @Nullable
171    public Associate getAssociateForUpdate() {
172        return getAssociate(EntityPermission.READ_WRITE);
173    }
174    
175    public void setAssociatePK(@Nullable AssociatePK associatePK)
176            throws PersistenceNotNullException, PersistenceReadOnlyException {
177        checkReadWrite();
178        _value.setAssociatePK(associatePK);
179    }
180    
181    public void setAssociate(@Nullable Associate entity) {
182        setAssociatePK(entity == null ? null : entity.getPrimaryKey());
183    }
184    
185    public boolean getAssociatePKHasBeenModified() {
186        return _value.getAssociatePKHasBeenModified();
187    }
188    
189    @Nonnull
190    public AssociateProgramPK getAssociateProgramPK() {
191        return _value.getAssociateProgramPK();
192    }
193    
194    @Nonnull
195    public AssociateProgram getAssociateProgram(EntityPermission entityPermission) {
196        return AssociateProgramFactory.getInstance().getEntityFromPK(entityPermission, getAssociateProgramPK());
197    }
198    
199    @Nonnull
200    public AssociateProgram getAssociateProgram() {
201        return getAssociateProgram(EntityPermission.READ_ONLY);
202    }
203    
204    @Nonnull
205    public AssociateProgram getAssociateProgramForUpdate() {
206        return getAssociateProgram(EntityPermission.READ_WRITE);
207    }
208    
209    public void setAssociateProgramPK(@Nonnull AssociateProgramPK associateProgramPK)
210            throws PersistenceNotNullException, PersistenceReadOnlyException {
211        checkReadWrite();
212        _value.setAssociateProgramPK(associateProgramPK);
213    }
214    
215    public void setAssociateProgram(@Nonnull AssociateProgram entity) {
216        setAssociateProgramPK(entity == null ? null : entity.getPrimaryKey());
217    }
218    
219    public boolean getAssociateProgramPKHasBeenModified() {
220        return _value.getAssociateProgramPKHasBeenModified();
221    }
222    
223    @Nonnull
224    public String getAssociateName() {
225        return _value.getAssociateName();
226    }
227    
228    public void setAssociateName(@Nonnull String associateName)
229            throws PersistenceNotNullException, PersistenceReadOnlyException {
230        checkReadWrite();
231        _value.setAssociateName(associateName);
232    }
233    
234    public boolean getAssociateNameHasBeenModified() {
235        return _value.getAssociateNameHasBeenModified();
236    }
237    
238    @Nonnull
239    public PartyPK getPartyPK() {
240        return _value.getPartyPK();
241    }
242    
243    @Nonnull
244    public Party getParty(EntityPermission entityPermission) {
245        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getPartyPK());
246    }
247    
248    @Nonnull
249    public Party getParty() {
250        return getParty(EntityPermission.READ_ONLY);
251    }
252    
253    @Nonnull
254    public Party getPartyForUpdate() {
255        return getParty(EntityPermission.READ_WRITE);
256    }
257    
258    public void setPartyPK(@Nonnull PartyPK partyPK)
259            throws PersistenceNotNullException, PersistenceReadOnlyException {
260        checkReadWrite();
261        _value.setPartyPK(partyPK);
262    }
263    
264    public void setParty(@Nonnull Party entity) {
265        setPartyPK(entity == null ? null : entity.getPrimaryKey());
266    }
267    
268    public boolean getPartyPKHasBeenModified() {
269        return _value.getPartyPKHasBeenModified();
270    }
271    
272    @Nonnull
273    public String getDescription() {
274        return _value.getDescription();
275    }
276    
277    public void setDescription(@Nonnull String description)
278            throws PersistenceNotNullException, PersistenceReadOnlyException {
279        checkReadWrite();
280        _value.setDescription(description);
281    }
282    
283    public boolean getDescriptionHasBeenModified() {
284        return _value.getDescriptionHasBeenModified();
285    }
286    
287    @Nonnull
288    public MimeTypePK getSummaryMimeTypePK() {
289        return _value.getSummaryMimeTypePK();
290    }
291    
292    @Nonnull
293    public MimeType getSummaryMimeType(EntityPermission entityPermission) {
294        return MimeTypeFactory.getInstance().getEntityFromPK(entityPermission, getSummaryMimeTypePK());
295    }
296    
297    @Nonnull
298    public MimeType getSummaryMimeType() {
299        return getSummaryMimeType(EntityPermission.READ_ONLY);
300    }
301    
302    @Nonnull
303    public MimeType getSummaryMimeTypeForUpdate() {
304        return getSummaryMimeType(EntityPermission.READ_WRITE);
305    }
306    
307    public void setSummaryMimeTypePK(@Nonnull MimeTypePK summaryMimeTypePK)
308            throws PersistenceNotNullException, PersistenceReadOnlyException {
309        checkReadWrite();
310        _value.setSummaryMimeTypePK(summaryMimeTypePK);
311    }
312    
313    public void setSummaryMimeType(@Nonnull MimeType entity) {
314        setSummaryMimeTypePK(entity == null ? null : entity.getPrimaryKey());
315    }
316    
317    public boolean getSummaryMimeTypePKHasBeenModified() {
318        return _value.getSummaryMimeTypePKHasBeenModified();
319    }
320    
321    @Nonnull
322    public String getSummary() {
323        return _value.getSummary();
324    }
325    
326    public void setSummary(@Nonnull String summary)
327            throws PersistenceNotNullException, PersistenceReadOnlyException {
328        checkReadWrite();
329        _value.setSummary(summary);
330    }
331    
332    public boolean getSummaryHasBeenModified() {
333        return _value.getSummaryHasBeenModified();
334    }
335    
336    @Nonnull
337    public Long getFromTime() {
338        return _value.getFromTime();
339    }
340    
341    public void setFromTime(@Nonnull Long fromTime)
342            throws PersistenceNotNullException, PersistenceReadOnlyException {
343        checkReadWrite();
344        _value.setFromTime(fromTime);
345    }
346    
347    public boolean getFromTimeHasBeenModified() {
348        return _value.getFromTimeHasBeenModified();
349    }
350    
351    @Nonnull
352    public Long getThruTime() {
353        return _value.getThruTime();
354    }
355    
356    public void setThruTime(@Nonnull Long thruTime)
357            throws PersistenceNotNullException, PersistenceReadOnlyException {
358        checkReadWrite();
359        _value.setThruTime(thruTime);
360    }
361    
362    public boolean getThruTimeHasBeenModified() {
363        return _value.getThruTimeHasBeenModified();
364    }
365    
366}