001    /**
002     * Copyright 2004-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.hr.time.dept.lunch;
017    
018    import java.math.BigDecimal;
019    
020    import org.kuali.hr.core.KPMEConstants;
021    import org.kuali.hr.job.Job;
022    import org.kuali.hr.time.HrBusinessObject;
023    import org.kuali.hr.time.authorization.DepartmentalRule;
024    import org.kuali.hr.time.department.Department;
025    import org.kuali.hr.time.workarea.WorkArea;
026    import org.kuali.rice.kim.api.identity.Person;
027    
028    public class DeptLunchRule extends HrBusinessObject implements DepartmentalRule {
029        public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "DeptLunchRule";
030        private static final long serialVersionUID = 1L;
031    
032        private String tkDeptLunchRuleId;
033        private String dept;
034        private Long workArea;
035        private String principalId;
036        private Long jobNumber;    
037        private BigDecimal deductionMins;
038        private BigDecimal shiftHours;
039        private String userPrincipalId;
040    
041        private String tkWorkAreaId;
042        private String hrDeptId;
043        private String hrJobId;
044    
045        private transient WorkArea workAreaObj;
046        private transient Department departmentObj;
047        private transient Job job;
048            private transient Person principal;
049    
050        //for lookups
051        private boolean history;
052            
053            public Person getPrincipal() {
054                    return principal;
055            }
056    
057            public void setPrincipal(Person principal) {
058                    this.principal = principal;
059            }
060    
061            public Job getJob() {
062                    return job;
063            }
064    
065    
066            public void setJob(Job job) {
067                    this.job = job;
068            }
069    
070    
071            public WorkArea getWorkAreaObj() {
072                    return workAreaObj;
073            }
074    
075    
076            public void setWorkAreaObj(WorkArea workAreaObj) {
077                    this.workAreaObj = workAreaObj;
078            }
079    
080    
081            public Department getDepartmentObj() {
082                    return departmentObj;
083            }
084    
085    
086            public void setDepartmentObj(Department departmentObj) {
087                    this.departmentObj = departmentObj;
088            }
089    
090        public Long getWorkArea() {
091                    return workArea;
092            }
093    
094    
095            public void setWorkArea(Long workArea) {
096                    this.workArea = workArea;
097            }
098    
099        public String getPrincipalId() {
100            return principalId;
101        }
102    
103    
104        public void setPrincipalId(String principalId) {
105            this.principalId = principalId;
106        }
107    
108    
109        public Long getJobNumber() {
110                    return jobNumber;
111            }
112    
113    
114            public void setJobNumber(Long jobNumber) {
115                    this.jobNumber = jobNumber;
116            }
117    
118    
119            public String getUserPrincipalId() {
120            return userPrincipalId;
121        }
122    
123    
124        public void setUserPrincipalId(String userPrincipalId) {
125            this.userPrincipalId = userPrincipalId;
126        }
127    
128            public String getTkDeptLunchRuleId() {
129                    return tkDeptLunchRuleId;
130            }
131    
132    
133            public void setTkDeptLunchRuleId(String tkDeptLunchRuleId) {
134                    this.tkDeptLunchRuleId = tkDeptLunchRuleId;
135            }
136    
137    
138            public String getDept() {
139                    return dept;
140            }
141    
142    
143            public void setDept(String dept) {
144                    this.dept = dept;
145            }
146    
147    
148            public BigDecimal getDeductionMins() {
149                    return deductionMins;
150            }
151    
152    
153            public void setDeductionMins(BigDecimal deductionMins) {
154                    this.deductionMins = deductionMins;
155            }
156    
157    
158            public BigDecimal getShiftHours() {
159                    return shiftHours;
160            }
161    
162    
163            public void setShiftHours(BigDecimal shiftHours) {
164                    this.shiftHours = shiftHours;
165            }
166    
167            public String getTkWorkAreaId() {
168                    return tkWorkAreaId;
169            }
170    
171            public void setTkWorkAreaId(String tkWorkAreaId) {
172                    this.tkWorkAreaId = tkWorkAreaId;
173            }
174    
175            public String getHrDeptId() {
176                    return hrDeptId;
177            }
178    
179            public void setHrDeptId(String hrDeptId) {
180                    this.hrDeptId = hrDeptId;
181            }
182    
183            public String getHrJobId() {
184                    return hrJobId;
185            }
186    
187            public void setHrJobId(String hrJobId) {
188                    this.hrJobId = hrJobId;
189            }
190    
191            @Override
192            public String getUniqueKey() {
193                    return getDept() + "_" + getWorkArea() != null ? getWorkArea().toString() : "" + "_" + 
194                                    getPrincipalId() + "_" + getJobNumber() != null ? getJobNumber().toString() : "";
195            }
196    
197            @Override
198            public String getId() {
199                    return getTkDeptLunchRuleId();
200            }
201    
202            @Override
203            public void setId(String id) {
204                    setTkDeptLunchRuleId(id);
205            }
206    
207        public boolean isHistory() {
208            return history;
209        }
210    
211        public void setHistory(boolean history) {
212            this.history = history;
213        }
214    }