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  /*
17   * Created on Jul 7, 2004
18   *
19   */
20  package org.kuali.ole.pdp.service.impl;
21  
22  import java.util.HashMap;
23  import java.util.List;
24  import java.util.Map;
25  
26  import org.kuali.ole.pdp.PdpPropertyConstants;
27  import org.kuali.ole.pdp.businessobject.CustomerProfile;
28  import org.kuali.ole.pdp.service.CustomerProfileService;
29  import org.kuali.rice.krad.service.BusinessObjectService;
30  import org.springframework.transaction.annotation.Transactional;
31  
32  @Transactional
33  public class CustomerProfileServiceImpl implements CustomerProfileService {
34      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(CustomerProfileServiceImpl.class);
35  
36      private BusinessObjectService businessObjectService;
37  
38      public CustomerProfile get(String chartCode, String unitCode, String subUnitCode) {
39          Map fieldValues = new HashMap();
40          
41          fieldValues.put(PdpPropertyConstants.CustomerProfile.CUSTOMER_PROFILE_CHART_CODE, chartCode);
42          fieldValues.put(PdpPropertyConstants.CustomerProfile.CUSTOMER_PROFILE_UNIT_CODE, unitCode);
43          fieldValues.put(PdpPropertyConstants.CustomerProfile.CUSTOMER_PROFILE_SUB_UNIT_CODE, subUnitCode);
44          List customerProfileList = (List) this.businessObjectService.findMatching(CustomerProfile.class, fieldValues);
45          if (customerProfileList.isEmpty()) return null;
46          
47          return (CustomerProfile) customerProfileList.get(0);
48      }
49      
50      /**
51       * Sets the business object service
52       * 
53       * @param businessObjectService
54       */
55      public void setBusinessObjectService(BusinessObjectService businessObjectService) {
56          this.businessObjectService = businessObjectService;
57      }
58  }