View Javadoc

1   /**
2    * Copyright 2004-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.hr.time.timesheet;
17  
18  import org.kuali.hr.time.calendar.Calendar;
19  import org.kuali.hr.time.calendar.CalendarEntries;
20  import org.kuali.hr.time.service.base.TkServiceLocator;
21  import org.kuali.rice.kim.api.identity.Person;
22  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
23  
24  public class TimeSheetInitiate extends PersistableBusinessObjectBase {
25  
26  	/**
27  	 * 
28  	 */
29  	private static final long serialVersionUID = 1L;
30  	private String tkTimeSheetInitId;
31  	private String principalId;
32  	private String hrPyCalendarEntriesId;
33  	private String pyCalendarGroup;
34  	private String documentId;
35  	
36  	private Person principal;
37  	private Calendar payCalendarObj;
38  	
39  	private CalendarEntries payCalendarEntriesObj;
40  	
41  	public String getPrincipalId() {
42  		return principalId;
43  	}
44  
45  	public void setPrincipalId(String principalId) {
46  		this.principalId = principalId;
47  	}
48  	
49  	public Person getPrincipal() {
50  		return principal;
51  	}
52  
53  	public void setPrincipal(Person principal) {
54  		this.principal = principal;
55  	}
56  
57  	
58  	public String getTkTimeSheetInitId() {
59  		return tkTimeSheetInitId;
60  	}
61  
62  	public void setTkTimeSheetInitId(String tkTimeSheetInitId) {
63  		this.tkTimeSheetInitId = tkTimeSheetInitId;
64  	}
65  	
66      public String getHrPyCalendarEntriesId() {
67          return hrPyCalendarEntriesId;
68      }
69  
70      public void setHrPyCalendarEntriesId(String hrPyCalendarEntriesId) {
71          this.hrPyCalendarEntriesId = hrPyCalendarEntriesId;
72      }
73  	
74  	public CalendarEntries getPayCalendarEntriesObj() {
75  		if(hrPyCalendarEntriesId != null) {
76  			setPayCalendarEntriesObj(TkServiceLocator.getCalendarEntriesService().getCalendarEntries(hrPyCalendarEntriesId));
77  		}
78  		return payCalendarEntriesObj;
79  	}
80  
81  	public void setPayCalendarEntriesObj(CalendarEntries payCalendarEntriesObj) {
82  		this.payCalendarEntriesObj = payCalendarEntriesObj;
83  	}
84  
85      public String getPyCalendarGroup() {
86          return pyCalendarGroup;
87      }
88  
89      public void setPyCalendarGroup(String pyCalendarGroup) {
90          this.pyCalendarGroup = pyCalendarGroup;
91      }
92  
93  	public String getDocumentId() {
94  		return documentId;
95  	}
96  
97  	public void setDocumentId(String documentId) {
98  		this.documentId = documentId;
99  	}
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 }