View Javadoc

1   /**
2    * Copyright 2004-2013 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.principal;
17  
18  import java.sql.Date;
19  
20  import org.kuali.hr.core.KPMEConstants;
21  import org.kuali.hr.lm.leaveplan.LeavePlan;
22  import org.kuali.hr.time.HrBusinessObject;
23  import org.kuali.hr.time.calendar.Calendar;
24  import org.kuali.rice.kim.api.identity.Person;
25  import org.kuali.rice.kim.api.services.KimApiServiceLocator;
26  
27  public class PrincipalHRAttributes extends HrBusinessObject {
28  
29  	private static final long serialVersionUID = 6843318899816055301L;
30  
31  	public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "PrincipalHRAttributes";
32  
33  	private String hrPrincipalAttributeId;
34  	private String principalId;
35  	private String leaveCalendar;
36  	private String payCalendar;
37  	private String leavePlan;
38  	private Date serviceDate;
39  	private boolean fmlaEligible;
40  	private boolean workersCompEligible;
41  	private String timezone;
42  	private Boolean history;
43  	// KPME-1268 Kagata added recordTime and recordLeave variables
44  	// KPME-1676 
45  //	private String recordTime;
46  //	private String recordLeave;
47  	
48  	private Calendar calendar;
49  	private Calendar leaveCalObj;
50  	private Person person;
51  	private LeavePlan leavePlanObj;
52  
53  
54  	public String getPrincipalId() {
55  		return principalId;
56  	}
57  
58  	public void setPrincipalId(String principalId) {
59  		this.principalId = principalId;
60  		person = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
61  	}
62  
63  	public String getName() {
64  		 if (person == null) {
65  	            person = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
66  	    }
67  	    return (person != null) ? person.getName() : "";
68  	}
69  
70  	public String getPayCalendar() {
71  		return payCalendar;
72  	}
73  
74  	public void setPayCalendar(String payCalendar) {
75  		this.payCalendar = payCalendar;
76  	}
77  
78  	public String getLeavePlan() {
79  		return leavePlan;
80  	}
81  
82  	public void setLeavePlan(String leavePlan) {
83  		this.leavePlan = leavePlan;
84  	}
85  
86  	public Date getServiceDate() {
87  		return serviceDate;
88  	}
89  
90  	public void setServiceDate(Date serviceDate) {
91  		this.serviceDate = serviceDate;
92  	}
93  
94  	public boolean isFmlaEligible() {
95  		return fmlaEligible;
96  	}
97  
98  	public void setFmlaEligible(boolean fmlaEligible) {
99  		this.fmlaEligible = fmlaEligible;
100 	}
101 
102 	public boolean isWorkersCompEligible() {
103 		return workersCompEligible;
104 	}
105 
106 	public void setWorkersCompEligible(boolean workersCompEligible) {
107 		this.workersCompEligible = workersCompEligible;
108 	}
109 
110 	public String getTimezone() {
111 		return timezone;
112 	}
113 
114 	public void setTimezone(String timezone) {
115 		this.timezone = timezone;
116 	}
117 
118 	public Calendar getCalendar() {
119 		return calendar;
120 	}
121 
122 	public void setCalendar(Calendar calendar) {
123 		this.calendar = calendar;
124 	}
125 
126 	public Person getPerson() {
127 		return person;
128 	}
129 
130 	public void setPerson(Person person) {
131 		this.person = person;
132 	}
133 
134 	public LeavePlan getLeavePlanObj() {
135 		return leavePlanObj;
136 	}
137 
138 	public void setLeavePlanObj(LeavePlan leavePlanObj) {
139 		this.leavePlanObj = leavePlanObj;
140 	}
141 
142 	@Override
143 	protected String getUniqueKey() {
144 		return principalId + "_" + payCalendar == null ? "" : payCalendar + "_"
145 				+ leaveCalendar == null ? "" : leaveCalendar;
146 	}
147 
148 	public String getLeaveCalendar() {
149 		return leaveCalendar;
150 	}
151 
152 	public void setLeaveCalendar(String leaveCalendar) {
153 		this.leaveCalendar = leaveCalendar;
154 	}
155 
156 	@Override
157 	public String getId() {
158 		return this.getHrPrincipalAttributeId();
159 	}
160 	@Override
161 	public void setId(String id) {
162 		setHrPrincipalAttributeId(id);
163 	}
164 
165 	public Calendar getLeaveCalObj() {
166 		return leaveCalObj;
167 	}
168 
169 	public void setLeaveCalObj(Calendar leaveCalObj) {
170 		this.leaveCalObj = leaveCalObj;
171 	}
172 
173 	public String getHrPrincipalAttributeId() {
174 		return hrPrincipalAttributeId;
175 	}
176 
177 	public void setHrPrincipalAttributeId(String hrPrincipalAttributeId) {
178 		this.hrPrincipalAttributeId = hrPrincipalAttributeId;
179 	}
180 
181 	public Boolean getHistory() {
182 		return history;
183 	}
184 
185 	public void setHistory(Boolean history) {
186 		this.history = history;
187 	}
188 }