[jboss-user] [JBoss jBPM] - Re: bpws.getVariableData as predicate is not supported?

alex.guizar@jboss.com do-not-reply at jboss.com
Wed Sep 12 16:42:46 EDT 2007


In case you are interested: AssignReader captures the namespace declarations in scope when parsing the query. When the evaluator is constructed, a SetNamespaceContext is initialized with the namespace declaration and set as the evaluator's namespaceContext property.

The function library is an attribute of the XPathQueryEvaluator class and is best set in QueryEvaluator instances by overriding the createFunctionContext method:

  protected FunctionContext createFunctionContext() {
  |     return functionLibrary;
  |   }

The VariableContext depends on the token argument. Because multiple tokens could evaluate the same query simultaneously, it is not advisable to set it as the evaluator's variableContext property. Try the following:
  public Object evaluate(Node contextNode, Token contextToken) {
  |     Context context = createContext(contextNode, contextToken);
  |     try {
  |       List nodeSet = selectNodes(context);
  |       return narrowToSingleNode(nodeSet);
  |     }
  |     catch (JaxenException e) {
  |       log.error("query evaluation failed", e);
  |       throw new BpelFaultException(BpelConstants.FAULT_SUB_LANGUAGE_EXECUTION);
  |     }
  |   }
  | 
  |   private Context createContext(Node contextNode, Token contextToken) {
  |     ContextSupport support = new ContextSupport(getNamespaceContext(), getFunctionContext(),
  |         new TokenVariableContext(contextToken), getNavigator());
  | 
  |     Context context = new Context(support);
  |     context.setNodeSet(Collections.singletonList(contextNode));
  |     return context;
  |   }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083660#4083660

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083660



More information about the jboss-user mailing list