View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package org.kuali.kfs.vnd.service.impl;
20  
21  import org.kuali.kfs.vnd.businessobject.CommodityCode;
22  import org.kuali.kfs.vnd.dataaccess.CommodityCodeDao;
23  import org.kuali.kfs.vnd.service.CommodityCodeService;
24  import org.kuali.rice.krad.service.BusinessObjectService;
25  import org.springframework.transaction.annotation.Transactional;
26  
27  /**
28   * This class is the service implementation for the CommodityCodeService. 
29   * This is the default, Kuali delivered implementation. It's currently used for dwr and
30   * for searching for wild card commodity code which is used by commodity code routing
31   * rules.
32   */
33  @Transactional
34  public class CommodityCodeServiceImpl implements CommodityCodeService {
35      protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(CommodityCodeServiceImpl.class);
36  
37      private BusinessObjectService businessObjectService;
38      private CommodityCodeDao commodityCodeDao;
39      
40      /**
41       * @see org.kuali.module.vnd.service.CommodityCodeService#getByPrimaryId(java.lang.String)
42       */
43      public CommodityCode getByPrimaryId(String purchasingCommodityCode) {
44          CommodityCode ccToBeRetrieved = new CommodityCode();
45          ccToBeRetrieved.setPurchasingCommodityCode(purchasingCommodityCode.toUpperCase());
46          CommodityCode cc = (CommodityCode)businessObjectService.retrieve( ccToBeRetrieved );
47          return cc;
48      }
49  
50      /**
51       * @see org.kuali.kfs.vnd.service.CommodityCodeService#wildCardCommodityCodeExists(java.lang.String)
52       */
53      public boolean wildCardCommodityCodeExists(String wildCardCommodityCode) {
54          return commodityCodeDao.wildCardCommodityCodeExists(wildCardCommodityCode);
55      }
56      
57      public void setBusinessObjectService(BusinessObjectService businessObjectService) {
58          this.businessObjectService = businessObjectService;
59      }
60      
61      public void setCommodityCodeDao(CommodityCodeDao commodityCodeDao) {
62          this.commodityCodeDao = commodityCodeDao;    
63      }
64  
65  }