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 * Person.java
021 */
022
023package com.echothree.model.data.party.server.entity;
024
025import com.echothree.model.data.party.common.pk.PersonPK;
026
027import com.echothree.model.data.party.common.pk.PartyPK;
028import com.echothree.model.data.party.common.pk.PersonalTitlePK;
029import com.echothree.model.data.party.common.pk.NameSuffixPK;
030
031import com.echothree.model.data.party.server.entity.Party;
032import com.echothree.model.data.party.server.entity.PersonalTitle;
033import com.echothree.model.data.party.server.entity.NameSuffix;
034
035import com.echothree.model.data.party.server.factory.PartyFactory;
036import com.echothree.model.data.party.server.factory.PersonalTitleFactory;
037import com.echothree.model.data.party.server.factory.NameSuffixFactory;
038
039import com.echothree.model.data.party.common.pk.PersonPK;
040
041import com.echothree.model.data.party.server.value.PersonValue;
042
043import com.echothree.model.data.party.server.factory.PersonFactory;
044
045import com.echothree.util.common.exception.PersistenceException;
046import com.echothree.util.common.exception.PersistenceDatabaseException;
047import com.echothree.util.common.exception.PersistenceNotNullException;
048import com.echothree.util.common.exception.PersistenceReadOnlyException;
049
050import com.echothree.util.common.persistence.BasePK;
051
052import com.echothree.util.common.persistence.type.ByteArray;
053
054import com.echothree.util.server.persistence.BaseEntity;
055import com.echothree.util.server.persistence.EntityPermission;
056import com.echothree.util.server.persistence.Session;
057import com.echothree.util.server.persistence.ThreadSession;
058
059import java.io.Serializable;
060
061public class Person
062        extends BaseEntity
063        implements Serializable {
064    
065    private PersonPK _pk;
066    private PersonValue _value;
067    
068    /** Creates a new instance of Person */
069    public Person()
070            throws PersistenceException {
071        super();
072    }
073    
074    /** Creates a new instance of Person */
075    public Person(PersonValue value, EntityPermission entityPermission) {
076        super(entityPermission);
077        
078        _value = value;
079        _pk = value.getPrimaryKey();
080    }
081    
082    @Override
083    public PersonFactory getBaseFactoryInstance() {
084        return PersonFactory.getInstance();
085    }
086    
087    @Override
088    public boolean hasBeenModified() {
089        return _value.hasBeenModified();
090    }
091    
092    @Override
093    public int hashCode() {
094        return _pk.hashCode();
095    }
096    
097    @Override
098    public String toString() {
099        return _pk.toString();
100    }
101    
102    @Override
103    public boolean equals(Object other) {
104        if(this == other)
105            return true;
106        
107        if(other instanceof Person that) {
108            PersonValue thatValue = that.getPersonValue();
109            return _value.equals(thatValue);
110        } else {
111            return false;
112        }
113    }
114    
115    @Override
116    public void store()
117            throws PersistenceDatabaseException {
118        getBaseFactoryInstance().store(this);
119    }
120    
121    @Override
122    public void remove()
123            throws PersistenceDatabaseException {
124        getBaseFactoryInstance().remove(this);
125    }
126    
127    public PersonValue getPersonValue() {
128        return _value;
129    }
130    
131    public void setPersonValue(PersonValue value)
132            throws PersistenceReadOnlyException {
133        checkReadWrite();
134        _value = value;
135    }
136    
137    @Override
138    public PersonPK getPrimaryKey() {
139        return _pk;
140    }
141    
142    public PartyPK getPartyPK() {
143        return _value.getPartyPK();
144    }
145    
146    public Party getParty(EntityPermission entityPermission) {
147        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getPartyPK());
148    }
149    
150    public Party getParty() {
151        return getParty(EntityPermission.READ_ONLY);
152    }
153    
154    public Party getPartyForUpdate() {
155        return getParty(EntityPermission.READ_WRITE);
156    }
157    
158    public void setPartyPK(PartyPK partyPK)
159            throws PersistenceNotNullException, PersistenceReadOnlyException {
160        checkReadWrite();
161        _value.setPartyPK(partyPK);
162    }
163    
164    public void setParty(Party entity) {
165        setPartyPK(entity == null? null: entity.getPrimaryKey());
166    }
167    
168    public boolean getPartyPKHasBeenModified() {
169        return _value.getPartyPKHasBeenModified();
170    }
171    
172    public PersonalTitlePK getPersonalTitlePK() {
173        return _value.getPersonalTitlePK();
174    }
175    
176    public PersonalTitle getPersonalTitle(EntityPermission entityPermission) {
177        PersonalTitlePK pk = getPersonalTitlePK();
178        PersonalTitle entity = pk == null? null: PersonalTitleFactory.getInstance().getEntityFromPK(entityPermission, pk);
179        
180        return entity;
181    }
182    
183    public PersonalTitle getPersonalTitle() {
184        return getPersonalTitle(EntityPermission.READ_ONLY);
185    }
186    
187    public PersonalTitle getPersonalTitleForUpdate() {
188        return getPersonalTitle(EntityPermission.READ_WRITE);
189    }
190    
191    public void setPersonalTitlePK(PersonalTitlePK personalTitlePK)
192            throws PersistenceNotNullException, PersistenceReadOnlyException {
193        checkReadWrite();
194        _value.setPersonalTitlePK(personalTitlePK);
195    }
196    
197    public void setPersonalTitle(PersonalTitle entity) {
198        setPersonalTitlePK(entity == null? null: entity.getPrimaryKey());
199    }
200    
201    public boolean getPersonalTitlePKHasBeenModified() {
202        return _value.getPersonalTitlePKHasBeenModified();
203    }
204    
205    public String getFirstName() {
206        return _value.getFirstName();
207    }
208    
209    public void setFirstName(String firstName)
210            throws PersistenceNotNullException, PersistenceReadOnlyException {
211        checkReadWrite();
212        _value.setFirstName(firstName);
213    }
214    
215    public boolean getFirstNameHasBeenModified() {
216        return _value.getFirstNameHasBeenModified();
217    }
218    
219    public String getFirstNameSdx() {
220        return _value.getFirstNameSdx();
221    }
222    
223    public void setFirstNameSdx(String firstNameSdx)
224            throws PersistenceNotNullException, PersistenceReadOnlyException {
225        checkReadWrite();
226        _value.setFirstNameSdx(firstNameSdx);
227    }
228    
229    public boolean getFirstNameSdxHasBeenModified() {
230        return _value.getFirstNameSdxHasBeenModified();
231    }
232    
233    public String getMiddleName() {
234        return _value.getMiddleName();
235    }
236    
237    public void setMiddleName(String middleName)
238            throws PersistenceNotNullException, PersistenceReadOnlyException {
239        checkReadWrite();
240        _value.setMiddleName(middleName);
241    }
242    
243    public boolean getMiddleNameHasBeenModified() {
244        return _value.getMiddleNameHasBeenModified();
245    }
246    
247    public String getMiddleNameSdx() {
248        return _value.getMiddleNameSdx();
249    }
250    
251    public void setMiddleNameSdx(String middleNameSdx)
252            throws PersistenceNotNullException, PersistenceReadOnlyException {
253        checkReadWrite();
254        _value.setMiddleNameSdx(middleNameSdx);
255    }
256    
257    public boolean getMiddleNameSdxHasBeenModified() {
258        return _value.getMiddleNameSdxHasBeenModified();
259    }
260    
261    public String getLastName() {
262        return _value.getLastName();
263    }
264    
265    public void setLastName(String lastName)
266            throws PersistenceNotNullException, PersistenceReadOnlyException {
267        checkReadWrite();
268        _value.setLastName(lastName);
269    }
270    
271    public boolean getLastNameHasBeenModified() {
272        return _value.getLastNameHasBeenModified();
273    }
274    
275    public String getLastNameSdx() {
276        return _value.getLastNameSdx();
277    }
278    
279    public void setLastNameSdx(String lastNameSdx)
280            throws PersistenceNotNullException, PersistenceReadOnlyException {
281        checkReadWrite();
282        _value.setLastNameSdx(lastNameSdx);
283    }
284    
285    public boolean getLastNameSdxHasBeenModified() {
286        return _value.getLastNameSdxHasBeenModified();
287    }
288    
289    public NameSuffixPK getNameSuffixPK() {
290        return _value.getNameSuffixPK();
291    }
292    
293    public NameSuffix getNameSuffix(EntityPermission entityPermission) {
294        NameSuffixPK pk = getNameSuffixPK();
295        NameSuffix entity = pk == null? null: NameSuffixFactory.getInstance().getEntityFromPK(entityPermission, pk);
296        
297        return entity;
298    }
299    
300    public NameSuffix getNameSuffix() {
301        return getNameSuffix(EntityPermission.READ_ONLY);
302    }
303    
304    public NameSuffix getNameSuffixForUpdate() {
305        return getNameSuffix(EntityPermission.READ_WRITE);
306    }
307    
308    public void setNameSuffixPK(NameSuffixPK nameSuffixPK)
309            throws PersistenceNotNullException, PersistenceReadOnlyException {
310        checkReadWrite();
311        _value.setNameSuffixPK(nameSuffixPK);
312    }
313    
314    public void setNameSuffix(NameSuffix entity) {
315        setNameSuffixPK(entity == null? null: entity.getPrimaryKey());
316    }
317    
318    public boolean getNameSuffixPKHasBeenModified() {
319        return _value.getNameSuffixPKHasBeenModified();
320    }
321    
322    public Long getFromTime() {
323        return _value.getFromTime();
324    }
325    
326    public void setFromTime(Long fromTime)
327            throws PersistenceNotNullException, PersistenceReadOnlyException {
328        checkReadWrite();
329        _value.setFromTime(fromTime);
330    }
331    
332    public boolean getFromTimeHasBeenModified() {
333        return _value.getFromTimeHasBeenModified();
334    }
335    
336    public Long getThruTime() {
337        return _value.getThruTime();
338    }
339    
340    public void setThruTime(Long thruTime)
341            throws PersistenceNotNullException, PersistenceReadOnlyException {
342        checkReadWrite();
343        _value.setThruTime(thruTime);
344    }
345    
346    public boolean getThruTimeHasBeenModified() {
347        return _value.getThruTimeHasBeenModified();
348    }
349    
350}