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.timecollection.rule.service;
017    
018    import org.apache.commons.lang.StringUtils;
019    import org.kuali.hr.time.collection.rule.TimeCollectionRule;
020    import org.kuali.hr.time.timecollection.rule.dao.TimeCollectionRuleDaoService;
021    
022    import java.sql.Date;
023    import java.util.List;
024    
025    public class TimeCollectionRuleServiceImpl implements TimeCollectionRuleService{
026            private TimeCollectionRuleDaoService timeCollectRuleDao;
027    
028        @Override
029            public TimeCollectionRule getTimeCollectionRule(String dept, Long workArea, String payType, Date asOfDate){
030                    return timeCollectRuleDao.getTimeCollectionRule(dept, workArea, payType, asOfDate);
031            }
032    
033        @Override
034            public TimeCollectionRule getTimeCollectionRule(String dept, Long workArea,Date asOfDate){
035                    return timeCollectRuleDao.getTimeCollectionRule(dept, workArea, asOfDate);
036            }
037    
038            public TimeCollectionRuleDaoService getTimeCollectRuleDao() {
039                    return timeCollectRuleDao;
040            }
041    
042            public void setTimeCollectRuleDao(
043                            TimeCollectionRuleDaoService timeCollectRuleDao) {
044                    this.timeCollectRuleDao = timeCollectRuleDao;
045            }
046    
047            @Override
048            public TimeCollectionRule getTimeCollectionRule(String tkTimeCollectionRuleId) {
049                    return timeCollectRuleDao.getTimeCollectionRule(tkTimeCollectionRuleId);
050            }
051    
052        @Override
053        public List<TimeCollectionRule> getTimeCollectionRules(String dept, String workArea, String payType, String active, String showHistory) {
054            Long workAreaToSearch = StringUtils.isEmpty(workArea) ? null : Long.parseLong(workArea);
055            return timeCollectRuleDao.getTimeCollectionRules(dept, workAreaToSearch , payType, active, showHistory);
056        }
057    }