Coverage report

  %line %branch
net.sf.infrared.web.treecontrolmodel.TreeFactoryImpl
0% 
0% 

 1  
 /*
 2  
  *
 3  
  * Copyright 2005 Tavant Technologies and Contributors
 4  
  * 
 5  
  * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
 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  
  *
 18  
  *
 19  
  * Original Author:  prashant.nair (Tavant Technologies)
 20  
  * Contributor(s):   -;
 21  
  *
 22  
  */
 23  
 package net.sf.infrared.web.treecontrolmodel;
 24  
 
 25  
 import net.sf.jsptree.JSPTreeTag;
 26  
 import net.sf.jsptree.tree.TreeFactory;
 27  
 import net.sf.jsptree.tree.TreeFactoryException;
 28  
 import net.sf.jsptree.tree.TreeStateModel;
 29  
 import net.sf.jsptree.tree.TreeStructureModel;
 30  
 import net.sf.infrared.base.model.AggregateExecutionTime;
 31  
 import net.sf.infrared.base.util.TreeNode;
 32  
 import net.sf.infrared.web.treecontrolmodel.NodeToStringConverter;
 33  
 
 34  
 import java.util.HashMap;
 35  
 
 36  
 /**
 37  
  * This class is responsible for creating the TreeState and TreeModel. A TreeFactoryImpl is created for
 38  
  * every api that is the head of a tree. This ensures that a seperate TreeModel exists for every api.
 39  
  * It consists of HashMaps that have references to the TreeState and TreeModel that correspond to this tree
 40  
  */
 41  
 
 42  
 public class TreeFactoryImpl implements TreeFactory {
 43  
 	public IRTreeStructureModel structureModel;
 44  
 
 45  
 	public IRTreeStateModel stateModel;
 46  
 
 47  
 	public NodeToStringConverter nodeToStringConverter;
 48  
 
 49  0
 	private HashMap treeStructureMap = null;
 50  
 
 51  0
 	private HashMap treeStateMap = null;
 52  
 
 53  
 	public TreeFactoryImpl(TreeNode node, String treeName,
 54  0
 								NodeToStringConverter nodeToStringConverter) {
 55  0
 		treeStructureMap = new HashMap();
 56  0
 		treeStateMap = new HashMap();
 57  0
 		this.nodeToStringConverter = nodeToStringConverter;
 58  
 
 59  
 		// This is required because we create a treefactory for every api.
 60  
 		// If the call is from the JDBC layer, it will only contain SQL queries.
 61  
 		// If an intermediate node is created in this case it returns the wrong data.
 62  
 		// This method is similar to the getChildNodes in IRIntermediateNode
 63  
 
 64  0
 		if (node.getChildren().size() > 0)
 65  0
 			structureModel = new IRTreeStructureModel(class="keyword">new IRIntermediateNode(node, 
 66  
 																			nodeToStringConverter));
 67  
 		else {
 68  0
 			structureModel = new IRTreeStructureModel(class="keyword">new IRLeafNode(node,nodeToStringConverter));
 69  
 		}
 70  0
 		stateModel = new IRTreeStateModel();
 71  0
 		treeStructureMap.put(treeName, structureModel);
 72  0
 		treeStateMap.put(treeName, stateModel);
 73  0
 	}
 74  
 
 75  
 	public TreeStructureModel getTree(String treeName) throws TreeFactoryException {
 76  0
 		return (TreeStructureModel) treeStructureMap.get(treeName);
 77  
 	}
 78  
 
 79  
 	public TreeStateModel getTreeStates(String treeName) throws TreeFactoryException {
 80  0
 		return (TreeStateModel) treeStateMap.get(treeName);
 81  
 	}
 82  
 
 83  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.