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.shiftdiff.rule;
017    
018    import java.math.BigDecimal;
019    import java.sql.Time;
020    
021    import org.kuali.hr.core.KPMEConstants;
022    import org.kuali.hr.location.Location;
023    import org.kuali.hr.paygrade.PayGrade;
024    import org.kuali.hr.time.calendar.Calendar;
025    import org.kuali.hr.time.earncode.EarnCode;
026    import org.kuali.hr.time.earncodegroup.EarnCodeGroup;
027    import org.kuali.hr.time.rule.TkRule;
028    import org.kuali.hr.time.salgroup.SalGroup;
029    
030    public class ShiftDifferentialRule extends TkRule {
031    
032            private static final long serialVersionUID = -3990672795815968915L;
033    
034            public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "ShiftDifferentialRule";
035    
036            private String tkShiftDiffRuleId;
037            private String location;
038            private String hrSalGroup;
039            private String payGrade;
040            private String earnCode;
041            private Time beginTime;
042            private Time endTime;
043            private BigDecimal minHours;
044            private boolean sunday;
045            private boolean monday;
046            private boolean tuesday;
047            private boolean wednesday;
048            private boolean thursday;
049            private boolean friday;
050            private boolean saturday;
051            private String fromEarnGroup;
052            private String pyCalendarGroup;
053            private BigDecimal maxGap; // Gap is in HOURS
054            private String userPrincipalId;
055    
056            private String hrSalGroupId;
057            private String hrLocationId;
058            private String hrPayGradeId;    
059            
060            private boolean history;
061            
062            private EarnCode earnCodeObj;
063            private SalGroup salGroupObj;
064        private EarnCodeGroup fromEarnGroupObj;
065        private Calendar payCalendar;
066        private Location locationObj;
067        private PayGrade payGradeObj;
068        
069            public String getTkShiftDiffRuleId() {
070                    return tkShiftDiffRuleId;
071            }
072    
073            public void setTkShiftDiffRuleId(String tkShiftDiffRuleId) {
074                    this.tkShiftDiffRuleId = tkShiftDiffRuleId;
075            }
076    
077            public String getLocation() {
078                    return location;
079            }
080    
081            public void setLocation(String location) {
082                    this.location = location;
083            }
084    
085            public String getPayGrade() {
086                    return payGrade;
087            }
088    
089            public void setPayGrade(String payGrade) {
090                    this.payGrade = payGrade;
091            }
092    
093            public String getEarnCode() {
094                    return earnCode;
095            }
096    
097            public void setEarnCode(String earnCode) {
098                    this.earnCode = earnCode;
099            }
100    
101            public BigDecimal getMinHours() {
102                    return minHours;
103            }
104    
105            public void setMinHours(BigDecimal minHours) {
106                    this.minHours = minHours;
107            }
108    
109        /**
110         * @return The maximum gap, in hours.
111         */
112            public BigDecimal getMaxGap() {
113                    return maxGap;
114            }
115    
116        /**
117         *
118         * @param maxGap The number of hours that can be between one time block and another for the rule to consider it part of the same shift.
119         */
120            public void setMaxGap(BigDecimal maxGap) {
121                    this.maxGap = maxGap;
122            }
123    
124            public String getUserPrincipalId() {
125                    return userPrincipalId;
126            }
127    
128            public void setUserPrincipalId(String userPrincipalId) {
129                    this.userPrincipalId = userPrincipalId;
130            }
131    
132            public String getHrSalGroup() {
133                    return hrSalGroup;
134            }
135    
136            public void setHrSalGroup(String hrSalGroup) {
137                    this.hrSalGroup = hrSalGroup;
138            }
139    
140            public String getPyCalendarGroup() {
141                    return pyCalendarGroup;
142            }
143    
144            public void setPyCalendarGroup(String pyCalendarGroup) {
145                    this.pyCalendarGroup = pyCalendarGroup;
146            }
147    
148            public Time getBeginTime() {
149                    return beginTime;
150            }
151    
152            public void setBeginTime(Time beginTime) {
153                    this.beginTime = beginTime;
154            }
155    
156            public Time getEndTime() {
157                    return endTime;
158            }
159    
160            public void setEndTime(Time endTime) {
161                    this.endTime = endTime;
162            }
163    
164            public String getFromEarnGroup() {
165                    return fromEarnGroup;
166            }
167    
168            public void setFromEarnGroup(String fromEarnGroup) {
169                    this.fromEarnGroup = fromEarnGroup;
170            }
171    
172            public boolean isSunday() {
173                    return sunday;
174            }
175    
176            public void setSunday(boolean sunday) {
177                    this.sunday = sunday;
178            }
179    
180            public boolean isMonday() {
181                    return monday;
182            }
183    
184            public void setMonday(boolean monday) {
185                    this.monday = monday;
186            }
187    
188            public boolean isTuesday() {
189                    return tuesday;
190            }
191    
192            public void setTuesday(boolean tuesday) {
193                    this.tuesday = tuesday;
194            }
195    
196            public boolean isWednesday() {
197                    return wednesday;
198            }
199    
200            public void setWednesday(boolean wednesday) {
201                    this.wednesday = wednesday;
202            }
203    
204            public boolean isThursday() {
205                    return thursday;
206            }
207    
208            public void setThursday(boolean thursday) {
209                    this.thursday = thursday;
210            }
211    
212            public boolean isFriday() {
213                    return friday;
214            }
215    
216            public void setFriday(boolean friday) {
217                    this.friday = friday;
218            }
219    
220            public boolean isSaturday() {
221                    return saturday;
222            }
223    
224            public void setSaturday(boolean saturday) {
225                    this.saturday = saturday;
226            }
227    
228            public EarnCode getEarnCodeObj() {
229                    return earnCodeObj;
230            }
231    
232            public void setEarnCodeObj(EarnCode earnCodeObj) {
233                    this.earnCodeObj = earnCodeObj;
234            }
235    
236            public SalGroup getSalGroupObj() {
237                    return salGroupObj;
238            }
239    
240            public void setSalGroupObj(SalGroup salGroupObj) {
241                    this.salGroupObj = salGroupObj;
242            }
243    
244        public EarnCodeGroup getFromEarnGroupObj() {
245            return fromEarnGroupObj;
246        }
247    
248        public void setFromEarnGroupObj(EarnCodeGroup fromEarnGroupObj) {
249            this.fromEarnGroupObj = fromEarnGroupObj;
250        }
251    
252        public Calendar getPayCalendar() {
253            return payCalendar;
254        }
255    
256        public void setPayCalendar(Calendar payCalendar) {
257            this.payCalendar = payCalendar;
258        }
259    
260            public Location getLocationObj() {
261                    return locationObj;
262            }
263    
264            public void setLocationObj(Location locationObj) {
265                    this.locationObj = locationObj;
266            }
267    
268            public PayGrade getPayGradeObj() {
269                    return payGradeObj;
270            }
271    
272            public void setPayGradeObj(PayGrade payGradeObj) {
273                    this.payGradeObj = payGradeObj;
274            }
275    
276            public String getHrSalGroupId() {
277                    return hrSalGroupId;
278            }
279    
280            public void setHrSalGroupId(String hrSalGroupId) {
281                    this.hrSalGroupId = hrSalGroupId;
282            }
283    
284            public String getHrLocationId() {
285                    return hrLocationId;
286            }
287    
288            public void setHrLocationId(String hrLocationId) {
289                    this.hrLocationId = hrLocationId;
290            }
291    
292            public String getHrPayGradeId() {
293                    return hrPayGradeId;
294            }
295    
296            public void setHrPayGradeId(String hrPayGradeId) {
297                    this.hrPayGradeId = hrPayGradeId;
298            }
299    
300            @Override
301            public String getUniqueKey() {
302                    return location + "_" + hrSalGroup + "_" + payGrade;
303            }
304    
305            @Override
306            public String getId() {
307                    return getTkShiftDiffRuleId();
308            }
309    
310            @Override
311            public void setId(String id) {
312                    setTkShiftDiffRuleId(id);
313            }
314    
315            public boolean isHistory() {
316                    return history;
317            }
318    
319            public void setHistory(boolean history) {
320                    this.history = history;
321            }
322    
323    }