View Javadoc
1   /*
2    * Copyright 2005-2008 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.vnd.service.impl;
17  
18  import org.kuali.ole.vnd.businessobject.CommodityCode;
19  import org.kuali.ole.vnd.dataaccess.CommodityCodeDao;
20  import org.kuali.ole.vnd.service.CommodityCodeService;
21  import org.kuali.rice.krad.service.BusinessObjectService;
22  import org.springframework.transaction.annotation.Transactional;
23  
24  /**
25   * This class is the service implementation for the CommodityCodeService. 
26   * This is the default, Kuali delivered implementation. It's currently used for dwr and
27   * for searching for wild card commodity code which is used by commodity code routing
28   * rules.
29   */
30  @Transactional
31  public class CommodityCodeServiceImpl implements CommodityCodeService {
32      protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(CommodityCodeServiceImpl.class);
33  
34      private BusinessObjectService businessObjectService;
35      private CommodityCodeDao commodityCodeDao;
36      
37      /**
38       * @see org.kuali.module.vnd.service.CommodityCodeService#getByPrimaryId(java.lang.String)
39       */
40      public CommodityCode getByPrimaryId(String purchasingCommodityCode) {
41          CommodityCode ccToBeRetrieved = new CommodityCode();
42          ccToBeRetrieved.setPurchasingCommodityCode(purchasingCommodityCode.toUpperCase());
43          CommodityCode cc = (CommodityCode)businessObjectService.retrieve( ccToBeRetrieved );
44          return cc;
45      }
46  
47      /**
48       * @see org.kuali.ole.vnd.service.CommodityCodeService#wildCardCommodityCodeExists(java.lang.String)
49       */
50      public boolean wildCardCommodityCodeExists(String wildCardCommodityCode) {
51          return commodityCodeDao.wildCardCommodityCodeExists(wildCardCommodityCode);
52      }
53      
54      public void setBusinessObjectService(BusinessObjectService businessObjectService) {
55          this.businessObjectService = businessObjectService;
56      }
57      
58      public void setCommodityCodeDao(CommodityCodeDao commodityCodeDao) {
59          this.commodityCodeDao = commodityCodeDao;    
60      }
61  
62  }