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.SubContractor;
22  import org.kuali.ole.module.cg.service.SubcontractorService;
23  import org.kuali.ole.sys.OLEPropertyConstants;
24  import org.kuali.rice.krad.service.BusinessObjectService;
25  
26  /**
27   * Implementation of the Subcontractor service.
28   */
29  public class SubcontractorServiceImpl implements SubcontractorService {
30  
31      protected BusinessObjectService businessObjectService;
32  
33      /**
34       * @see org.kuali.ole.module.cg.service.SubcontractorService#getByPrimaryId(String)
35       */
36      @Override
37      public SubContractor getByPrimaryId(String subcontractorNumber) {
38          return businessObjectService.findByPrimaryKey(SubContractor.class, mapPrimaryKeys(subcontractorNumber));
39      }
40  
41      protected Map<String, Object> mapPrimaryKeys(String subcontractorNumber) {
42          Map<String, Object> primaryKeys = new HashMap<String, Object>();
43          primaryKeys.put(OLEPropertyConstants.SUBCONTRACTOR_NUMBER, subcontractorNumber.trim());
44          return primaryKeys;
45      }
46  
47      public void setBusinessObjectService(BusinessObjectService businessObjectService) {
48          this.businessObjectService = businessObjectService;
49      }
50  }