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.clock.location.service;
017    
018    import java.sql.Date;
019    import java.util.List;
020    
021    import org.kuali.hr.time.clock.location.ClockLocationRule;
022    import org.kuali.hr.time.clocklog.ClockLog;
023    import org.springframework.cache.annotation.Cacheable;
024    
025    public interface ClockLocationRuleService {
026            /**
027             * Fetch Clock Location Rule based on criteria
028             * @param dept
029             * @param workArea
030             * @param principalId
031             * @param jobNumber
032             * @param asOfDate
033             * @return
034             */
035        @Cacheable(value= ClockLocationRule.CACHE_NAME,
036                key="'dept=' + #p0" +
037                        "+ '|' + 'workArea=' + #p1" +
038                        "+ '|' + 'principalId=' + #p2" +
039                        "+ '|' + 'jobNumber=' + #p3" +
040                        "+ '|' + 'asOfDate=' + #p4")
041            public List<ClockLocationRule> getClockLocationRule(String dept, Long workArea,
042                            String principalId, Long jobNumber, Date asOfDate);
043            /**
044             * Process clock location rule based on clock log passed in
045             * @param clockLog
046             * @param asOfDate
047             */
048            public void processClockLocationRule(ClockLog clockLog, Date asOfDate);
049            
050            /**
051             * 
052             * @param dept
053             * @param workArea
054             * @param principalId
055             * @param jobNumber
056             * @param asOfDate
057             * @return
058             */
059        @Cacheable(value= ClockLocationRule.CACHE_NAME,
060                key="'{getNewerVersionClockLocationRule}' + 'dept=' + #p0" +
061                        "+ '|' + 'workArea=' + #p1" +
062                        "+ '|' + 'principalId=' + #p2" +
063                        "+ '|' + 'jobNumber=' + #p3" +
064                        "+ '|' + 'asOfDate=' + #p4")
065            public List<ClockLocationRule> getNewerVersionClockLocationRule(String dept, Long workArea, String principalId, 
066                            Long jobNumber, Date asOfDate);
067            /**
068             * 
069             * @param tkClockLocationRuleId
070             * @return
071             */
072        @Cacheable(value= ClockLocationRule.CACHE_NAME, key="'tkClockLocationRuleId=' + #p0")
073            public ClockLocationRule getClockLocationRule(String tkClockLocationRuleId);
074    
075            /**
076             * populate ip addresses for given ClockLocationRule
077             * @param clr
078             * @return
079             */
080            public void populateIPAddressesForCLR(ClockLocationRule clr);
081    
082        List<ClockLocationRule> getClockLocationRules(Date fromEffdt, Date toEffdt, String principalId, String jobNumber,
083                                                      String dept, String workArea, String active, String showHistory);
084    }