001/*
002 * Copyright 2005-2008 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 */
016package org.kuali.ole.vnd.service.impl;
017
018import org.kuali.ole.vnd.businessobject.CommodityCode;
019import org.kuali.ole.vnd.dataaccess.CommodityCodeDao;
020import org.kuali.ole.vnd.service.CommodityCodeService;
021import org.kuali.rice.krad.service.BusinessObjectService;
022import org.springframework.transaction.annotation.Transactional;
023
024/**
025 * This class is the service implementation for the CommodityCodeService. 
026 * This is the default, Kuali delivered implementation. It's currently used for dwr and
027 * for searching for wild card commodity code which is used by commodity code routing
028 * rules.
029 */
030@Transactional
031public class CommodityCodeServiceImpl implements CommodityCodeService {
032    protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(CommodityCodeServiceImpl.class);
033
034    private BusinessObjectService businessObjectService;
035    private CommodityCodeDao commodityCodeDao;
036    
037    /**
038     * @see org.kuali.module.vnd.service.CommodityCodeService#getByPrimaryId(java.lang.String)
039     */
040    public CommodityCode getByPrimaryId(String purchasingCommodityCode) {
041        CommodityCode ccToBeRetrieved = new CommodityCode();
042        ccToBeRetrieved.setPurchasingCommodityCode(purchasingCommodityCode.toUpperCase());
043        CommodityCode cc = (CommodityCode)businessObjectService.retrieve( ccToBeRetrieved );
044        return cc;
045    }
046
047    /**
048     * @see org.kuali.ole.vnd.service.CommodityCodeService#wildCardCommodityCodeExists(java.lang.String)
049     */
050    public boolean wildCardCommodityCodeExists(String wildCardCommodityCode) {
051        return commodityCodeDao.wildCardCommodityCodeExists(wildCardCommodityCode);
052    }
053    
054    public void setBusinessObjectService(BusinessObjectService businessObjectService) {
055        this.businessObjectService = businessObjectService;
056    }
057    
058    public void setCommodityCodeDao(CommodityCodeDao commodityCodeDao) {
059        this.commodityCodeDao = commodityCodeDao;    
060    }
061
062}