Coverage Report - org.kuali.rice.kew.engine.RoutingNodeFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
RoutingNodeFactory
0%
0/14
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.kew.engine.node.Branch;
 19  
 import org.kuali.rice.kew.engine.node.RouteNode;
 20  
 import org.kuali.rice.kew.engine.node.RouteNodeInstance;
 21  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 22  
 
 23  
 
 24  
 /**
 25  
  * Provides factory methods for creating {@link Branch} objects and {@link RouteNodeInstance} object.
 26  
  *
 27  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 28  
  */
 29  0
 public class RoutingNodeFactory {
 30  
 
 31  
     public Branch createBranch(String name, Branch parentBranch, RouteNodeInstance initialNodeInstance) {
 32  0
         Branch branch = new Branch();
 33  0
         branch.setName(name);
 34  0
         branch.setParentBranch(parentBranch);
 35  0
         branch.setInitialNode(initialNodeInstance);
 36  0
         initialNodeInstance.setBranch(branch);
 37  0
         return branch;
 38  
     }
 39  
     
 40  
     public RouteNodeInstance createRouteNodeInstance(String documentId, RouteNode node) {
 41  0
         RouteNodeInstance nodeInstance = new RouteNodeInstance();
 42  0
         nodeInstance.setActive(false);
 43  0
         nodeInstance.setComplete(false);
 44  0
         nodeInstance.setRouteNode(node);
 45  0
         nodeInstance.setDocumentId(documentId);
 46  0
         return nodeInstance;
 47  
     }
 48  
     
 49  
     public RouteNode getRouteNode(RouteContext context, String name) {
 50  0
         return KEWServiceLocator.getRouteNodeService().findRouteNodeByName(context.getDocument().getDocumentType().getDocumentTypeId(), name);
 51  
     }
 52  
     
 53  
 }