1 package org.jbpm.graph.node; 2 3 import java.util.*; 4 import org.jbpm.graph.def.*; 5 6 public class NodeTypes { 7 8 public static Set getNodeTypes() { 9 return nodeNames.keySet(); 10 } 11 12 public static Set getNodeNames() { 13 return nodeTypes.keySet(); 14 } 15 16 public static Class getNodeType(String name) { 17 return (Class ) nodeTypes.get(name); 18 } 19 20 public static String getNodeName(Class type) { 21 return (String ) nodeNames.get(type); 22 } 23 24 private static Map nodeTypes = initialiseNodeTypes(); 25 private static Map nodeNames = createInverseMapping(nodeTypes); 26 27 private static Map initialiseNodeTypes() { 28 Map types = new HashMap(); 29 types.put("start-state", StartState.class); 30 types.put("end-state", EndState.class); 31 types.put("node", Node.class); 32 types.put("state", State.class); 33 types.put("task-node", TaskNode.class); 34 types.put("fork", Fork.class); 35 types.put("join", Join.class); 36 types.put("decision", Decision.class); 37 types.put("process-state", ProcessState.class); 38 types.put("super-state", SuperState.class); 39 types.put("merge", Merge.class); 40 types.put("milestone-node", MilestoneNode.class); 41 types.put("interleave-start", InterleaveStart.class); 42 types.put("interleave-end", InterleaveEnd.class); 43 return types; 44 } 45 46 public static Map createInverseMapping(Map map) { 47 Map names = new HashMap(); 48 Iterator iter = map.entrySet().iterator(); 49 while (iter.hasNext()) { 50 Map.Entry entry = (Map.Entry) iter.next(); 51 names.put(entry.getValue(), entry.getKey()); 52 } 53 return names; 54 } 55 56 } 58 | Popular Tags |