1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.roles;
17
18 import java.sql.Date;
19 import java.sql.Timestamp;
20
21 import org.kuali.hr.core.KPMEConstants;
22 import org.kuali.hr.location.Location;
23 import org.kuali.hr.time.HrBusinessObject;
24 import org.kuali.hr.time.department.Department;
25 import org.kuali.hr.time.position.Position;
26 import org.kuali.hr.time.service.base.TkServiceLocator;
27 import org.kuali.hr.time.util.TKUtils;
28 import org.kuali.hr.time.workarea.WorkArea;
29 import org.kuali.kfs.coa.businessobject.Chart;
30 import org.kuali.rice.kim.api.identity.Person;
31 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
32
33 public class TkRole extends HrBusinessObject {
34 public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "TkRole";
35
36
37
38 private static final long serialVersionUID = 1L;
39 private String hrRolesId;
40 private String principalId;
41 private String roleName;
42 private String userPrincipalId;
43 private Long workArea;
44 private String department;
45 private String chart;
46 private Long hrDeptId;
47 private String tkWorkAreaId;
48 private String positionNumber;
49 private Date expirationDate;
50
51
52
53
54
55 private Person person;
56 private Department departmentObj;
57 private WorkArea workAreaObj;
58 private Chart chartObj;
59 private Position positionObj;
60
61 private Location locationObj;
62
63 public Chart getChartObj() {
64 return chartObj;
65 }
66
67 public void setChartObj(Chart chartObj) {
68 this.chartObj = chartObj;
69 }
70
71 public Department getDepartmentObj() {
72 return departmentObj;
73 }
74
75 public void setDepartmentObj(Department departmentObj) {
76 this.departmentObj = departmentObj;
77 if (departmentObj != null) {
78 this.department = departmentObj.getDept();
79 this.workAreaObj= null;
80 this.workArea = null;
81 }
82 }
83
84 public WorkArea getWorkAreaObj() {
85 return workAreaObj;
86 }
87
88 public void setWorkAreaObj(WorkArea workAreaObj) {
89 this.workAreaObj = workAreaObj;
90 if (workAreaObj != null) {
91 this.workArea = workAreaObj.getWorkArea();
92 this.departmentObj = TkServiceLocator.getDepartmentService().getDepartment(workAreaObj.getDept(), TKUtils.getCurrentDate());
93 this.department = workAreaObj.getDept();
94 }
95 }
96
97 public String getHrRolesId() {
98 return hrRolesId;
99 }
100 public void setHrRolesId(String hrRolesId) {
101 this.hrRolesId = hrRolesId;
102 }
103 public String getPrincipalId() {
104 return principalId;
105 }
106 public void setPrincipalId(String principalId) {
107 this.principalId = principalId;
108 setPerson(KimApiServiceLocator.getPersonService().getPerson(this.principalId));
109 }
110 public String getRoleName() {
111 return roleName;
112 }
113 public void setRoleName(String roleName) {
114 this.roleName = roleName;
115 }
116 public String getUserPrincipalId() {
117 return userPrincipalId;
118 }
119 public void setUserPrincipalId(String userPrincipalId) {
120 this.userPrincipalId = userPrincipalId;
121 }
122 public Long getWorkArea() {
123 return workArea;
124 }
125 public void setWorkArea(Long workArea) {
126 this.workArea = workArea;
127 }
128 public String getDepartment() {
129 return department;
130 }
131 public void setDepartment(String department) {
132 this.department = department;
133 }
134
135 public Date getEffectiveDate() {
136 return effectiveDate;
137 }
138 public void setEffectiveDate(Date effectiveDate) {
139 this.effectiveDate = effectiveDate;
140 }
141 public Timestamp getTimestamp() {
142 return timestamp;
143 }
144 public void setTimestamp(Timestamp timestamp) {
145 this.timestamp = timestamp;
146 }
147 public boolean isActive() {
148 return active;
149 }
150 public void setActive(boolean active) {
151 this.active = active;
152 }
153 public Person getPerson() {
154 return person;
155 }
156 public void setPerson(Person person) {
157 this.person = person;
158 }
159 public Long getHrDeptId() {
160 return hrDeptId;
161 }
162 public void setHrDeptId(Long hrDeptId) {
163 this.hrDeptId = hrDeptId;
164 }
165 public String getTkWorkAreaId() {
166 return tkWorkAreaId;
167 }
168 public void setTkWorkAreaId(String tkWorkAreaId) {
169 this.tkWorkAreaId = tkWorkAreaId;
170 }
171
172 public String getChart() {
173 return chart;
174 }
175
176 public void setChart(String chart) {
177 this.chart = chart;
178 }
179
180
181
182
183 public String getUserName() {
184 if (person == null) {
185 person = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
186 }
187
188 return (person != null) ? person.getName() : "";
189 }
190
191 public void setPositionNumber(String positionNumber) {
192 this.positionNumber = positionNumber;
193 }
194
195 public String getPositionNumber() {
196 return positionNumber;
197 }
198
199 public Date getExpirationDate() {
200 return expirationDate;
201 }
202
203 public void setExpirationDate(Date expirationDate) {
204 this.expirationDate = expirationDate;
205 }
206
207 public void setPositionObj(Position positionObj) {
208 this.positionObj = positionObj;
209 }
210
211 public Position getPositionObj() {
212 return positionObj;
213 }
214
215 @Override
216 public String getUniqueKey() {
217 return principalId + "_" + positionNumber != null ? positionNumber.toString() : "" +"_"+
218 roleName + "_" + workArea != null ? workArea.toString() : "" + "_" +
219 department + "_" + chart;
220 }
221
222 @Override
223 public String getId() {
224 return getHrRolesId();
225 }
226
227 @Override
228 public void setId(String id) {
229 setHrRolesId(id);
230 }
231
232 public Location getLocationObj() {
233 return locationObj;
234 }
235
236 public void setLocationObj(Location locationObj) {
237 this.locationObj = locationObj;
238 }
239 }