Coverage Report - org.kuali.rice.kew.engine.RouteHelper
 
Classes in this File Line Coverage Branch Coverage Complexity
RouteHelper
0%
0/13
N/A
1
 
 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.engine;
 17  
 
 18  
 import org.kuali.rice.core.api.reflect.ObjectDefinition;
 19  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 20  
 import org.kuali.rice.core.api.util.ClassLoaderUtils;
 21  
 import org.kuali.rice.kew.engine.node.BasicJoinEngine;
 22  
 import org.kuali.rice.kew.engine.node.DynamicNode;
 23  
 import org.kuali.rice.kew.engine.node.JoinEngine;
 24  
 import org.kuali.rice.kew.engine.node.JoinNode;
 25  
 import org.kuali.rice.kew.engine.node.Node;
 26  
 import org.kuali.rice.kew.engine.node.RequestActivationNode;
 27  
 import org.kuali.rice.kew.engine.node.RequestsNode;
 28  
 import org.kuali.rice.kew.engine.node.RouteNode;
 29  
 import org.kuali.rice.kew.engine.node.SimpleNode;
 30  
 import org.kuali.rice.kew.engine.node.SplitNode;
 31  
 import org.kuali.rice.kew.engine.node.SubProcessNode;
 32  
 
 33  
 
 34  
 /**
 35  
  * A helper class which provides some useful utilities for examining and generating nodes.
 36  
  * Provides access to the {@link JoinEngine} and the {@link RoutingNodeFactory}.
 37  
  *
 38  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 39  
  */
 40  0
 public class RouteHelper {
 41  
 
 42  0
     private JoinEngine joinEngine = new BasicJoinEngine();
 43  0
     private RoutingNodeFactory nodeFactory = new RoutingNodeFactory();
 44  
 
 45  
     public JoinEngine getJoinEngine() {
 46  0
         return joinEngine;
 47  
     }
 48  
 
 49  
     public RoutingNodeFactory getNodeFactory() {
 50  0
         return nodeFactory;
 51  
     }
 52  
 
 53  
     public boolean isSimpleNode(RouteNode routeNode) {
 54  0
         return ClassLoaderUtils.isInstanceOf(getNode(routeNode), SimpleNode.class);
 55  
     }
 56  
 
 57  
     public boolean isJoinNode(RouteNode routeNode) {
 58  0
         return ClassLoaderUtils.isInstanceOf(getNode(routeNode), JoinNode.class);
 59  
     }
 60  
 
 61  
     public boolean isSplitNode(RouteNode routeNode) {
 62  0
         return ClassLoaderUtils.isInstanceOf(getNode(routeNode), SplitNode.class);
 63  
     }
 64  
 
 65  
     public boolean isDynamicNode(RouteNode routeNode) {
 66  0
         return ClassLoaderUtils.isInstanceOf(getNode(routeNode), DynamicNode.class);
 67  
     }
 68  
 
 69  
     public boolean isSubProcessNode(RouteNode routeNode) {
 70  0
         return ClassLoaderUtils.isInstanceOf(getNode(routeNode), SubProcessNode.class);
 71  
     }
 72  
 
 73  
     public boolean isRequestActivationNode(RouteNode routeNode) {
 74  0
         return ClassLoaderUtils.isInstanceOf(getNode(routeNode), RequestActivationNode.class);
 75  
     }
 76  
 
 77  
     public boolean isRequestsNode(RouteNode routeNode) {
 78  0
         return getNode(routeNode) instanceof RequestsNode;
 79  
     }
 80  
 
 81  
     public Node getNode(RouteNode routeNode) {
 82  0
             return (Node) GlobalResourceLoader.getObject(new ObjectDefinition(routeNode.getNodeType(), routeNode.getDocumentType().getApplicationId()));
 83  
     }
 84  
 }