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