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 * BillingAccountRole.java
021 */
022
023package com.echothree.model.data.payment.server.entity;
024
025import com.echothree.model.data.payment.common.pk.BillingAccountRolePK;
026
027import com.echothree.model.data.payment.common.pk.BillingAccountPK;
028import com.echothree.model.data.party.common.pk.PartyPK;
029import com.echothree.model.data.contact.common.pk.PartyContactMechanismPK;
030import com.echothree.model.data.payment.common.pk.BillingAccountRoleTypePK;
031
032import com.echothree.model.data.payment.server.entity.BillingAccount;
033import com.echothree.model.data.party.server.entity.Party;
034import com.echothree.model.data.contact.server.entity.PartyContactMechanism;
035import com.echothree.model.data.payment.server.entity.BillingAccountRoleType;
036
037import com.echothree.model.data.payment.server.factory.BillingAccountFactory;
038import com.echothree.model.data.party.server.factory.PartyFactory;
039import com.echothree.model.data.contact.server.factory.PartyContactMechanismFactory;
040import com.echothree.model.data.payment.server.factory.BillingAccountRoleTypeFactory;
041
042import com.echothree.model.data.payment.common.pk.BillingAccountRolePK;
043
044import com.echothree.model.data.payment.server.value.BillingAccountRoleValue;
045
046import com.echothree.model.data.payment.server.factory.BillingAccountRoleFactory;
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 BillingAccountRole
065        extends BaseEntity
066        implements Serializable {
067    
068    private BillingAccountRolePK _pk;
069    private BillingAccountRoleValue _value;
070    
071    /** Creates a new instance of BillingAccountRole */
072    public BillingAccountRole()
073            throws PersistenceException {
074        super();
075    }
076    
077    /** Creates a new instance of BillingAccountRole */
078    public BillingAccountRole(BillingAccountRoleValue value, EntityPermission entityPermission) {
079        super(entityPermission);
080        
081        _value = value;
082        _pk = value.getPrimaryKey();
083    }
084    
085    @Override
086    public BillingAccountRoleFactory getBaseFactoryInstance() {
087        return BillingAccountRoleFactory.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 BillingAccountRole) {
111            BillingAccountRole that = (BillingAccountRole)other;
112            
113            BillingAccountRoleValue thatValue = that.getBillingAccountRoleValue();
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 BillingAccountRoleValue getBillingAccountRoleValue() {
139        return _value;
140    }
141    
142    public void setBillingAccountRoleValue(BillingAccountRoleValue value)
143            throws PersistenceReadOnlyException {
144        checkReadWrite();
145        _value = value;
146    }
147    
148    @Override
149    public BillingAccountRolePK getPrimaryKey() {
150        return _pk;
151    }
152    
153    public BillingAccountPK getBillingAccountPK() {
154        return _value.getBillingAccountPK();
155    }
156    
157    public BillingAccount getBillingAccount(Session session, EntityPermission entityPermission) {
158        return BillingAccountFactory.getInstance().getEntityFromPK(session, entityPermission, getBillingAccountPK());
159    }
160    
161    public BillingAccount getBillingAccount(EntityPermission entityPermission) {
162        return getBillingAccount(ThreadSession.currentSession(), entityPermission);
163    }
164    
165    public BillingAccount getBillingAccount(Session session) {
166        return getBillingAccount(session, EntityPermission.READ_ONLY);
167    }
168    
169    public BillingAccount getBillingAccount() {
170        return getBillingAccount(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
171    }
172    
173    public BillingAccount getBillingAccountForUpdate(Session session) {
174        return getBillingAccount(session, EntityPermission.READ_WRITE);
175    }
176    
177    public BillingAccount getBillingAccountForUpdate() {
178        return getBillingAccount(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
179    }
180    
181    public void setBillingAccountPK(BillingAccountPK billingAccountPK)
182            throws PersistenceNotNullException, PersistenceReadOnlyException {
183        checkReadWrite();
184        _value.setBillingAccountPK(billingAccountPK);
185    }
186    
187    public void setBillingAccount(BillingAccount entity) {
188        setBillingAccountPK(entity == null? null: entity.getPrimaryKey());
189    }
190    
191    public boolean getBillingAccountPKHasBeenModified() {
192        return _value.getBillingAccountPKHasBeenModified();
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 PartyContactMechanismPK getPartyContactMechanismPK() {
238        return _value.getPartyContactMechanismPK();
239    }
240    
241    public PartyContactMechanism getPartyContactMechanism(Session session, EntityPermission entityPermission) {
242        return PartyContactMechanismFactory.getInstance().getEntityFromPK(session, entityPermission, getPartyContactMechanismPK());
243    }
244    
245    public PartyContactMechanism getPartyContactMechanism(EntityPermission entityPermission) {
246        return getPartyContactMechanism(ThreadSession.currentSession(), entityPermission);
247    }
248    
249    public PartyContactMechanism getPartyContactMechanism(Session session) {
250        return getPartyContactMechanism(session, EntityPermission.READ_ONLY);
251    }
252    
253    public PartyContactMechanism getPartyContactMechanism() {
254        return getPartyContactMechanism(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
255    }
256    
257    public PartyContactMechanism getPartyContactMechanismForUpdate(Session session) {
258        return getPartyContactMechanism(session, EntityPermission.READ_WRITE);
259    }
260    
261    public PartyContactMechanism getPartyContactMechanismForUpdate() {
262        return getPartyContactMechanism(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
263    }
264    
265    public void setPartyContactMechanismPK(PartyContactMechanismPK partyContactMechanismPK)
266            throws PersistenceNotNullException, PersistenceReadOnlyException {
267        checkReadWrite();
268        _value.setPartyContactMechanismPK(partyContactMechanismPK);
269    }
270    
271    public void setPartyContactMechanism(PartyContactMechanism entity) {
272        setPartyContactMechanismPK(entity == null? null: entity.getPrimaryKey());
273    }
274    
275    public boolean getPartyContactMechanismPKHasBeenModified() {
276        return _value.getPartyContactMechanismPKHasBeenModified();
277    }
278    
279    public BillingAccountRoleTypePK getBillingAccountRoleTypePK() {
280        return _value.getBillingAccountRoleTypePK();
281    }
282    
283    public BillingAccountRoleType getBillingAccountRoleType(Session session, EntityPermission entityPermission) {
284        return BillingAccountRoleTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getBillingAccountRoleTypePK());
285    }
286    
287    public BillingAccountRoleType getBillingAccountRoleType(EntityPermission entityPermission) {
288        return getBillingAccountRoleType(ThreadSession.currentSession(), entityPermission);
289    }
290    
291    public BillingAccountRoleType getBillingAccountRoleType(Session session) {
292        return getBillingAccountRoleType(session, EntityPermission.READ_ONLY);
293    }
294    
295    public BillingAccountRoleType getBillingAccountRoleType() {
296        return getBillingAccountRoleType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
297    }
298    
299    public BillingAccountRoleType getBillingAccountRoleTypeForUpdate(Session session) {
300        return getBillingAccountRoleType(session, EntityPermission.READ_WRITE);
301    }
302    
303    public BillingAccountRoleType getBillingAccountRoleTypeForUpdate() {
304        return getBillingAccountRoleType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
305    }
306    
307    public void setBillingAccountRoleTypePK(BillingAccountRoleTypePK billingAccountRoleTypePK)
308            throws PersistenceNotNullException, PersistenceReadOnlyException {
309        checkReadWrite();
310        _value.setBillingAccountRoleTypePK(billingAccountRoleTypePK);
311    }
312    
313    public void setBillingAccountRoleType(BillingAccountRoleType entity) {
314        setBillingAccountRoleTypePK(entity == null? null: entity.getPrimaryKey());
315    }
316    
317    public boolean getBillingAccountRoleTypePKHasBeenModified() {
318        return _value.getBillingAccountRoleTypePKHasBeenModified();
319    }
320    
321    public Long getFromTime() {
322        return _value.getFromTime();
323    }
324    
325    public void setFromTime(Long fromTime)
326            throws PersistenceNotNullException, PersistenceReadOnlyException {
327        checkReadWrite();
328        _value.setFromTime(fromTime);
329    }
330    
331    public boolean getFromTimeHasBeenModified() {
332        return _value.getFromTimeHasBeenModified();
333    }
334    
335    public Long getThruTime() {
336        return _value.getThruTime();
337    }
338    
339    public void setThruTime(Long thruTime)
340            throws PersistenceNotNullException, PersistenceReadOnlyException {
341        checkReadWrite();
342        _value.setThruTime(thruTime);
343    }
344    
345    public boolean getThruTimeHasBeenModified() {
346        return _value.getThruTimeHasBeenModified();
347    }
348    
349}