Coverage Report - org.kuali.rice.kew.rule.dao.impl.RuleAttributeDAOOjbImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
RuleAttributeDAOOjbImpl
0%
0/25
0%
0/6
1.429
 
 1  
 /*
 2  
  * Copyright 2005-2007 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  * 
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 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(Long ruleAttributeId) {
 37  0
                 this.getPersistenceBrokerTemplate().delete(findByRuleAttributeId(ruleAttributeId));
 38  0
         }
 39  
 
 40  
         public RuleAttribute findByRuleAttributeId(Long 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 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) this.getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(RuleAttribute.class, crit));
 58  
 
 59  
         }
 60  
 
 61  
         public List getAllRuleAttributes() {
 62  0
                 return (List) 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  
 }