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.syslunch.service;
017    
018    import org.kuali.hr.time.service.base.TkServiceLocator;
019    import org.kuali.hr.time.syslunch.dao.SystemLunchRuleDao;
020    import org.kuali.hr.time.syslunch.rule.SystemLunchRule;
021    import org.kuali.hr.time.util.TKUtils;
022    
023    import java.sql.Date;
024    import java.util.List;
025    
026    public class SystemLunchRuleServiceImpl implements SystemLunchRuleService {
027            public SystemLunchRuleDao systemLunchRuleDao;
028    
029            @Override
030            public SystemLunchRule getSystemLunchRule(Date asOfDate) {
031                    return systemLunchRuleDao.getSystemLunchRule(asOfDate);
032            }
033    
034            public SystemLunchRuleDao getSystemLunchRuleDao() {
035                    return systemLunchRuleDao;
036            }
037    
038            public void setSystemLunchRuleDao(SystemLunchRuleDao systemLunchRuleDao) {
039                    this.systemLunchRuleDao = systemLunchRuleDao;
040            }
041    
042            @Override
043            public boolean isShowLunchButton() {
044    
045            Boolean isShowLunchButton = false;
046            SystemLunchRule systemLunchrule = TkServiceLocator.getSystemLunchRuleService().getSystemLunchRule(TKUtils.getCurrentDate());
047            if(systemLunchrule != null) {
048                    isShowLunchButton = systemLunchrule.getShowLunchButton();
049            }
050    
051                    return isShowLunchButton;
052            }
053    
054            @Override
055            public SystemLunchRule getSystemLunchRule(String tkSystemLunchRuleId) {
056                    return systemLunchRuleDao.getSystemLunchRule(tkSystemLunchRuleId);
057            }
058    
059        @Override
060        public List<SystemLunchRule> getSystemLunchRules(Date fromEffdt, Date toEffdt, String active, String showHist){
061            return systemLunchRuleDao.getSystemLunchRules(fromEffdt, toEffdt, active, showHist);
062        }
063    }