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