1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.vnd.dataaccess.impl;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.apache.ojb.broker.query.Criteria;
20 import org.apache.ojb.broker.query.QueryFactory;
21 import org.kuali.ole.sys.OLEConstants;
22 import org.kuali.ole.vnd.VendorPropertyConstants;
23 import org.kuali.ole.vnd.businessobject.CommodityCode;
24 import org.kuali.ole.vnd.dataaccess.CommodityCodeDao;
25 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
26
27
28
29
30 public class CommodityCodeDaoOjb extends PlatformAwareDaoBaseOjb implements CommodityCodeDao {
31 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(CommodityCodeDaoOjb.class);
32
33
34
35
36 public boolean wildCardCommodityCodeExists(String wildCardCommodityCode) {
37 String commodityCodeString = StringUtils.replace(wildCardCommodityCode, OLEConstants.WILDCARD_CHARACTER, OLEConstants.PERCENTAGE_SIGN);
38 Criteria criteria = new Criteria();
39 criteria.addLike(VendorPropertyConstants.PURCHASING_COMMODITY_CODE, commodityCodeString);
40 int count = getPersistenceBrokerTemplate().getCount(QueryFactory.newQuery(CommodityCode.class, criteria));
41 boolean exists = ((count > 0) ? true : false);
42 return exists;
43 }
44 }