1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.time.rules.timecollection;
17
18 import org.kuali.kpme.core.api.block.CalendarBlockPermissions;
19 import org.kuali.kpme.core.bo.HrKeyedBusinessObject;
20 import org.kuali.kpme.core.department.DepartmentBo;
21 import org.kuali.kpme.core.paytype.PayTypeBo;
22 import org.kuali.kpme.core.workarea.WorkAreaBo;
23 import org.kuali.kpme.tklm.api.time.rules.timecollection.TimeCollectionRuleContract;
24 import org.kuali.kpme.tklm.api.common.TkConstants;
25
26 import com.google.common.collect.ImmutableList;
27 import com.google.common.collect.ImmutableMap;
28
29 public class TimeCollectionRule extends HrKeyedBusinessObject implements TimeCollectionRuleContract {
30
31 static class KeyFields {
32 private static final String PAY_TYPE = "payType";
33 private static final String DEPT = "dept";
34 private static final String WORK_AREA = "workArea";
35 private static final String GROUP_KEY_CODE = "groupKeyCode";
36 }
37
38 private static final long serialVersionUID = 7892616560736184294L;
39
40 public static final String CACHE_NAME = TkConstants.Namespace.NAMESPACE_PREFIX + "TimeCollectionRule";
41
42 public static final ImmutableList<String> BUSINESS_KEYS = new ImmutableList.Builder<String>()
43 .add(KeyFields.WORK_AREA)
44 .add(KeyFields.DEPT)
45 .add(KeyFields.PAY_TYPE)
46 .add(KeyFields.GROUP_KEY_CODE)
47 .build();
48 public static final ImmutableList<String> CACHE_FLUSH = new ImmutableList.Builder<String>()
49 .add(TimeCollectionRule.CACHE_NAME)
50 .add(CalendarBlockPermissions.CACHE_NAME)
51 .build();
52
53 private String tkTimeCollectionRuleId;
54 private String dept;
55 private Long workArea;
56 private boolean clockUserFl;
57
58 private String tkWorkAreaId;
59 private String hrDeptId;
60
61 private DepartmentBo departmentObj;
62 private WorkAreaBo workAreaObj;
63
64
65 private String payType;
66 private String hrPayTypeId;
67 private PayTypeBo payTypeObj;
68
69
70
71 @Override
72 public ImmutableMap<String, Object> getBusinessKeyValuesMap() {
73 return new ImmutableMap.Builder<String, Object>()
74 .put(KeyFields.WORK_AREA, this.getWorkArea())
75 .put(KeyFields.DEPT, this.getDept())
76 .put(KeyFields.PAY_TYPE, this.getPayType())
77 .put(KeyFields.GROUP_KEY_CODE, this.getGroupKeyCode())
78 .build();
79 }
80
81
82 public DepartmentBo getDepartmentObj() {
83 return departmentObj;
84 }
85
86 public String getPayType() {
87 return payType;
88 }
89
90 public void setPayType(String payType) {
91 this.payType = payType;
92 }
93
94 public String getHrPayTypeId() {
95 return hrPayTypeId;
96 }
97
98 public void setHrPayTypeId(String hrPayTypeId) {
99 this.hrPayTypeId = hrPayTypeId;
100 }
101
102 public PayTypeBo getPayTypeObj() {
103 return payTypeObj;
104 }
105
106 public void setPayTypeObj(PayTypeBo payTypeObj) {
107 this.payTypeObj = payTypeObj;
108 }
109
110 public void setDepartmentObj(DepartmentBo departmentObj) {
111 this.departmentObj = departmentObj;
112 }
113
114 public WorkAreaBo getWorkAreaObj() {
115 return workAreaObj;
116 }
117
118 public void setWorkAreaObj(WorkAreaBo workAreaObj) {
119 this.workAreaObj = workAreaObj;
120 }
121
122 public Long getWorkArea() {
123 return workArea;
124 }
125
126 public void setWorkArea(Long workArea) {
127 this.workArea = workArea;
128 }
129
130 public boolean isClockUserFl() {
131 return clockUserFl;
132 }
133
134 public void setClockUserFl(boolean clockUserFl) {
135 this.clockUserFl = clockUserFl;
136 }
137
138 public String getTkTimeCollectionRuleId() {
139 return tkTimeCollectionRuleId;
140 }
141
142 public void setTkTimeCollectionRuleId(String tkTimeCollectionRuleId) {
143 this.tkTimeCollectionRuleId = tkTimeCollectionRuleId;
144 }
145
146 public String getDept() {
147 return dept;
148 }
149
150 public void setDept(String dept) {
151 this.dept = dept;
152 }
153
154 public String getTkWorkAreaId() {
155 return tkWorkAreaId;
156 }
157
158 public void setTkWorkAreaId(String tkWorkAreaId) {
159 this.tkWorkAreaId = tkWorkAreaId;
160 }
161
162 public String getHrDeptId() {
163 return hrDeptId;
164 }
165
166 public void setHrDeptId(String hrDeptId) {
167 this.hrDeptId = hrDeptId;
168 }
169
170 @Override
171 public String getUniqueKey() {
172 String timeCollKey = getDept()+"_"+isClockUserFl()+"_"+
173 (getWorkArea() !=null ? getWorkArea().toString() : "");
174
175 return timeCollKey;
176 }
177
178 @Override
179 public String getId() {
180 return getTkTimeCollectionRuleId();
181 }
182
183 @Override
184 public void setId(String id) {
185 setTkTimeCollectionRuleId(id);
186 }
187
188 }