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 * LeaveDetail.java
021 */
022
023package com.echothree.model.data.employee.server.entity;
024
025import com.echothree.model.data.employee.common.pk.LeaveDetailPK;
026
027import com.echothree.model.data.employee.common.pk.LeavePK;
028import com.echothree.model.data.party.common.pk.PartyPK;
029import com.echothree.model.data.employee.common.pk.LeaveTypePK;
030import com.echothree.model.data.employee.common.pk.LeaveReasonPK;
031
032import com.echothree.model.data.employee.server.entity.Leave;
033import com.echothree.model.data.party.server.entity.Party;
034import com.echothree.model.data.employee.server.entity.LeaveType;
035import com.echothree.model.data.employee.server.entity.LeaveReason;
036
037import com.echothree.model.data.employee.server.factory.LeaveFactory;
038import com.echothree.model.data.party.server.factory.PartyFactory;
039import com.echothree.model.data.employee.server.factory.LeaveTypeFactory;
040import com.echothree.model.data.employee.server.factory.LeaveReasonFactory;
041
042import com.echothree.model.data.employee.common.pk.LeaveDetailPK;
043
044import com.echothree.model.data.employee.server.value.LeaveDetailValue;
045
046import com.echothree.model.data.employee.server.factory.LeaveDetailFactory;
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
064import javax.annotation.Nonnull;
065import javax.annotation.Nullable;
066
067public class LeaveDetail
068        extends BaseEntity
069        implements Serializable {
070    
071    private LeaveDetailPK _pk;
072    private LeaveDetailValue _value;
073    
074    /** Creates a new instance of LeaveDetail */
075    public LeaveDetail()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of LeaveDetail */
081    public LeaveDetail(LeaveDetailValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    @Nonnull
090    public LeaveDetailFactory getBaseFactoryInstance() {
091        return LeaveDetailFactory.getInstance();
092    }
093    
094    @Override
095    public boolean hasBeenModified() {
096        return _value.hasBeenModified();
097    }
098    
099    @Override
100    public int hashCode() {
101        return _pk.hashCode();
102    }
103    
104    @Override
105    @Nonnull
106    public String toString() {
107        return _pk.toString();
108    }
109    
110    @Override
111    public boolean equals(Object other) {
112        if(this == other)
113            return true;
114        
115        if(other instanceof LeaveDetail that) {
116            LeaveDetailValue thatValue = that.getLeaveDetailValue();
117            return _value.equals(thatValue);
118        } else {
119            return false;
120        }
121    }
122    
123    @Override
124    public void store()
125            throws PersistenceDatabaseException {
126        getBaseFactoryInstance().store(this);
127    }
128    
129    @Override
130    public void remove()
131            throws PersistenceDatabaseException {
132        getBaseFactoryInstance().remove(this);
133    }
134    
135    @Nonnull
136    public LeaveDetailValue getLeaveDetailValue() {
137        return _value;
138    }
139    
140    public void setLeaveDetailValue(@Nonnull LeaveDetailValue value)
141            throws PersistenceReadOnlyException {
142        checkReadWrite();
143        _value = value;
144    }
145    
146    @Override
147    @Nonnull
148    public LeaveDetailPK getPrimaryKey() {
149        return _pk;
150    }
151    
152    @Nonnull
153    public LeavePK getLeavePK() {
154        return _value.getLeavePK();
155    }
156    
157    @Nonnull
158    public Leave getLeave(EntityPermission entityPermission) {
159        return LeaveFactory.getInstance().getEntityFromPK(entityPermission, getLeavePK());
160    }
161    
162    @Nonnull
163    public Leave getLeave() {
164        return getLeave(EntityPermission.READ_ONLY);
165    }
166    
167    @Nonnull
168    public Leave getLeaveForUpdate() {
169        return getLeave(EntityPermission.READ_WRITE);
170    }
171    
172    public void setLeavePK(@Nonnull LeavePK leavePK)
173            throws PersistenceNotNullException, PersistenceReadOnlyException {
174        checkReadWrite();
175        _value.setLeavePK(leavePK);
176    }
177    
178    public void setLeave(@Nonnull Leave entity) {
179        setLeavePK(entity == null ? null : entity.getPrimaryKey());
180    }
181    
182    public boolean getLeavePKHasBeenModified() {
183        return _value.getLeavePKHasBeenModified();
184    }
185    
186    @Nonnull
187    public String getLeaveName() {
188        return _value.getLeaveName();
189    }
190    
191    public void setLeaveName(@Nonnull String leaveName)
192            throws PersistenceNotNullException, PersistenceReadOnlyException {
193        checkReadWrite();
194        _value.setLeaveName(leaveName);
195    }
196    
197    public boolean getLeaveNameHasBeenModified() {
198        return _value.getLeaveNameHasBeenModified();
199    }
200    
201    @Nonnull
202    public PartyPK getPartyPK() {
203        return _value.getPartyPK();
204    }
205    
206    @Nonnull
207    public Party getParty(EntityPermission entityPermission) {
208        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getPartyPK());
209    }
210    
211    @Nonnull
212    public Party getParty() {
213        return getParty(EntityPermission.READ_ONLY);
214    }
215    
216    @Nonnull
217    public Party getPartyForUpdate() {
218        return getParty(EntityPermission.READ_WRITE);
219    }
220    
221    public void setPartyPK(@Nonnull PartyPK partyPK)
222            throws PersistenceNotNullException, PersistenceReadOnlyException {
223        checkReadWrite();
224        _value.setPartyPK(partyPK);
225    }
226    
227    public void setParty(@Nonnull Party entity) {
228        setPartyPK(entity == null ? null : entity.getPrimaryKey());
229    }
230    
231    public boolean getPartyPKHasBeenModified() {
232        return _value.getPartyPKHasBeenModified();
233    }
234    
235    @Nonnull
236    public PartyPK getCompanyPartyPK() {
237        return _value.getCompanyPartyPK();
238    }
239    
240    @Nonnull
241    public Party getCompanyParty(EntityPermission entityPermission) {
242        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getCompanyPartyPK());
243    }
244    
245    @Nonnull
246    public Party getCompanyParty() {
247        return getCompanyParty(EntityPermission.READ_ONLY);
248    }
249    
250    @Nonnull
251    public Party getCompanyPartyForUpdate() {
252        return getCompanyParty(EntityPermission.READ_WRITE);
253    }
254    
255    public void setCompanyPartyPK(@Nonnull PartyPK companyPartyPK)
256            throws PersistenceNotNullException, PersistenceReadOnlyException {
257        checkReadWrite();
258        _value.setCompanyPartyPK(companyPartyPK);
259    }
260    
261    public void setCompanyParty(@Nonnull Party entity) {
262        setCompanyPartyPK(entity == null ? null : entity.getPrimaryKey());
263    }
264    
265    public boolean getCompanyPartyPKHasBeenModified() {
266        return _value.getCompanyPartyPKHasBeenModified();
267    }
268    
269    @Nonnull
270    public LeaveTypePK getLeaveTypePK() {
271        return _value.getLeaveTypePK();
272    }
273    
274    @Nonnull
275    public LeaveType getLeaveType(EntityPermission entityPermission) {
276        return LeaveTypeFactory.getInstance().getEntityFromPK(entityPermission, getLeaveTypePK());
277    }
278    
279    @Nonnull
280    public LeaveType getLeaveType() {
281        return getLeaveType(EntityPermission.READ_ONLY);
282    }
283    
284    @Nonnull
285    public LeaveType getLeaveTypeForUpdate() {
286        return getLeaveType(EntityPermission.READ_WRITE);
287    }
288    
289    public void setLeaveTypePK(@Nonnull LeaveTypePK leaveTypePK)
290            throws PersistenceNotNullException, PersistenceReadOnlyException {
291        checkReadWrite();
292        _value.setLeaveTypePK(leaveTypePK);
293    }
294    
295    public void setLeaveType(@Nonnull LeaveType entity) {
296        setLeaveTypePK(entity == null ? null : entity.getPrimaryKey());
297    }
298    
299    public boolean getLeaveTypePKHasBeenModified() {
300        return _value.getLeaveTypePKHasBeenModified();
301    }
302    
303    @Nonnull
304    public LeaveReasonPK getLeaveReasonPK() {
305        return _value.getLeaveReasonPK();
306    }
307    
308    @Nonnull
309    public LeaveReason getLeaveReason(EntityPermission entityPermission) {
310        return LeaveReasonFactory.getInstance().getEntityFromPK(entityPermission, getLeaveReasonPK());
311    }
312    
313    @Nonnull
314    public LeaveReason getLeaveReason() {
315        return getLeaveReason(EntityPermission.READ_ONLY);
316    }
317    
318    @Nonnull
319    public LeaveReason getLeaveReasonForUpdate() {
320        return getLeaveReason(EntityPermission.READ_WRITE);
321    }
322    
323    public void setLeaveReasonPK(@Nonnull LeaveReasonPK leaveReasonPK)
324            throws PersistenceNotNullException, PersistenceReadOnlyException {
325        checkReadWrite();
326        _value.setLeaveReasonPK(leaveReasonPK);
327    }
328    
329    public void setLeaveReason(@Nonnull LeaveReason entity) {
330        setLeaveReasonPK(entity == null ? null : entity.getPrimaryKey());
331    }
332    
333    public boolean getLeaveReasonPKHasBeenModified() {
334        return _value.getLeaveReasonPKHasBeenModified();
335    }
336    
337    @Nonnull
338    public Long getStartTime() {
339        return _value.getStartTime();
340    }
341    
342    public void setStartTime(@Nonnull Long startTime)
343            throws PersistenceNotNullException, PersistenceReadOnlyException {
344        checkReadWrite();
345        _value.setStartTime(startTime);
346    }
347    
348    public boolean getStartTimeHasBeenModified() {
349        return _value.getStartTimeHasBeenModified();
350    }
351    
352    @Nullable
353    public Long getEndTime() {
354        return _value.getEndTime();
355    }
356    
357    public void setEndTime(@Nullable Long endTime)
358            throws PersistenceNotNullException, PersistenceReadOnlyException {
359        checkReadWrite();
360        _value.setEndTime(endTime);
361    }
362    
363    public boolean getEndTimeHasBeenModified() {
364        return _value.getEndTimeHasBeenModified();
365    }
366    
367    @Nullable
368    public Long getTotalTime() {
369        return _value.getTotalTime();
370    }
371    
372    public void setTotalTime(@Nullable Long totalTime)
373            throws PersistenceNotNullException, PersistenceReadOnlyException {
374        checkReadWrite();
375        _value.setTotalTime(totalTime);
376    }
377    
378    public boolean getTotalTimeHasBeenModified() {
379        return _value.getTotalTimeHasBeenModified();
380    }
381    
382    @Nonnull
383    public Long getFromTime() {
384        return _value.getFromTime();
385    }
386    
387    public void setFromTime(@Nonnull Long fromTime)
388            throws PersistenceNotNullException, PersistenceReadOnlyException {
389        checkReadWrite();
390        _value.setFromTime(fromTime);
391    }
392    
393    public boolean getFromTimeHasBeenModified() {
394        return _value.getFromTimeHasBeenModified();
395    }
396    
397    @Nonnull
398    public Long getThruTime() {
399        return _value.getThruTime();
400    }
401    
402    public void setThruTime(@Nonnull Long thruTime)
403            throws PersistenceNotNullException, PersistenceReadOnlyException {
404        checkReadWrite();
405        _value.setThruTime(thruTime);
406    }
407    
408    public boolean getThruTimeHasBeenModified() {
409        return _value.getThruTimeHasBeenModified();
410    }
411    
412}