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 * PartyContactListDetail.java
021 */
022
023package com.echothree.model.data.contactlist.server.entity;
024
025import com.echothree.model.data.contactlist.common.pk.PartyContactListDetailPK;
026
027import com.echothree.model.data.contactlist.common.pk.PartyContactListPK;
028import com.echothree.model.data.party.common.pk.PartyPK;
029import com.echothree.model.data.contactlist.common.pk.ContactListPK;
030import com.echothree.model.data.contactlist.common.pk.ContactListContactMechanismPurposePK;
031
032import com.echothree.model.data.contactlist.server.entity.PartyContactList;
033import com.echothree.model.data.party.server.entity.Party;
034import com.echothree.model.data.contactlist.server.entity.ContactList;
035import com.echothree.model.data.contactlist.server.entity.ContactListContactMechanismPurpose;
036
037import com.echothree.model.data.contactlist.server.factory.PartyContactListFactory;
038import com.echothree.model.data.party.server.factory.PartyFactory;
039import com.echothree.model.data.contactlist.server.factory.ContactListFactory;
040import com.echothree.model.data.contactlist.server.factory.ContactListContactMechanismPurposeFactory;
041
042import com.echothree.model.data.contactlist.common.pk.PartyContactListDetailPK;
043
044import com.echothree.model.data.contactlist.server.value.PartyContactListDetailValue;
045
046import com.echothree.model.data.contactlist.server.factory.PartyContactListDetailFactory;
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 PartyContactListDetail
065        extends BaseEntity
066        implements Serializable {
067    
068    private PartyContactListDetailPK _pk;
069    private PartyContactListDetailValue _value;
070    
071    /** Creates a new instance of PartyContactListDetail */
072    public PartyContactListDetail()
073            throws PersistenceException {
074        super();
075    }
076    
077    /** Creates a new instance of PartyContactListDetail */
078    public PartyContactListDetail(PartyContactListDetailValue value, EntityPermission entityPermission) {
079        super(entityPermission);
080        
081        _value = value;
082        _pk = value.getPrimaryKey();
083    }
084    
085    @Override
086    public PartyContactListDetailFactory getBaseFactoryInstance() {
087        return PartyContactListDetailFactory.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 PartyContactListDetail) {
111            PartyContactListDetail that = (PartyContactListDetail)other;
112            
113            PartyContactListDetailValue thatValue = that.getPartyContactListDetailValue();
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 PartyContactListDetailValue getPartyContactListDetailValue() {
139        return _value;
140    }
141    
142    public void setPartyContactListDetailValue(PartyContactListDetailValue value)
143            throws PersistenceReadOnlyException {
144        checkReadWrite();
145        _value = value;
146    }
147    
148    @Override
149    public PartyContactListDetailPK getPrimaryKey() {
150        return _pk;
151    }
152    
153    public PartyContactListPK getPartyContactListPK() {
154        return _value.getPartyContactListPK();
155    }
156    
157    public PartyContactList getPartyContactList(Session session, EntityPermission entityPermission) {
158        return PartyContactListFactory.getInstance().getEntityFromPK(session, entityPermission, getPartyContactListPK());
159    }
160    
161    public PartyContactList getPartyContactList(EntityPermission entityPermission) {
162        return getPartyContactList(ThreadSession.currentSession(), entityPermission);
163    }
164    
165    public PartyContactList getPartyContactList(Session session) {
166        return getPartyContactList(session, EntityPermission.READ_ONLY);
167    }
168    
169    public PartyContactList getPartyContactList() {
170        return getPartyContactList(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
171    }
172    
173    public PartyContactList getPartyContactListForUpdate(Session session) {
174        return getPartyContactList(session, EntityPermission.READ_WRITE);
175    }
176    
177    public PartyContactList getPartyContactListForUpdate() {
178        return getPartyContactList(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
179    }
180    
181    public void setPartyContactListPK(PartyContactListPK partyContactListPK)
182            throws PersistenceNotNullException, PersistenceReadOnlyException {
183        checkReadWrite();
184        _value.setPartyContactListPK(partyContactListPK);
185    }
186    
187    public void setPartyContactList(PartyContactList entity) {
188        setPartyContactListPK(entity == null? null: entity.getPrimaryKey());
189    }
190    
191    public boolean getPartyContactListPKHasBeenModified() {
192        return _value.getPartyContactListPKHasBeenModified();
193    }
194    
195    public PartyPK getPartyPK() {
196        return _value.getPartyPK();
197    }
198    
199    public Party getParty(Session session, EntityPermission entityPermission) {
200        return PartyFactory.getInstance().getEntityFromPK(session, entityPermission, getPartyPK());
201    }
202    
203    public Party getParty(EntityPermission entityPermission) {
204        return getParty(ThreadSession.currentSession(), entityPermission);
205    }
206    
207    public Party getParty(Session session) {
208        return getParty(session, EntityPermission.READ_ONLY);
209    }
210    
211    public Party getParty() {
212        return getParty(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
213    }
214    
215    public Party getPartyForUpdate(Session session) {
216        return getParty(session, EntityPermission.READ_WRITE);
217    }
218    
219    public Party getPartyForUpdate() {
220        return getParty(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
221    }
222    
223    public void setPartyPK(PartyPK partyPK)
224            throws PersistenceNotNullException, PersistenceReadOnlyException {
225        checkReadWrite();
226        _value.setPartyPK(partyPK);
227    }
228    
229    public void setParty(Party entity) {
230        setPartyPK(entity == null? null: entity.getPrimaryKey());
231    }
232    
233    public boolean getPartyPKHasBeenModified() {
234        return _value.getPartyPKHasBeenModified();
235    }
236    
237    public ContactListPK getContactListPK() {
238        return _value.getContactListPK();
239    }
240    
241    public ContactList getContactList(Session session, EntityPermission entityPermission) {
242        return ContactListFactory.getInstance().getEntityFromPK(session, entityPermission, getContactListPK());
243    }
244    
245    public ContactList getContactList(EntityPermission entityPermission) {
246        return getContactList(ThreadSession.currentSession(), entityPermission);
247    }
248    
249    public ContactList getContactList(Session session) {
250        return getContactList(session, EntityPermission.READ_ONLY);
251    }
252    
253    public ContactList getContactList() {
254        return getContactList(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
255    }
256    
257    public ContactList getContactListForUpdate(Session session) {
258        return getContactList(session, EntityPermission.READ_WRITE);
259    }
260    
261    public ContactList getContactListForUpdate() {
262        return getContactList(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
263    }
264    
265    public void setContactListPK(ContactListPK contactListPK)
266            throws PersistenceNotNullException, PersistenceReadOnlyException {
267        checkReadWrite();
268        _value.setContactListPK(contactListPK);
269    }
270    
271    public void setContactList(ContactList entity) {
272        setContactListPK(entity == null? null: entity.getPrimaryKey());
273    }
274    
275    public boolean getContactListPKHasBeenModified() {
276        return _value.getContactListPKHasBeenModified();
277    }
278    
279    public ContactListContactMechanismPurposePK getPreferredContactListContactMechanismPurposePK() {
280        return _value.getPreferredContactListContactMechanismPurposePK();
281    }
282    
283    public ContactListContactMechanismPurpose getPreferredContactListContactMechanismPurpose(Session session, EntityPermission entityPermission) {
284        ContactListContactMechanismPurposePK pk = getPreferredContactListContactMechanismPurposePK();
285        ContactListContactMechanismPurpose entity = pk == null? null: ContactListContactMechanismPurposeFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
286        
287        return entity;
288    }
289    
290    public ContactListContactMechanismPurpose getPreferredContactListContactMechanismPurpose(EntityPermission entityPermission) {
291        return getPreferredContactListContactMechanismPurpose(ThreadSession.currentSession(), entityPermission);
292    }
293    
294    public ContactListContactMechanismPurpose getPreferredContactListContactMechanismPurpose(Session session) {
295        return getPreferredContactListContactMechanismPurpose(session, EntityPermission.READ_ONLY);
296    }
297    
298    public ContactListContactMechanismPurpose getPreferredContactListContactMechanismPurpose() {
299        return getPreferredContactListContactMechanismPurpose(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
300    }
301    
302    public ContactListContactMechanismPurpose getPreferredContactListContactMechanismPurposeForUpdate(Session session) {
303        return getPreferredContactListContactMechanismPurpose(session, EntityPermission.READ_WRITE);
304    }
305    
306    public ContactListContactMechanismPurpose getPreferredContactListContactMechanismPurposeForUpdate() {
307        return getPreferredContactListContactMechanismPurpose(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
308    }
309    
310    public void setPreferredContactListContactMechanismPurposePK(ContactListContactMechanismPurposePK preferredContactListContactMechanismPurposePK)
311            throws PersistenceNotNullException, PersistenceReadOnlyException {
312        checkReadWrite();
313        _value.setPreferredContactListContactMechanismPurposePK(preferredContactListContactMechanismPurposePK);
314    }
315    
316    public void setPreferredContactListContactMechanismPurpose(ContactListContactMechanismPurpose entity) {
317        setPreferredContactListContactMechanismPurposePK(entity == null? null: entity.getPrimaryKey());
318    }
319    
320    public boolean getPreferredContactListContactMechanismPurposePKHasBeenModified() {
321        return _value.getPreferredContactListContactMechanismPurposePKHasBeenModified();
322    }
323    
324    public Long getFromTime() {
325        return _value.getFromTime();
326    }
327    
328    public void setFromTime(Long fromTime)
329            throws PersistenceNotNullException, PersistenceReadOnlyException {
330        checkReadWrite();
331        _value.setFromTime(fromTime);
332    }
333    
334    public boolean getFromTimeHasBeenModified() {
335        return _value.getFromTimeHasBeenModified();
336    }
337    
338    public Long getThruTime() {
339        return _value.getThruTime();
340    }
341    
342    public void setThruTime(Long thruTime)
343            throws PersistenceNotNullException, PersistenceReadOnlyException {
344        checkReadWrite();
345        _value.setThruTime(thruTime);
346    }
347    
348    public boolean getThruTimeHasBeenModified() {
349        return _value.getThruTimeHasBeenModified();
350    }
351    
352}