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.kuali.rice.krad.service.KRADServiceLocatorWeb;
31  import org.springframework.transaction.annotation.Transactional;
32  
33  @Transactional
34  public class CustomerProfileServiceImpl implements CustomerProfileService {
35      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(CustomerProfileServiceImpl.class);
36  
37      private BusinessObjectService businessObjectService;
38  
39      public CustomerProfile get(String chartCode, String unitCode, String subUnitCode) {
40          Map fieldValues = new HashMap();
41          
42          fieldValues.put(PdpPropertyConstants.CustomerProfile.CUSTOMER_PROFILE_CHART_CODE, chartCode);
43          fieldValues.put(PdpPropertyConstants.CustomerProfile.CUSTOMER_PROFILE_UNIT_CODE, unitCode);
44          fieldValues.put(PdpPropertyConstants.CustomerProfile.CUSTOMER_PROFILE_SUB_UNIT_CODE, subUnitCode);
45          List customerProfileList = (List) KRADServiceLocatorWeb.getLegacyDataAdapter().findMatching(CustomerProfile.class, fieldValues);
46          if (customerProfileList.isEmpty()) return null;
47          
48          return (CustomerProfile) customerProfileList.get(0);
49      }
50      
51      /**
52       * Sets the business object service
53       * 
54       * @param businessObjectService
55       */
56      public void setBusinessObjectService(BusinessObjectService businessObjectService) {
57          this.businessObjectService = businessObjectService;
58      }
59  }