View Javadoc

1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.kpme.tklm.time.rules.lunch.department;
17  
18  import java.math.BigDecimal;
19  
20  import org.kuali.kpme.core.bo.HrBusinessObject;
21  import org.kuali.kpme.core.department.Department;
22  import org.kuali.kpme.core.job.Job;
23  import org.kuali.kpme.core.workarea.WorkArea;
24  import org.kuali.kpme.tklm.api.time.rules.lunch.department.DeptLunchRuleContract;
25  import org.kuali.kpme.tklm.common.TkConstants;
26  import org.kuali.rice.kim.api.identity.Person;
27  
28  import com.google.common.collect.ImmutableList;
29  
30  public class DeptLunchRule extends HrBusinessObject implements DeptLunchRuleContract {
31      public static final String CACHE_NAME = TkConstants.CacheNamespace.NAMESPACE_PREFIX + "DeptLunchRule";
32      //KPME-2273/1965 Primary Business Keys List.
33      public static final ImmutableList<String> EQUAL_TO_FIELDS = new ImmutableList.Builder<String>()
34              .add("dept")
35              .add("workArea")
36              .add("principalId")
37              .add("jobNumber")
38              .build();
39  
40  	
41      private static final long serialVersionUID = 1L;
42  
43      private String tkDeptLunchRuleId;
44      private String dept;
45      private Long workArea;
46      private String principalId;
47      private Long jobNumber;    
48      private BigDecimal deductionMins;
49      private BigDecimal shiftHours;
50      private String userPrincipalId;
51  
52      private String tkWorkAreaId;
53      private String hrDeptId;
54      private String hrJobId;
55  
56      private transient WorkArea workAreaObj;
57      private transient Department departmentObj;
58      private transient Job job;
59  	private transient Person principal;
60  	
61  	//for lookups
62  	private boolean history;
63  	
64  	public Person getPrincipal() {
65  		return principal;
66  	}
67  
68  	public void setPrincipal(Person principal) {
69  		this.principal = principal;
70  	}
71  
72  	public Job getJob() {
73  		return job;
74  	}
75  
76  
77  	public void setJob(Job job) {
78  		this.job = job;
79  	}
80  
81  
82  	public WorkArea getWorkAreaObj() {
83  		return workAreaObj;
84  	}
85  
86  
87  	public void setWorkAreaObj(WorkArea workAreaObj) {
88  		this.workAreaObj = workAreaObj;
89  	}
90  
91  
92  	public Department getDepartmentObj() {
93  		return departmentObj;
94  	}
95  
96  
97  	public void setDepartmentObj(Department departmentObj) {
98  		this.departmentObj = departmentObj;
99  	}
100 
101     public Long getWorkArea() {
102 		return workArea;
103 	}
104 
105 
106 	public void setWorkArea(Long workArea) {
107 		this.workArea = workArea;
108 	}
109 
110     public String getPrincipalId() {
111         return principalId;
112     }
113 
114 
115     public void setPrincipalId(String principalId) {
116         this.principalId = principalId;
117     }
118 
119 
120     public Long getJobNumber() {
121 		return jobNumber;
122 	}
123 
124 
125 	public void setJobNumber(Long jobNumber) {
126 		this.jobNumber = jobNumber;
127 	}
128 
129 
130 	public String getUserPrincipalId() {
131         return userPrincipalId;
132     }
133 
134 
135     public void setUserPrincipalId(String userPrincipalId) {
136         this.userPrincipalId = userPrincipalId;
137     }
138 
139 	public String getTkDeptLunchRuleId() {
140 		return tkDeptLunchRuleId;
141 	}
142 
143 
144 	public void setTkDeptLunchRuleId(String tkDeptLunchRuleId) {
145 		this.tkDeptLunchRuleId = tkDeptLunchRuleId;
146 	}
147 
148 
149 	public String getDept() {
150 		return dept;
151 	}
152 
153 
154 	public void setDept(String dept) {
155 		this.dept = dept;
156 	}
157 
158 
159 	public BigDecimal getDeductionMins() {
160 		return deductionMins;
161 	}
162 
163 
164 	public void setDeductionMins(BigDecimal deductionMins) {
165 		this.deductionMins = deductionMins;
166 	}
167 
168 
169 	public BigDecimal getShiftHours() {
170 		return shiftHours;
171 	}
172 
173 
174 	public void setShiftHours(BigDecimal shiftHours) {
175 		this.shiftHours = shiftHours;
176 	}
177 
178 	public String getTkWorkAreaId() {
179 		return tkWorkAreaId;
180 	}
181 
182 	public void setTkWorkAreaId(String tkWorkAreaId) {
183 		this.tkWorkAreaId = tkWorkAreaId;
184 	}
185 
186 	public String getHrDeptId() {
187 		return hrDeptId;
188 	}
189 
190 	public void setHrDeptId(String hrDeptId) {
191 		this.hrDeptId = hrDeptId;
192 	}
193 
194 	public String getHrJobId() {
195 		return hrJobId;
196 	}
197 
198 	public void setHrJobId(String hrJobId) {
199 		this.hrJobId = hrJobId;
200 	}
201 
202 	@Override
203 	public String getUniqueKey() {
204 		return getDept() + "_" + getWorkArea() != null ? getWorkArea().toString() : "" + "_" + 
205 				getPrincipalId() + "_" + getJobNumber() != null ? getJobNumber().toString() : "";
206 	}
207 
208 	@Override
209 	public String getId() {
210 		return getTkDeptLunchRuleId();
211 	}
212 
213 	@Override
214 	public void setId(String id) {
215 		setTkDeptLunchRuleId(id);
216 	}
217 
218 	public boolean isHistory() {
219 		return history;
220 	}
221 
222 	public void setHistory(boolean history) {
223 		this.history = history;
224 	}
225 
226 }