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-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 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  
 }