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