01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.cg.service.impl;
17:
18: import java.util.HashMap;
19: import java.util.Map;
20:
21: import org.kuali.core.service.BusinessObjectService;
22: import org.kuali.core.util.spring.Cached;
23: import org.kuali.kfs.KFSPropertyConstants;
24: import org.kuali.module.cg.bo.Agency;
25: import org.kuali.module.cg.service.AgencyService;
26: import org.springframework.transaction.annotation.Transactional;
27:
28: /**
29: * Implementation of the Agency service.
30: */
31: @Transactional
32: public class AgencyServiceImpl implements AgencyService {
33:
34: private BusinessObjectService businessObjectService;
35:
36: /**
37: * @see org.kuali.module.cg.service.AgencyService#getByPrimaryId(String)
38: */
39: @Cached
40: public Agency getByPrimaryId(String agencyNumber) {
41: return (Agency) businessObjectService.findByPrimaryKey(
42: Agency.class, mapPrimaryKeys(agencyNumber));
43: }
44:
45: private Map<String, Object> mapPrimaryKeys(String agencyNumber) {
46: Map<String, Object> primaryKeys = new HashMap();
47: primaryKeys.put(KFSPropertyConstants.AGENCY_NUMBER,
48: agencyNumber.trim());
49: return primaryKeys;
50: }
51:
52: /**
53: * Sets the BusinessObjectService. Provides Spring compatibility.
54: *
55: * @param businessObjectService
56: */
57: public void setBusinessObjectService(
58: BusinessObjectService businessObjectService) {
59: this.businessObjectService = businessObjectService;
60: }
61: }
|