| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kew.rule.dao.impl; |
| 17 | |
|
| 18 | |
import java.util.List; |
| 19 | |
|
| 20 | |
import org.apache.ojb.broker.query.Criteria; |
| 21 | |
import org.apache.ojb.broker.query.QueryByCriteria; |
| 22 | |
import org.kuali.rice.kew.rule.bo.RuleAttribute; |
| 23 | |
import org.kuali.rice.kew.rule.dao.RuleAttributeDAO; |
| 24 | |
import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport; |
| 25 | |
|
| 26 | |
|
| 27 | 0 | public class RuleAttributeDAOOjbImpl extends PersistenceBrokerDaoSupport implements RuleAttributeDAO { |
| 28 | |
|
| 29 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(RuleAttributeDAOOjbImpl.class); |
| 30 | |
|
| 31 | |
public void save(RuleAttribute ruleAttribute) { |
| 32 | 0 | this.getPersistenceBrokerTemplate().store(ruleAttribute); |
| 33 | 0 | } |
| 34 | |
|
| 35 | |
public void delete(String ruleAttributeId) { |
| 36 | 0 | this.getPersistenceBrokerTemplate().delete(findByRuleAttributeId(ruleAttributeId)); |
| 37 | 0 | } |
| 38 | |
|
| 39 | |
public RuleAttribute findByRuleAttributeId(String ruleAttributeId) { |
| 40 | 0 | RuleAttribute ruleAttribute = new RuleAttribute(); |
| 41 | 0 | ruleAttribute.setId(ruleAttributeId); |
| 42 | 0 | return (RuleAttribute) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(ruleAttribute)); |
| 43 | |
} |
| 44 | |
|
| 45 | |
public List<RuleAttribute> findByRuleAttribute(RuleAttribute ruleAttribute) { |
| 46 | 0 | Criteria crit = new Criteria(); |
| 47 | 0 | if (ruleAttribute.getName() != null) { |
| 48 | 0 | crit.addSql("UPPER(RULE_ATTRIB_NM) like '" + ruleAttribute.getName().toUpperCase() + "'"); |
| 49 | |
} |
| 50 | 0 | if (ruleAttribute.getResourceDescriptor() != null) { |
| 51 | 0 | crit.addSql("UPPER(RULE_ATTRIB_CLS_NM) like '" + ruleAttribute.getResourceDescriptor().toUpperCase() + "'"); |
| 52 | |
} |
| 53 | 0 | if (ruleAttribute.getType() != null) { |
| 54 | 0 | crit.addSql("UPPER(RULE_ATTRIB_TYP) like '" + ruleAttribute.getType().toUpperCase() + "'"); |
| 55 | |
} |
| 56 | 0 | return (List<RuleAttribute>) this.getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(RuleAttribute.class, crit)); |
| 57 | |
|
| 58 | |
} |
| 59 | |
|
| 60 | |
public List<RuleAttribute> getAllRuleAttributes() { |
| 61 | 0 | return (List<RuleAttribute>) this.getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(RuleAttribute.class)); |
| 62 | |
} |
| 63 | |
|
| 64 | |
public RuleAttribute findByName(String name) { |
| 65 | 0 | LOG.debug("findByName name=" + name); |
| 66 | 0 | Criteria crit = new Criteria(); |
| 67 | 0 | crit.addEqualTo("name", name); |
| 68 | 0 | return (RuleAttribute) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(RuleAttribute.class, crit)); |
| 69 | |
} |
| 70 | |
|
| 71 | |
public RuleAttribute findByClassName(String classname) { |
| 72 | 0 | Criteria crit = new Criteria(); |
| 73 | 0 | crit.addEqualTo("resourceDescriptor", classname); |
| 74 | 0 | return (RuleAttribute) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(RuleAttribute.class, crit)); |
| 75 | |
} |
| 76 | |
|
| 77 | |
} |