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.principal.service;
017    
018    import org.kuali.hr.time.principal.PrincipalHRAttributes;
019    import org.kuali.hr.time.principal.dao.PrincipalHRAttributesDao;
020    import org.kuali.hr.time.service.base.TkServiceLocator;
021    
022    import java.util.Date;
023    import java.util.List;
024    
025    public class PrincipalHRAttributesServiceImpl implements PrincipalHRAttributesService {
026            private PrincipalHRAttributesDao principalHRAttributesDao;
027    
028            public void setPrincipalHRAttributesDao(PrincipalHRAttributesDao principalHRAttributesDao) {
029                    this.principalHRAttributesDao = principalHRAttributesDao;
030            }
031            
032            public PrincipalHRAttributes getPrincipalCalendar(String principalId, Date asOfDate){
033                    PrincipalHRAttributes pc =  this.principalHRAttributesDao.getPrincipalCalendar(principalId, asOfDate);
034                    if(pc != null) {
035                            pc.setCalendar(TkServiceLocator.getCalendarService().getCalendarByGroup(pc.getPayCalendar()));
036                    }
037                    return pc;
038            }
039        
040    //    @Override
041    //      public PrincipalHRAttributes getPrincipalHRAttributes(String principalId) {
042    //              return this.principalHRAttributesDao.getPrincipalHRAttributes(principalId);
043    //      }
044        
045        @Override
046        public PrincipalHRAttributes getInactivePrincipalHRAttributes(String principalId, Date asOfDate) {
047            return this.principalHRAttributesDao.getInactivePrincipalHRAttributes(principalId, asOfDate);
048        }
049        
050        @Override
051        public PrincipalHRAttributes getPrincipalHRAttributes(String hrPrincipalAttributeId) {
052            return this.principalHRAttributesDao.getPrincipalHRAttributes(hrPrincipalAttributeId);
053        }
054        
055        @Override
056        public List<PrincipalHRAttributes> getAllActivePrincipalHrAttributesForPrincipalId(String principalId, Date asOfDate) {
057            return this.principalHRAttributesDao.getAllActivePrincipalHrAttributesForPrincipalId(principalId, asOfDate);
058        }
059        @Override
060        public PrincipalHRAttributes getMaxTimeStampPrincipalHRAttributes(String principalId) {
061            return principalHRAttributesDao.getMaxTimeStampPrincipalHRAttributes(principalId);
062        }
063        
064        @Override
065        public List<PrincipalHRAttributes> getAllInActivePrincipalHrAttributesForPrincipalId(String principalId, Date asOfDate) {
066            return this.principalHRAttributesDao.getAllInActivePrincipalHrAttributesForPrincipalId(principalId, asOfDate);
067        }
068        @Override
069        public List<PrincipalHRAttributes> getActivePrincipalHrAttributesForRange(String principalId, Date startDate, Date endDate) {
070            return this.principalHRAttributesDao.getActivePrincipalHrAttributesForRange(principalId, startDate, endDate);
071        }
072        @Override
073        public List<PrincipalHRAttributes> getInactivePrincipalHRAttributesForRange(String principalId, Date startDate, Date endDate) {
074            return this.principalHRAttributesDao.getInactivePrincipalHRAttributesForRange(principalId, startDate, endDate);
075        }
076        @Override
077        public List<PrincipalHRAttributes> getPrincipalHrAtributes(String principalId, 
078                    java.sql.Date fromEffdt, java.sql.Date toEffdt, String active, String showHistory) {
079            return this.principalHRAttributesDao.getPrincipalHrAtributes(principalId, fromEffdt, toEffdt, active, showHistory);
080        }
081    }