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 * PartyDepartment.java
021 */
022
023package com.echothree.model.data.party.server.entity;
024
025import com.echothree.model.data.party.common.pk.PartyDepartmentPK;
026
027import com.echothree.model.data.party.common.pk.PartyPK;
028
029import com.echothree.model.data.party.server.entity.Party;
030
031import com.echothree.model.data.party.server.factory.PartyFactory;
032
033import com.echothree.model.data.party.common.pk.PartyDepartmentPK;
034
035import com.echothree.model.data.party.server.value.PartyDepartmentValue;
036
037import com.echothree.model.data.party.server.factory.PartyDepartmentFactory;
038
039import com.echothree.util.common.exception.PersistenceException;
040import com.echothree.util.common.exception.PersistenceDatabaseException;
041import com.echothree.util.common.exception.PersistenceNotNullException;
042import com.echothree.util.common.exception.PersistenceReadOnlyException;
043
044import com.echothree.util.common.persistence.BasePK;
045
046import com.echothree.util.common.persistence.type.ByteArray;
047
048import com.echothree.util.server.persistence.BaseEntity;
049import com.echothree.util.server.persistence.EntityPermission;
050import com.echothree.util.server.persistence.Session;
051import com.echothree.util.server.persistence.ThreadSession;
052
053import java.io.Serializable;
054
055import javax.annotation.Nonnull;
056import javax.annotation.Nullable;
057
058public class PartyDepartment
059        extends BaseEntity
060        implements Serializable {
061    
062    private PartyDepartmentPK _pk;
063    private PartyDepartmentValue _value;
064    
065    /** Creates a new instance of PartyDepartment */
066    public PartyDepartment()
067            throws PersistenceException {
068        super();
069    }
070    
071    /** Creates a new instance of PartyDepartment */
072    public PartyDepartment(PartyDepartmentValue value, EntityPermission entityPermission) {
073        super(entityPermission);
074        
075        _value = value;
076        _pk = value.getPrimaryKey();
077    }
078    
079    @Override
080    @Nonnull
081    public PartyDepartmentFactory getBaseFactoryInstance() {
082        return PartyDepartmentFactory.getInstance();
083    }
084    
085    @Override
086    public boolean hasBeenModified() {
087        return _value.hasBeenModified();
088    }
089    
090    @Override
091    public int hashCode() {
092        return _pk.hashCode();
093    }
094    
095    @Override
096    @Nonnull
097    public String toString() {
098        return _pk.toString();
099    }
100    
101    @Override
102    public boolean equals(Object other) {
103        if(this == other)
104            return true;
105        
106        if(other instanceof PartyDepartment that) {
107            PartyDepartmentValue thatValue = that.getPartyDepartmentValue();
108            return _value.equals(thatValue);
109        } else {
110            return false;
111        }
112    }
113    
114    @Override
115    public void store()
116            throws PersistenceDatabaseException {
117        getBaseFactoryInstance().store(this);
118    }
119    
120    @Override
121    public void remove()
122            throws PersistenceDatabaseException {
123        getBaseFactoryInstance().remove(this);
124    }
125    
126    @Nonnull
127    public PartyDepartmentValue getPartyDepartmentValue() {
128        return _value;
129    }
130    
131    public void setPartyDepartmentValue(@Nonnull PartyDepartmentValue value)
132            throws PersistenceReadOnlyException {
133        checkReadWrite();
134        _value = value;
135    }
136    
137    @Override
138    @Nonnull
139    public PartyDepartmentPK getPrimaryKey() {
140        return _pk;
141    }
142    
143    @Nonnull
144    public PartyPK getPartyPK() {
145        return _value.getPartyPK();
146    }
147    
148    @Nonnull
149    public Party getParty(EntityPermission entityPermission) {
150        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getPartyPK());
151    }
152    
153    @Nonnull
154    public Party getParty() {
155        return getParty(EntityPermission.READ_ONLY);
156    }
157    
158    @Nonnull
159    public Party getPartyForUpdate() {
160        return getParty(EntityPermission.READ_WRITE);
161    }
162    
163    public void setPartyPK(@Nonnull PartyPK partyPK)
164            throws PersistenceNotNullException, PersistenceReadOnlyException {
165        checkReadWrite();
166        _value.setPartyPK(partyPK);
167    }
168    
169    public void setParty(@Nonnull Party entity) {
170        setPartyPK(entity == null ? null : entity.getPrimaryKey());
171    }
172    
173    public boolean getPartyPKHasBeenModified() {
174        return _value.getPartyPKHasBeenModified();
175    }
176    
177    @Nonnull
178    public PartyPK getDivisionPartyPK() {
179        return _value.getDivisionPartyPK();
180    }
181    
182    @Nonnull
183    public Party getDivisionParty(EntityPermission entityPermission) {
184        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getDivisionPartyPK());
185    }
186    
187    @Nonnull
188    public Party getDivisionParty() {
189        return getDivisionParty(EntityPermission.READ_ONLY);
190    }
191    
192    @Nonnull
193    public Party getDivisionPartyForUpdate() {
194        return getDivisionParty(EntityPermission.READ_WRITE);
195    }
196    
197    public void setDivisionPartyPK(@Nonnull PartyPK divisionPartyPK)
198            throws PersistenceNotNullException, PersistenceReadOnlyException {
199        checkReadWrite();
200        _value.setDivisionPartyPK(divisionPartyPK);
201    }
202    
203    public void setDivisionParty(@Nonnull Party entity) {
204        setDivisionPartyPK(entity == null ? null : entity.getPrimaryKey());
205    }
206    
207    public boolean getDivisionPartyPKHasBeenModified() {
208        return _value.getDivisionPartyPKHasBeenModified();
209    }
210    
211    @Nonnull
212    public String getPartyDepartmentName() {
213        return _value.getPartyDepartmentName();
214    }
215    
216    public void setPartyDepartmentName(@Nonnull String partyDepartmentName)
217            throws PersistenceNotNullException, PersistenceReadOnlyException {
218        checkReadWrite();
219        _value.setPartyDepartmentName(partyDepartmentName);
220    }
221    
222    public boolean getPartyDepartmentNameHasBeenModified() {
223        return _value.getPartyDepartmentNameHasBeenModified();
224    }
225    
226    @Nonnull
227    public Boolean getIsDefault() {
228        return _value.getIsDefault();
229    }
230    
231    public void setIsDefault(@Nonnull Boolean isDefault)
232            throws PersistenceNotNullException, PersistenceReadOnlyException {
233        checkReadWrite();
234        _value.setIsDefault(isDefault);
235    }
236    
237    public boolean getIsDefaultHasBeenModified() {
238        return _value.getIsDefaultHasBeenModified();
239    }
240    
241    @Nonnull
242    public Integer getSortOrder() {
243        return _value.getSortOrder();
244    }
245    
246    public void setSortOrder(@Nonnull Integer sortOrder)
247            throws PersistenceNotNullException, PersistenceReadOnlyException {
248        checkReadWrite();
249        _value.setSortOrder(sortOrder);
250    }
251    
252    public boolean getSortOrderHasBeenModified() {
253        return _value.getSortOrderHasBeenModified();
254    }
255    
256    @Nonnull
257    public Long getFromTime() {
258        return _value.getFromTime();
259    }
260    
261    public void setFromTime(@Nonnull Long fromTime)
262            throws PersistenceNotNullException, PersistenceReadOnlyException {
263        checkReadWrite();
264        _value.setFromTime(fromTime);
265    }
266    
267    public boolean getFromTimeHasBeenModified() {
268        return _value.getFromTimeHasBeenModified();
269    }
270    
271    @Nonnull
272    public Long getThruTime() {
273        return _value.getThruTime();
274    }
275    
276    public void setThruTime(@Nonnull Long thruTime)
277            throws PersistenceNotNullException, PersistenceReadOnlyException {
278        checkReadWrite();
279        _value.setThruTime(thruTime);
280    }
281    
282    public boolean getThruTimeHasBeenModified() {
283        return _value.getThruTimeHasBeenModified();
284    }
285    
286}