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