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