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