001// --------------------------------------------------------------------------------
002// Copyright 2002-2025 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 * WorkRequirementStatus.java
021 */
022
023package com.echothree.model.data.workrequirement.server.entity;
024
025import com.echothree.model.data.workrequirement.common.pk.WorkRequirementStatusPK;
026
027import com.echothree.model.data.workrequirement.common.pk.WorkRequirementPK;
028import com.echothree.model.data.workrequirement.common.pk.WorkAssignmentPK;
029import com.echothree.model.data.workrequirement.common.pk.WorkTimePK;
030
031import com.echothree.model.data.workrequirement.server.entity.WorkRequirement;
032import com.echothree.model.data.workrequirement.server.entity.WorkAssignment;
033import com.echothree.model.data.workrequirement.server.entity.WorkTime;
034
035import com.echothree.model.data.workrequirement.server.factory.WorkRequirementFactory;
036import com.echothree.model.data.workrequirement.server.factory.WorkAssignmentFactory;
037import com.echothree.model.data.workrequirement.server.factory.WorkTimeFactory;
038
039import com.echothree.model.data.workrequirement.common.pk.WorkRequirementStatusPK;
040
041import com.echothree.model.data.workrequirement.server.value.WorkRequirementStatusValue;
042
043import com.echothree.model.data.workrequirement.server.factory.WorkRequirementStatusFactory;
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 WorkRequirementStatus
062        extends BaseEntity
063        implements Serializable {
064    
065    private WorkRequirementStatusPK _pk;
066    private WorkRequirementStatusValue _value;
067    
068    /** Creates a new instance of WorkRequirementStatus */
069    public WorkRequirementStatus()
070            throws PersistenceException {
071        super();
072    }
073    
074    /** Creates a new instance of WorkRequirementStatus */
075    public WorkRequirementStatus(WorkRequirementStatusValue value, EntityPermission entityPermission) {
076        super(entityPermission);
077        
078        _value = value;
079        _pk = value.getPrimaryKey();
080    }
081    
082    @Override
083    public WorkRequirementStatusFactory getBaseFactoryInstance() {
084        return WorkRequirementStatusFactory.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 WorkRequirementStatus that) {
108            WorkRequirementStatusValue thatValue = that.getWorkRequirementStatusValue();
109            return _value.equals(thatValue);
110        } else {
111            return false;
112        }
113    }
114    
115    @Override
116    public void store(Session session)
117            throws PersistenceDatabaseException {
118        getBaseFactoryInstance().store(session, this);
119    }
120    
121    @Override
122    public void remove(Session session)
123            throws PersistenceDatabaseException {
124        getBaseFactoryInstance().remove(session, this);
125    }
126    
127    @Override
128    public void remove()
129            throws PersistenceDatabaseException {
130        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
131    }
132    
133    public WorkRequirementStatusValue getWorkRequirementStatusValue() {
134        return _value;
135    }
136    
137    public void setWorkRequirementStatusValue(WorkRequirementStatusValue value)
138            throws PersistenceReadOnlyException {
139        checkReadWrite();
140        _value = value;
141    }
142    
143    @Override
144    public WorkRequirementStatusPK getPrimaryKey() {
145        return _pk;
146    }
147    
148    public WorkRequirementPK getWorkRequirementPK() {
149        return _value.getWorkRequirementPK();
150    }
151    
152    public WorkRequirement getWorkRequirement(Session session, EntityPermission entityPermission) {
153        return WorkRequirementFactory.getInstance().getEntityFromPK(session, entityPermission, getWorkRequirementPK());
154    }
155    
156    public WorkRequirement getWorkRequirement(EntityPermission entityPermission) {
157        return getWorkRequirement(ThreadSession.currentSession(), entityPermission);
158    }
159    
160    public WorkRequirement getWorkRequirement(Session session) {
161        return getWorkRequirement(session, EntityPermission.READ_ONLY);
162    }
163    
164    public WorkRequirement getWorkRequirement() {
165        return getWorkRequirement(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
166    }
167    
168    public WorkRequirement getWorkRequirementForUpdate(Session session) {
169        return getWorkRequirement(session, EntityPermission.READ_WRITE);
170    }
171    
172    public WorkRequirement getWorkRequirementForUpdate() {
173        return getWorkRequirement(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
174    }
175    
176    public void setWorkRequirementPK(WorkRequirementPK workRequirementPK)
177            throws PersistenceNotNullException, PersistenceReadOnlyException {
178        checkReadWrite();
179        _value.setWorkRequirementPK(workRequirementPK);
180    }
181    
182    public void setWorkRequirement(WorkRequirement entity) {
183        setWorkRequirementPK(entity == null? null: entity.getPrimaryKey());
184    }
185    
186    public boolean getWorkRequirementPKHasBeenModified() {
187        return _value.getWorkRequirementPKHasBeenModified();
188    }
189    
190    public Integer getWorkAssignmentSequence() {
191        return _value.getWorkAssignmentSequence();
192    }
193    
194    public void setWorkAssignmentSequence(Integer workAssignmentSequence)
195            throws PersistenceNotNullException, PersistenceReadOnlyException {
196        checkReadWrite();
197        _value.setWorkAssignmentSequence(workAssignmentSequence);
198    }
199    
200    public boolean getWorkAssignmentSequenceHasBeenModified() {
201        return _value.getWorkAssignmentSequenceHasBeenModified();
202    }
203    
204    public WorkAssignmentPK getLastWorkAssignmentPK() {
205        return _value.getLastWorkAssignmentPK();
206    }
207    
208    public WorkAssignment getLastWorkAssignment(Session session, EntityPermission entityPermission) {
209        WorkAssignmentPK pk = getLastWorkAssignmentPK();
210        WorkAssignment entity = pk == null? null: WorkAssignmentFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
211        
212        return entity;
213    }
214    
215    public WorkAssignment getLastWorkAssignment(EntityPermission entityPermission) {
216        return getLastWorkAssignment(ThreadSession.currentSession(), entityPermission);
217    }
218    
219    public WorkAssignment getLastWorkAssignment(Session session) {
220        return getLastWorkAssignment(session, EntityPermission.READ_ONLY);
221    }
222    
223    public WorkAssignment getLastWorkAssignment() {
224        return getLastWorkAssignment(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
225    }
226    
227    public WorkAssignment getLastWorkAssignmentForUpdate(Session session) {
228        return getLastWorkAssignment(session, EntityPermission.READ_WRITE);
229    }
230    
231    public WorkAssignment getLastWorkAssignmentForUpdate() {
232        return getLastWorkAssignment(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
233    }
234    
235    public void setLastWorkAssignmentPK(WorkAssignmentPK lastWorkAssignmentPK)
236            throws PersistenceNotNullException, PersistenceReadOnlyException {
237        checkReadWrite();
238        _value.setLastWorkAssignmentPK(lastWorkAssignmentPK);
239    }
240    
241    public void setLastWorkAssignment(WorkAssignment entity) {
242        setLastWorkAssignmentPK(entity == null? null: entity.getPrimaryKey());
243    }
244    
245    public boolean getLastWorkAssignmentPKHasBeenModified() {
246        return _value.getLastWorkAssignmentPKHasBeenModified();
247    }
248    
249    public Integer getWorkTimeSequence() {
250        return _value.getWorkTimeSequence();
251    }
252    
253    public void setWorkTimeSequence(Integer workTimeSequence)
254            throws PersistenceNotNullException, PersistenceReadOnlyException {
255        checkReadWrite();
256        _value.setWorkTimeSequence(workTimeSequence);
257    }
258    
259    public boolean getWorkTimeSequenceHasBeenModified() {
260        return _value.getWorkTimeSequenceHasBeenModified();
261    }
262    
263    public WorkTimePK getLastWorkTimePK() {
264        return _value.getLastWorkTimePK();
265    }
266    
267    public WorkTime getLastWorkTime(Session session, EntityPermission entityPermission) {
268        WorkTimePK pk = getLastWorkTimePK();
269        WorkTime entity = pk == null? null: WorkTimeFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
270        
271        return entity;
272    }
273    
274    public WorkTime getLastWorkTime(EntityPermission entityPermission) {
275        return getLastWorkTime(ThreadSession.currentSession(), entityPermission);
276    }
277    
278    public WorkTime getLastWorkTime(Session session) {
279        return getLastWorkTime(session, EntityPermission.READ_ONLY);
280    }
281    
282    public WorkTime getLastWorkTime() {
283        return getLastWorkTime(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
284    }
285    
286    public WorkTime getLastWorkTimeForUpdate(Session session) {
287        return getLastWorkTime(session, EntityPermission.READ_WRITE);
288    }
289    
290    public WorkTime getLastWorkTimeForUpdate() {
291        return getLastWorkTime(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
292    }
293    
294    public void setLastWorkTimePK(WorkTimePK lastWorkTimePK)
295            throws PersistenceNotNullException, PersistenceReadOnlyException {
296        checkReadWrite();
297        _value.setLastWorkTimePK(lastWorkTimePK);
298    }
299    
300    public void setLastWorkTime(WorkTime entity) {
301        setLastWorkTimePK(entity == null? null: entity.getPrimaryKey());
302    }
303    
304    public boolean getLastWorkTimePKHasBeenModified() {
305        return _value.getLastWorkTimePKHasBeenModified();
306    }
307    
308}