001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 /* 017 * Created on Jul 7, 2004 018 * 019 */ 020 package org.kuali.kfs.pdp.service.impl; 021 022 import java.util.HashMap; 023 import java.util.List; 024 import java.util.Map; 025 026 import org.kuali.kfs.pdp.PdpPropertyConstants; 027 import org.kuali.kfs.pdp.businessobject.CustomerProfile; 028 import org.kuali.kfs.pdp.service.CustomerProfileService; 029 import org.kuali.rice.kns.service.BusinessObjectService; 030 import org.springframework.transaction.annotation.Transactional; 031 032 @Transactional 033 public class CustomerProfileServiceImpl implements CustomerProfileService { 034 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(CustomerProfileServiceImpl.class); 035 036 private BusinessObjectService businessObjectService; 037 038 public CustomerProfile get(String chartCode, String unitCode, String subUnitCode) { 039 Map fieldValues = new HashMap(); 040 041 fieldValues.put(PdpPropertyConstants.CustomerProfile.CUSTOMER_PROFILE_CHART_CODE, chartCode); 042 fieldValues.put(PdpPropertyConstants.CustomerProfile.CUSTOMER_PROFILE_UNIT_CODE, unitCode); 043 fieldValues.put(PdpPropertyConstants.CustomerProfile.CUSTOMER_PROFILE_SUB_UNIT_CODE, subUnitCode); 044 List customerProfileList = (List) this.businessObjectService.findMatching(CustomerProfile.class, fieldValues); 045 if (customerProfileList.isEmpty()) return null; 046 047 return (CustomerProfile) customerProfileList.get(0); 048 } 049 050 /** 051 * Sets the business object service 052 * 053 * @param businessObjectService 054 */ 055 public void setBusinessObjectService(BusinessObjectService businessObjectService) { 056 this.businessObjectService = businessObjectService; 057 } 058 }