Coverage Report - org.kuali.rice.kew.rule.dao.impl.RuleDelegationDAOJpaImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
RuleDelegationDAOJpaImpl
0%
0/24
0%
0/2
1.1
 
 1  
 /*
 2  
  * Copyright 2005-2008 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.ArrayList;
 20  
 import java.util.Collection;
 21  
 import java.util.List;
 22  
 import java.util.Map;
 23  
 
 24  
 import javax.persistence.EntityManager;
 25  
 import javax.persistence.PersistenceContext;
 26  
 
 27  
 import org.kuali.rice.core.framework.persistence.jpa.OrmUtils;
 28  
 import org.kuali.rice.core.framework.persistence.jpa.criteria.Criteria;
 29  
 import org.kuali.rice.core.framework.persistence.jpa.criteria.QueryByCriteria;
 30  
 import org.kuali.rice.kew.rule.RuleDelegation;
 31  
 import org.kuali.rice.kew.rule.dao.RuleDelegationDAO;
 32  
 
 33  
 
 34  0
 public class RuleDelegationDAOJpaImpl implements RuleDelegationDAO {
 35  
 
 36  
         @PersistenceContext(unitName="kew-unit")
 37  
         private EntityManager entityManager;
 38  
 
 39  
     public List<RuleDelegation> findByDelegateRuleId(String ruleId) {
 40  0
         Criteria crit = new Criteria(RuleDelegation.class.getName());
 41  0
         crit.eq("delegateRuleId", ruleId);
 42  0
         return (List) new QueryByCriteria(entityManager, crit).toQuery().getResultList();
 43  
     }
 44  
 
 45  
     public void save(RuleDelegation ruleDelegation) {
 46  0
             if(ruleDelegation.getRuleDelegationId()==null){
 47  0
                     entityManager.persist(ruleDelegation);
 48  
             }else{
 49  0
                     OrmUtils.merge(entityManager, ruleDelegation);
 50  
             }
 51  0
     }
 52  
     public List<RuleDelegation> findAllCurrentRuleDelegations(){
 53  0
         Criteria crit = new Criteria(RuleDelegation.class.getName());
 54  0
         crit.eq("delegationRuleBaseValues.currentInd", true);
 55  0
         return (List) new QueryByCriteria(entityManager, crit).toQuery().getResultList();
 56  
     }
 57  
 
 58  
     public RuleDelegation findByRuleDelegationId(String ruleDelegationId){
 59  0
         return entityManager.find(RuleDelegation.class, ruleDelegationId);
 60  
 
 61  
     }
 62  
     public void delete(String ruleDelegationId){
 63  0
             entityManager.remove(findByRuleDelegationId(ruleDelegationId));
 64  0
     }
 65  
 
 66  
     public EntityManager getEntityManager() {
 67  0
         return this.entityManager;
 68  
     }
 69  
 
 70  
     public void setEntityManager(EntityManager entityManager) {
 71  0
         this.entityManager = entityManager;
 72  0
     }
 73  
 
 74  
     public List<RuleDelegation> findByResponsibilityIdWithCurrentRule(String responsibilityId) {
 75  0
             Criteria crit = new Criteria(RuleDelegation.class.getName());
 76  0
             crit.eq("responsibilityId", responsibilityId);
 77  0
             crit.eq("delegationRuleBaseValues.currentInd", true);
 78  0
             Collection delegations = new QueryByCriteria(entityManager, crit).toQuery().getResultList();
 79  0
             return new ArrayList<RuleDelegation>(delegations);
 80  
     }
 81  
 
 82  
     /**
 83  
      * This overridden method ...
 84  
      *
 85  
      * @see org.kuali.rice.kew.rule.dao.RuleDelegationDAO#search(java.lang.String, java.lang.Long, java.lang.Long, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.util.Map, java.lang.String)
 86  
      */
 87  
     public List<RuleDelegation> search(String parentRuleBaseVaueId, String parentResponsibilityId, String docTypeName, String ruleId,
 88  
             String ruleTemplateId, String ruleDescription, String workgroupId,
 89  
             String workflowId, String delegationType, Boolean activeInd,
 90  
             Map extensionValues, String workflowIdDirective) {
 91  
         // TODO jjhanso - THIS METHOD NEEDS JAVADOCS
 92  0
         return null;
 93  
     }
 94  
 
 95  
     /**
 96  
      * This overridden method ...
 97  
      *
 98  
      * @see org.kuali.rice.kew.rule.dao.RuleDelegationDAO#search(java.lang.String, java.lang.Long, java.lang.String, java.util.Collection, java.lang.String, java.lang.String, java.lang.Boolean, java.util.Map, java.util.Collection)
 99  
      */
 100  
     public List<RuleDelegation> search(String parentRuleBaseVaueId, String parentResponsibilityId, String docTypeName, String ruleTemplateId,
 101  
             String ruleDescription, Collection<String> workgroupIds,
 102  
             String workflowId, String delegationType, Boolean activeInd,
 103  
             Map extensionValues, Collection actionRequestCodes) {
 104  
         // TODO jjhanso - THIS METHOD NEEDS JAVADOCS
 105  0
         return null;
 106  
     }
 107  
 
 108  
 }