[jboss-user] [JBoss jBPM] - Re: bpws.getVariableData as predicate is not supported?
meghanai_99
do-not-reply at jboss.com
Tue Sep 11 21:09:00 EDT 2007
Here is what I had to do to get it working.
1. Change query.functions.xml as shown above.
2. Added overloaded method in QueryEvaluator and XPathQueryEvaluator
| public Object evaluate(Node contextNode, Token token) {
| try {
|
| this.setVariableContext( new ScopeVariableContext(token));
| this.setFunctionContext( functionLibrary);
| //TODO: if no where else, add method in SetNamespaceContext to add bpws.
| ((SetNamespaceContext)this.getNamespaceContext()).addNamespace( "bpws", "http://schemas.xmlsoap.org/ws/2003/03/business-process/");
| List nodeset = selectNodes(contextNode);
| return narrowToSingleNode(nodeset);
| }
| catch (JaxenException e) {
| throw new BpelFaultException(BpelConstants.FAULT_SUB_LANGUAGE_EXECUTION);
| }
| }
Note: The namespace context did not have 'bpws' prefix which I have hardcoded here, I will get to fixing that hack next. I added a method in SetNamespaceContext to add a namespace at a time if prefix doesn't exist already.
3. I call this new method in FromVariable.
| value = query.getEvaluator().evaluate((Element) value, token);
|
4. Jaxen only allows 'number' or 'boolean' in predicate. With my original XPath, it was returning nodeset and getting resolved as boolean 'true'. So I had to wrap my 'getVariableData' call inside XPath 'number' function.
| /ns9:GetItemsByQueryResponse/ns9:return[number(bpws:getVariableData("ForEach_index"))]/ns9:genericItem/ns9:itemID
|
This got my while loop working.
Meghana
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083230#4083230
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083230
More information about the jboss-user
mailing list