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