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 positionNumber;
48 private Date expirationDate;
49
50
51
52
53
54 private Person person;
55 private Department departmentObj;
56 private WorkArea workAreaObj;
57 private Chart chartObj;
58 private Position positionObj;
59
60 private Location locationObj;
61
62 public Chart getChartObj() {
63 return chartObj;
64 }
65
66 public void setChartObj(Chart chartObj) {
67 this.chartObj = chartObj;
68 }
69
70 public Department getDepartmentObj() {
71 return departmentObj;
72 }
73
74 public void setDepartmentObj(Department departmentObj) {
75 this.departmentObj = departmentObj;
76 if (departmentObj != null) {
77 this.department = departmentObj.getDept();
78 this.workAreaObj= null;
79 this.workArea = null;
80 }
81 }
82
83 public WorkArea getWorkAreaObj() {
84 return workAreaObj;
85 }
86
87 public void setWorkAreaObj(WorkArea workAreaObj) {
88 this.workAreaObj = workAreaObj;
89 if (workAreaObj != null) {
90 this.workArea = workAreaObj.getWorkArea();
91 this.departmentObj = TkServiceLocator.getDepartmentService().getDepartment(workAreaObj.getDept(), TKUtils.getCurrentDate());
92 this.department = workAreaObj.getDept();
93 }
94 }
95
96 public String getHrRolesId() {
97 return hrRolesId;
98 }
99 public void setHrRolesId(String hrRolesId) {
100 this.hrRolesId = hrRolesId;
101 }
102 public String getPrincipalId() {
103 return principalId;
104 }
105 public void setPrincipalId(String principalId) {
106 this.principalId = principalId;
107 setPerson(KimApiServiceLocator.getPersonService().getPerson(this.principalId));
108 }
109 public String getRoleName() {
110 return roleName;
111 }
112 public void setRoleName(String roleName) {
113 this.roleName = roleName;
114 }
115 public String getUserPrincipalId() {
116 return userPrincipalId;
117 }
118 public void setUserPrincipalId(String userPrincipalId) {
119 this.userPrincipalId = userPrincipalId;
120 }
121 public Long getWorkArea() {
122 return workArea;
123 }
124 public void setWorkArea(Long workArea) {
125 this.workArea = workArea;
126 }
127 public String getDepartment() {
128 return department;
129 }
130 public void setDepartment(String department) {
131 this.department = department;
132 }
133
134 public Date getEffectiveDate() {
135 return effectiveDate;
136 }
137 public void setEffectiveDate(Date effectiveDate) {
138 this.effectiveDate = effectiveDate;
139 }
140 public Timestamp getTimestamp() {
141 return timestamp;
142 }
143 public void setTimestamp(Timestamp timestamp) {
144 this.timestamp = timestamp;
145 }
146 public boolean isActive() {
147 return active;
148 }
149 public void setActive(boolean active) {
150 this.active = active;
151 }
152 public Person getPerson() {
153 return person;
154 }
155 public void setPerson(Person person) {
156 this.person = person;
157 }
158 public Long getHrDeptId() {
159 return hrDeptId;
160 }
161 public void setHrDeptId(Long hrDeptId) {
162 this.hrDeptId = hrDeptId;
163 }
164
165 public String getChart() {
166 return chart;
167 }
168
169 public void setChart(String chart) {
170 this.chart = chart;
171 }
172
173
174
175
176 public String getUserName() {
177 if (person == null) {
178 person = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
179 }
180
181 return (person != null) ? person.getName() : "";
182 }
183
184 public void setPositionNumber(String positionNumber) {
185 this.positionNumber = positionNumber;
186 }
187
188 public String getPositionNumber() {
189 return positionNumber;
190 }
191
192 public Date getExpirationDate() {
193 return expirationDate;
194 }
195
196 public void setExpirationDate(Date expirationDate) {
197 this.expirationDate = expirationDate;
198 }
199
200 public void setPositionObj(Position positionObj) {
201 this.positionObj = positionObj;
202 }
203
204 public Position getPositionObj() {
205 return positionObj;
206 }
207
208 @Override
209 public String getUniqueKey() {
210 return principalId + "_" + positionNumber != null ? positionNumber.toString() : "" +"_"+
211 roleName + "_" + workArea != null ? workArea.toString() : "" + "_" +
212 department + "_" + chart;
213 }
214
215 @Override
216 public String getId() {
217 return getHrRolesId();
218 }
219
220 @Override
221 public void setId(String id) {
222 setHrRolesId(id);
223 }
224
225 public Location getLocationObj() {
226 return locationObj;
227 }
228
229 public void setLocationObj(Location locationObj) {
230 this.locationObj = locationObj;
231 }
232 }