1 package org.jbpm.bpel.data.xpath; 2 3 import java.util.Iterator ; 4 5 import org.jaxen.*; 6 7 import org.jbpm.graph.exe.Token; 8 9 import org.jbpm.bpel.def.Activity; 10 import org.jbpm.bpel.def.Link; 11 import org.jbpm.bpel.exe.LinkInstance; 12 import org.jbpm.bpel.xml.BpelConstants; 13 14 21 class JoinCondition extends XPathScript { 22 23 private static final long serialVersionUID = 1L; 24 public static final FunctionContext FUNCTION_LIBRARY; 25 26 JoinCondition(String snippet) throws JaxenException { 27 super(snippet); 28 } 29 30 protected FunctionContext createFunctionContext() { 31 return FUNCTION_LIBRARY; 32 } 33 34 42 protected Context getContext(Object node) { 43 SimpleVariableContext variableContext = new SimpleVariableContext(); 44 Token token = (Token) node; 45 Iterator it = ((Activity) token.getNode()).getTargets().iterator(); 46 while (it.hasNext()) { 47 String linkName = ((Link)it.next()).getName(); 48 variableContext.setVariableValue(linkName, LinkInstance.get(token, linkName).getReached()); 49 } 50 51 ContextSupport support = new ContextSupport(getNamespaceContext(), 52 getFunctionContext(), variableContext, getNavigator()); 53 return new Context(support); 54 } 55 56 static { 57 XPathFunctionContext functionContext = new XPathFunctionContext(); 58 FUNCTION_LIBRARY = functionContext; 59 functionContext.registerFunction(BpelConstants.NS_BPWS_1_1, "getLinkStatus", new GetLinkStatusFunction()); 61 } 62 } 63 | Popular Tags |