View Javadoc
1   /*
2    * Copyright 2007 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.ole.module.cg.service.impl;
17  
18  import java.util.HashMap;
19  import java.util.Map;
20  
21  import org.kuali.ole.module.cg.businessobject.Agency;
22  import org.kuali.ole.module.cg.service.AgencyService;
23  import org.kuali.ole.sys.OLEPropertyConstants;
24  import org.kuali.rice.krad.service.BusinessObjectService;
25  import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
26  
27  /**
28   * Implementation of the Agency service.
29   */
30  public class AgencyServiceImpl implements AgencyService {
31  
32      protected BusinessObjectService businessObjectService;
33  
34      /**
35       * @see org.kuali.ole.module.cg.service.AgencyService#getByPrimaryId(String)
36       */
37      @Override
38      public Agency getByPrimaryId(String agencyNumber) {
39          return KRADServiceLocatorWeb.getLegacyDataAdapter().findByPrimaryKey(Agency.class, mapPrimaryKeys(agencyNumber));
40      }
41  
42      protected Map<String, Object> mapPrimaryKeys(String agencyNumber) {
43          Map<String, Object> primaryKeys = new HashMap();
44          primaryKeys.put(OLEPropertyConstants.AGENCY_NUMBER, agencyNumber.trim());
45          return primaryKeys;
46      }
47  
48      public void setBusinessObjectService(BusinessObjectService businessObjectService) {
49          this.businessObjectService = businessObjectService;
50      }
51  }