View Javadoc
1   /**
2    * Copyright 2004-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.kpme.pm.positionflag.service;
17  
18  import java.util.List;
19  
20  import org.joda.time.LocalDate;
21  import org.kuali.kpme.pm.api.positionflag.PositionFlag;
22  import org.kuali.kpme.pm.api.positionflag.service.PositionFlagService;
23  import org.kuali.kpme.pm.api.positiontype.PositionType;
24  import org.kuali.kpme.pm.positionflag.PositionFlagBo;
25  import org.kuali.kpme.pm.positionflag.dao.PositionFlagDao;
26  import org.kuali.kpme.pm.positiontype.PositionTypeBo;
27  import org.kuali.rice.core.api.mo.ModelObjectUtils;
28  
29  public class PositionFlagServiceImpl implements PositionFlagService {
30  
31  	private PositionFlagDao positionFlagDao;
32  
33  	protected List<PositionFlag> convertToImmutable(List<PositionFlagBo> bos) {
34  		return ModelObjectUtils.transform(bos, PositionFlagBo.toImmutable);
35  	}
36  
37  	@Override
38  	public PositionFlag getPositionFlagById(String pmPositionFlagId) {
39  		return PositionFlagBo.to(positionFlagDao
40  				.getPositionFlagById(pmPositionFlagId));
41  
42  	}
43  
44  	@Override
45  	public List<String> getAllActiveFlagCategories() {
46  		return positionFlagDao.getAllActiveFlagCategories();
47  	}
48  
49  	@Override
50  	public List<PositionFlag> getAllActivePositionFlags(String category,
51  			String name, LocalDate effDate) {
52  		return convertToImmutable(positionFlagDao.getAllActivePositionFlags(category, name,
53  				effDate));
54  	}
55  
56  	@Override
57  	public List<PositionFlag> getAllActivePositionFlagsWithCategory(
58  			String category, LocalDate effDate) {
59  		return convertToImmutable(positionFlagDao.getAllActivePositionFlagsWithCategory(category,
60  				effDate));
61  	}
62  
63  	public PositionFlagDao getPositionFlagDao() {
64  		return positionFlagDao;
65  	}
66  
67  	public void setPositionFlagDao(PositionFlagDao positionFlagDao) {
68  		this.positionFlagDao = positionFlagDao;
69  	}
70  
71  }