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