001    /**
002     * Copyright 2004-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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    package org.kuali.hr.time.timesheet;
017    
018    import org.kuali.hr.time.calendar.Calendar;
019    import org.kuali.hr.time.calendar.CalendarEntries;
020    import org.kuali.hr.time.service.base.TkServiceLocator;
021    import org.kuali.hr.time.util.TkConstants;
022    import org.kuali.rice.kim.api.identity.Person;
023    import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
024    
025    public class TimeSheetInitiate extends PersistableBusinessObjectBase {
026    
027            /**
028             * 
029             */
030            private static final long serialVersionUID = 1L;
031            private String tkTimeSheetInitId;
032            private String principalId;
033            private String hrPyCalendarEntriesId;
034            private String pyCalendarGroup;
035            private String documentId;
036            
037            private String calendarTypes = TkConstants.CALENDAR_TYPE_PAY;
038            
039            private Person principal;
040            private Calendar payCalendarObj;
041            
042            private CalendarEntries payCalendarEntriesObj;
043            
044            public String getPrincipalId() {
045                    return principalId;
046            }
047    
048            public void setPrincipalId(String principalId) {
049                    this.principalId = principalId;
050            }
051            
052            public Person getPrincipal() {
053                    return principal;
054            }
055    
056            public void setPrincipal(Person principal) {
057                    this.principal = principal;
058            }
059    
060            
061            public String getTkTimeSheetInitId() {
062                    return tkTimeSheetInitId;
063            }
064    
065            public void setTkTimeSheetInitId(String tkTimeSheetInitId) {
066                    this.tkTimeSheetInitId = tkTimeSheetInitId;
067            }
068            
069        public String getHrPyCalendarEntriesId() {
070            return hrPyCalendarEntriesId;
071        }
072    
073        public void setHrPyCalendarEntriesId(String hrPyCalendarEntriesId) {
074            this.hrPyCalendarEntriesId = hrPyCalendarEntriesId;
075        }
076            
077            public CalendarEntries getPayCalendarEntriesObj() {
078                    if(hrPyCalendarEntriesId != null) {
079                            setPayCalendarEntriesObj(TkServiceLocator.getCalendarEntriesService().getCalendarEntries(hrPyCalendarEntriesId));
080                    }
081                    return payCalendarEntriesObj;
082            }
083    
084            public void setPayCalendarEntriesObj(CalendarEntries payCalendarEntriesObj) {
085                    this.payCalendarEntriesObj = payCalendarEntriesObj;
086            }
087    
088        public String getPyCalendarGroup() {
089            return pyCalendarGroup;
090        }
091    
092        public void setPyCalendarGroup(String pyCalendarGroup) {
093            this.pyCalendarGroup = pyCalendarGroup;
094        }
095    
096            public String getDocumentId() {
097                    return documentId;
098            }
099    
100            public void setDocumentId(String documentId) {
101                    this.documentId = documentId;
102            }
103    
104            public Calendar getPayCalendarObj() {
105                    return payCalendarObj;
106            }
107    
108            public void setPayCalendarObj(Calendar payCalendarObj) {
109                    this.payCalendarObj = payCalendarObj;
110            }
111    
112            public String getBeginAndEndDateTime() {
113                    if (payCalendarEntriesObj == null && this.getHrPyCalendarEntriesId() != null) {
114                            payCalendarEntriesObj = TkServiceLocator.getCalendarEntriesService().getCalendarEntries(this.getHrPyCalendarEntriesId());
115                }
116                return (payCalendarEntriesObj != null) ? 
117                            payCalendarEntriesObj.getBeginPeriodDateTime().toString() + " - "+ payCalendarEntriesObj.getEndPeriodDateTime().toString() : "";
118            }
119    
120            public String getCalendarTypes() {
121                    return calendarTypes;
122            }
123    
124            public void setCalendarTypes(String calendarTypes) {
125                    this.calendarTypes = calendarTypes;
126            }
127            
128    }