1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.clock.location;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.kuali.hr.core.KPMEConstants;
22 import org.kuali.hr.job.Job;
23 import org.kuali.hr.time.authorization.DepartmentalRule;
24 import org.kuali.hr.time.department.Department;
25 import org.kuali.hr.time.rule.TkRule;
26 import org.kuali.hr.time.service.base.TkServiceLocator;
27 import org.kuali.hr.time.workarea.WorkArea;
28 import org.kuali.rice.kim.api.identity.Person;
29
30 public class ClockLocationRule extends TkRule implements DepartmentalRule {
31
32 private static final long serialVersionUID = 959554402289679184L;
33
34 public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "ClockLocationRule";
35
36 private String tkClockLocationRuleId;
37
38 private Department department;
39 private String dept;
40 private String hrDeptId;
41
42 private Long workArea;
43 private String tkWorkAreaId;
44 private String principalId;
45 private Long jobNumber;
46 private String hrJobId;
47
48 private List<ClockLocationRuleIpAddress> ipAddresses = new ArrayList<ClockLocationRuleIpAddress>();
49 private String userPrincipalId;
50 private Boolean history;
51
52 private WorkArea workAreaObj;
53 private Job job;
54 private Person principal;
55
56 public Long getWorkArea() {
57 return workArea;
58 }
59
60 public void setWorkArea(Long workArea) {
61 this.workArea = workArea;
62 }
63
64 public String getPrincipalId() {
65 return principalId;
66 }
67
68 public void setPrincipalId(String principalId) {
69 this.principalId = principalId;
70 }
71
72 public String getUserPrincipalId() {
73 return userPrincipalId;
74 }
75
76 public void setUserPrincipalId(String userPrincipalId) {
77 this.userPrincipalId = userPrincipalId;
78 }
79
80 public Long getJobNumber() {
81 return jobNumber;
82 }
83
84 public void setJobNumber(Long jobNumber) {
85 this.jobNumber = jobNumber;
86 }
87 public Department getDepartment() {
88 return department;
89 }
90
91 public void setDepartment(Department department) {
92 this.department = department;
93 }
94
95 public WorkArea getWorkAreaObj() {
96 return workAreaObj;
97 }
98
99 public void setWorkAreaObj(WorkArea workAreaObj) {
100 this.workAreaObj = workAreaObj;
101 }
102
103 public Job getJob() {
104 return job;
105 }
106
107 public void setJob(Job job) {
108 this.job = job;
109 }
110
111 public String getTkClockLocationRuleId() {
112 return tkClockLocationRuleId;
113 }
114
115 public void setTkClockLocationRuleId(String tkClockLocationRuleId) {
116 this.tkClockLocationRuleId = tkClockLocationRuleId;
117 }
118
119 public String getDept() {
120 return dept;
121 }
122
123 public void setDept(String dept) {
124 this.dept = dept;
125 }
126
127 public void setHistory(Boolean history) {
128 this.history = history;
129 }
130
131 public Boolean getHistory() {
132 return history;
133 }
134
135 public Person getPrincipal() {
136 return principal;
137 }
138
139 public void setPrincipal(Person principal) {
140 this.principal = principal;
141 }
142
143 public String getHrDeptId() {
144 return hrDeptId;
145 }
146
147 public void setHrDeptId(String hrDeptId) {
148 this.hrDeptId = hrDeptId;
149 }
150
151 public String getTkWorkAreaId() {
152 return tkWorkAreaId;
153 }
154
155 public void setTkWorkAreaId(String tkWorkAreaId) {
156 this.tkWorkAreaId = tkWorkAreaId;
157 }
158
159 public String getHrJobId() {
160 return hrJobId;
161 }
162
163 public void setHrJobId(String hrJobId) {
164 this.hrJobId = hrJobId;
165 }
166
167 @Override
168 public String getUniqueKey() {
169 String clockLocKey = getDept()+"_"+getPrincipalId()+"_"+
170 (getJobNumber()!=null ? getJobNumber().toString(): "") +"_" +
171 (getWorkArea() !=null ? getWorkArea().toString() : "");
172
173 return clockLocKey;
174 }
175
176 @Override
177 public String getId() {
178 return getTkClockLocationRuleId();
179 }
180
181 @Override
182 public void setId(String id) {
183 setTkClockLocationRuleId(id);
184 }
185
186 public List<ClockLocationRuleIpAddress> getIpAddresses() {
187 if(ipAddresses.isEmpty()) {
188 TkServiceLocator.getClockLocationRuleService().populateIPAddressesForCLR(this);
189 }
190 return ipAddresses;
191 }
192
193 public void setIpAddresses(List<ClockLocationRuleIpAddress> ipAddresses) {
194 this.ipAddresses = ipAddresses;
195 }
196
197 public String getIpAddressesString() {
198 String aString = "";
199 for(ClockLocationRuleIpAddress ip : this.getIpAddresses()) {
200 aString += ip.getIpAddress() + ", ";
201 }
202 return aString;
203 }
204
205
206 }