incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r984691 - in /incubator/hise/trunk: hise-services/src/main/java/org/apache/hise/engine/jaxws/ hise-services/src/main/java/org/apache/hise/lang/ hise-services/src/main/java/org/apache/hise/runtime/ hise-services/src/main/java/org/apache/hise...
Date Thu, 12 Aug 2010 08:57:38 GMT
Author: rr
Date: Thu Aug 12 08:57:37 2010
New Revision: 984691

URL: http://svn.apache.org/viewvc?rev=984691&view=rev
Log:
HISE-72: node namespace context available in expression (Thanks to Piotr Zagórski)

Modified:
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/DeadlineController.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java
    incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/CompilerTest.java
    incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java
    incubator/hise/trunk/hise-test-example-osgi/src/main/resources/testHtd1.xml

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java?rev=984691&r1=984690&r2=984691&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java
Thu Aug 12 08:57:37 2010
@@ -29,13 +29,9 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 import javax.jws.WebService;
-import javax.xml.datatype.Duration;
 import javax.xml.namespace.QName;
-import javax.xml.ws.Holder;
 import javax.xml.ws.WebServiceContext;
 
 import org.apache.commons.logging.Log;
@@ -61,7 +57,6 @@ import org.apache.hise.engine.wsdl.Recip
 
 import org.apache.hise.engine.wsdl.TaskOperations;
 
-import org.apache.hise.lang.TaskDefinition;
 import org.apache.hise.lang.xsd.htd.TDeadlineInfo;
 import org.apache.hise.lang.xsd.htd.TDeadlinesInfo;
 import org.apache.hise.lang.xsd.htd.TGrouplist;
@@ -76,7 +71,6 @@ import org.apache.hise.lang.xsd.htda.TCo
 import org.apache.hise.lang.xsd.htda.TStatus;
 import org.apache.hise.lang.xsd.htda.TTask;
 import org.apache.hise.lang.xsd.htda.TTaskAbstract;
-import org.apache.hise.lang.xsd.htda.TTaskQueryResultSet;
 import org.apache.hise.lang.xsd.htdt.ActivateDocument;
 import org.apache.hise.lang.xsd.htdt.ActivateResponseDocument;
 import org.apache.hise.lang.xsd.htdt.AddAttachmentDocument;
@@ -158,7 +152,6 @@ import org.apache.hise.runtime.HiseIlleg
 import org.apache.hise.runtime.Task;
 import org.apache.hise.runtime.TaskEvaluator;
 import org.apache.hise.utils.DOMUtils;
-import org.apache.hise.utils.XQueryEvaluator;
 import org.apache.ws.commons.schema.utils.DOMUtil;
 import org.apache.xmlbeans.GDate;
 import org.apache.xmlbeans.GDuration;
@@ -168,7 +161,6 @@ import org.springframework.transaction.a
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 import org.apache.xmlbeans.XmlString;
 
 /**
@@ -232,10 +224,12 @@ public class TaskOperationsImpl implemen
         query.setUser(user);
         query.setUserGroups(hiseEngine.getHiseUserDetails().getUserGroups(user));
         query.setTaskType(taskType);
-        if(genericHumanRole==null)
-        	query.setGenericHumanRole(null);
-        else
-        	query.setGenericHumanRole(GenericHumanRole.valueOf(genericHumanRole));
+        if(genericHumanRole==null) {
+            query.setGenericHumanRole(null);
+        }
+        else {
+            query.setGenericHumanRole(GenericHumanRole.valueOf(genericHumanRole));
+        }
         query.setWorkQueue(workQueue);
         query.setStatuses(status);
         query.setWhereClause(whereClause);
@@ -988,7 +982,7 @@ public class TaskOperationsImpl implemen
     private Element convertRendering(TRendering rendering, Task task) {
         Node cont = rendering.getDomNode();
         TaskEvaluator evaluator=task.getTaskEvaluator();
-        List<Node> rend = evaluator.buildQueryEvaluator().evaluateExpression("/*/expression",
cont);
+        List<Node> rend = evaluator.buildQueryEvaluator(null).evaluateExpression("/*/expression",
cont);
 //    	NodeList content = rendering.getDomNode().getChildNodes();
 //          if(content.item(i) instanceof org.w3c.dom.Element){
 //        	NodeList nodes=((org.w3c.dom.Element)content.item(0)).getChildNodes();
@@ -997,7 +991,7 @@ public class TaskOperationsImpl implemen
 //        	String expression=nodes.item(0).getTextContent();
         if(!rend.isEmpty()) {
         String expression = DOMUtil.getChildText(rend.get(0));
-        	List queryResponse=evaluator.buildQueryEvaluator().evaluateExpression(expression,
null);
+        	List queryResponse=evaluator.buildQueryEvaluator(rend.get(0)).evaluateExpression(expression,
null);
         	if(queryResponse.get(0) instanceof Node){
         		Document result=convertRenderingFromXML((Node)queryResponse.get(0));
         		return result==null ? null : result.getDocumentElement();

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java?rev=984691&r1=984690&r2=984691&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java
Thu Aug 12 08:57:37 2010
@@ -44,6 +44,7 @@ import org.apache.hise.lang.xsd.htd.TTas
 import org.apache.hise.utils.DOMUtils;
 import org.apache.ws.commons.schema.utils.DOMUtil;
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 
 /**
  * Holds information about task version runnable in TouK Human Task engine. Task
@@ -331,8 +332,8 @@ public class TaskDefinition {
         return isNotification() ? tNote.getPeopleAssignments() : tTask.getPeopleAssignments();
     }
     
-    public String getOutcomeExpression() {
-        return DOMUtil.getChildText(tTask.getOutcome().getDomNode());
+    public Node getOutcomeExpression() {
+        return tTask.getOutcome().getDomNode();
     }
     
     public TPresentationElements getPresentationElements() {

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/DeadlineController.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/DeadlineController.java?rev=984691&r1=984690&r2=984691&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/DeadlineController.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/DeadlineController.java
Thu Aug 12 08:57:37 2010
@@ -129,7 +129,7 @@ public class DeadlineController implemen
     	
 		String expression = DOMUtil.getChildText(booleanExpr.getDomNode());
 		TaskEvaluator evaluator=task.getTaskEvaluator();
-		List queryResponse = evaluator.buildQueryEvaluator().evaluateExpression(expression, null);
+		List queryResponse = evaluator.buildQueryEvaluator(booleanExpr.getDomNode()).evaluateExpression(expression,
null);
 		
 		boolean response = false;
 		if (queryResponse != null && (queryResponse.get(0) instanceof Boolean)) {

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java?rev=984691&r1=984690&r2=984691&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java
Thu Aug 12 08:57:37 2010
@@ -69,14 +69,18 @@ public class TaskEvaluator {
         }
     }
 
-    public XQueryEvaluator buildQueryEvaluator() {
+    public XQueryEvaluator buildQueryEvaluator(Node queryContextNode) {
         XQueryEvaluator evaluator = new XQueryEvaluator();
         evaluator.setContextObject(this);
         evaluator.declareJavaClass("http://www.example.org/WS-HT", HtdFunctions.class);
         evaluator.bindVariable(QName.valueOf("taskId"), task.getTaskDto().getId());
         evaluator.bindVariable(QName.valueOf("currentEventDateTime"), task.getCurrentEventDateTime());
-        evaluator.declareNamespace("htd", "http://www.example.org/WS-HT");
-        evaluator.declareNamespace("wsa", "http://www.w3.org/2005/08/addressing");
+//        evaluator.declareNamespace("htd", "http://www.example.org/WS-HT");
+//        evaluator.declareNamespace("wsa", "http://www.w3.org/2005/08/addressing");
+        if(queryContextNode!= null) {
+            evaluator.setNamespaceContext(queryContextNode);
+        }
+        
         return evaluator;
     }
 
@@ -87,7 +91,7 @@ public class TaskEvaluator {
             return priority;
         }
         String expression = DOMUtil.getChildText(task.getTaskDefinition().getPriority().getDomNode());
-        List queryResponse = buildQueryEvaluator().evaluateExpression(expression, null);
+        List queryResponse = buildQueryEvaluator(task.getTaskDefinition().getPriority().getDomNode()).evaluateExpression(expression,
null);
 
         if (queryResponse != null) {
             if (queryResponse.get(0) instanceof Long) {
@@ -100,20 +104,20 @@ public class TaskEvaluator {
     }
 
     private List evaluateExpression(TExpression expr) {
-        return buildQueryEvaluator().evaluateExpression(DOMUtil.getChildText(expr.getDomNode()),
null);
+        return buildQueryEvaluator(expr.getDomNode()).evaluateExpression(DOMUtil.getChildText(expr.getDomNode()),
null);
     }
 
-    private Object evaluateExpression(String expr) {
-        return buildQueryEvaluator().evaluateExpression(expr, null).get(0);
+    private Object evaluateExpression(String expr, Node queryContextNode) {
+        return buildQueryEvaluator(queryContextNode).evaluateExpression(expr, null).get(0);
     }
 
     public Date evaluateDeadline(TDeadline deadline) {
         if (deadline.getFor() != null) {
             String content = DOMUtil.getChildText(deadline.getFor().getDomNode());
-            return (Date) evaluateExpression("$currentEventDateTime + xs:dayTimeDuration("
+ content + ")");
+            return (Date) evaluateExpression("$currentEventDateTime + xs:dayTimeDuration("
+ content + ")", deadline.getFor().getDomNode());
         } else {
             String content = DOMUtil.getChildText(deadline.getUntil().getDomNode());
-            return (Date) evaluateExpression("xs:date("+content+")");
+            return (Date) evaluateExpression("xs:date("+content+")", deadline.getUntil().getDomNode());
         }                                      
     }
 
@@ -167,7 +171,7 @@ public class TaskEvaluator {
     		Node literal = from.getLiteral().getDomNode();
     		
     		if (literal != null) {
-                for (String user : (List<String>) buildQueryEvaluator().evaluateExpression("for
$i in htd:literal/htd:organizationalEntity/htd:users/htd:user return string($i)", literal))
{ 
+                for (String user : (List<String>) buildQueryEvaluator(literal).evaluateExpression("for
$i in htd:literal/htd:organizationalEntity/htd:users/htd:user return string($i)", literal))
{
                 	TaskOrgEntity x = new TaskOrgEntity();
                     x.setGenericHumanRole(GenericHumanRole.POTENTIALDELEGATEES);
                     x.setName(user);
@@ -175,7 +179,7 @@ public class TaskEvaluator {
                     x.setTask(task.getTaskDto());
                     result.add(x);
                 }
-                for (String group : (List<String>) buildQueryEvaluator().evaluateExpression("
for $i in htd:literal/htd:organizationalEntity/htd:groups/htd:group return string($i)", literal))
{  
+                for (String group : (List<String>) buildQueryEvaluator(literal).evaluateExpression("
for $i in htd:literal/htd:organizationalEntity/htd:groups/htd:group return string($i)", literal))
{
                 	TaskOrgEntity x = new TaskOrgEntity();
                     x.setGenericHumanRole(GenericHumanRole.POTENTIALDELEGATEES);
                     x.setName(group);
@@ -191,7 +195,6 @@ public class TaskEvaluator {
     public Set<TaskOrgEntity> evaluateGenericHumanRole(TGenericHumanRole role, GenericHumanRole
assignmentRole) {
         Set<TaskOrgEntity> result = new HashSet<TaskOrgEntity>();
 
-        XQueryEvaluator evaluator = buildQueryEvaluator();
         TFrom f = role.getFrom();
         TLiteral literal = f.getLiteral();
 
@@ -205,7 +208,7 @@ public class TaskEvaluator {
 //            for (Element argument : elements) {
                 if (argument != null && argument.getName() != null & argument.getName().length()
> 0) {
                     String argumentName = argument.getName();
-                    List ret = evaluator.evaluateExpression(argument.getName(), argument.getDomNode());
+                    List ret = buildQueryEvaluator(argument.getDomNode()).evaluateExpression(argument.getName(),
argument.getDomNode());
 
                     if (!ret.isEmpty()) {
                         String arg = (String) ret.get(0);
@@ -237,7 +240,7 @@ public class TaskEvaluator {
             }
 
         } else if (literal != null) {
-            for (String user : (List<String>) buildQueryEvaluator().evaluateExpression("for
$i in htd:literal/htd:organizationalEntity/htd:users/htd:user return string($i)", literal.getDomNode()))
{
+            for (String user : (List<String>) buildQueryEvaluator(literal.getDomNode()).evaluateExpression("for
$i in htd:literal/htd:organizationalEntity/htd:users/htd:user return string($i)", literal.getDomNode()))
{
                 TaskOrgEntity x = new TaskOrgEntity();
                 x.setGenericHumanRole(assignmentRole);
                 x.setName(user);
@@ -245,7 +248,7 @@ public class TaskEvaluator {
                 x.setTask(task.getTaskDto());
                 result.add(x);
             }
-            for (String group : (List<String>) buildQueryEvaluator().evaluateExpression("
for $i in htd:literal/htd:organizationalEntity/htd:groups/htd:group return string($i)", literal.newDomNode()))
{
+            for (String group : (List<String>) buildQueryEvaluator(literal.getDomNode()).evaluateExpression("
for $i in htd:literal/htd:organizationalEntity/htd:groups/htd:group return string($i)", literal.newDomNode()))
{
                 TaskOrgEntity x = new TaskOrgEntity();
                 x.setGenericHumanRole(assignmentRole);
                 x.setName(group);
@@ -260,7 +263,7 @@ public class TaskEvaluator {
     }
 
     public Node createEprFromHeader(Node header) {
-        return (Node) buildQueryEvaluator().evaluateExpression("<wsa:EndpointReference
 >{ */wsa:ReplyTo/* }</wsa:EndpointReference>", header).get(0);
+        return (Node) buildQueryEvaluator(header).evaluateExpression("<wsa:EndpointReference
 >{ */wsa:ReplyTo/* }</wsa:EndpointReference>", header).get(0);
     }
 
     // private Set<TaskOrgEntity> evaluatePeopleGroup(String groupName) {
@@ -273,16 +276,17 @@ public class TaskEvaluator {
     // }
 
     public Node evaluateOutcome(boolean outcome) {
-        XQueryEvaluator evaluator = buildQueryEvaluator();
+        XQueryEvaluator evaluator = buildQueryEvaluator(task.getTaskDefinition().getOutcomeExpression());
         evaluator.bindVariable(QName.valueOf("outcome"), outcome);
-        return (Node) evaluator.evaluateExpression(task.getTaskDefinition().getOutcomeExpression(),
null).get(0);
+        return (Node) evaluator.evaluateExpression(DOMUtil.getChildText(task.getTaskDefinition().getOutcomeExpression()),
null).get(0);
     }
 
     /**
      * TODO approve???
      */
     public Node evaluateApproveResponseHeader() {
-        XQueryEvaluator evaluator = buildQueryEvaluator();
+        XQueryEvaluator evaluator = buildQueryEvaluator(null);
+        evaluator.declareNamespace("htd", "http://www.example.org/WS-HT");
         return (Node) evaluator.evaluateExpression("<htd:taskId>{$taskId}</htd:taskId>",
null).get(0);
     }
 
@@ -328,9 +332,8 @@ public class TaskEvaluator {
     public Map<String, Node> evaluateToParts(TToParts toParts) {
         Map<String, Node> result = new HashMap<String, Node>();
         if (toParts != null) {
-            XQueryEvaluator e = buildQueryEvaluator();
             for (TToPart toPart : toParts.getToPartList()) {
-                result.put(toPart.getName(), (Node) e.evaluateExpression(DOMUtil.getChildText(toPart.getDomNode()),
null).get(0));
+                result.put(toPart.getName(), (Node) buildQueryEvaluator(toPart.getDomNode()).evaluateExpression(DOMUtil.getChildText(toPart.getDomNode()),
null).get(0));
             }
         }
         return result;
@@ -348,11 +351,10 @@ public class TaskEvaluator {
         }
     }
 
-    public XQueryEvaluator buildPresentationEvaluator() {
-        XQueryEvaluator evaluator = buildQueryEvaluator();
+    public XQueryEvaluator buildPresentationEvaluator(Node queryContextNode) {
+        XQueryEvaluator evaluator = buildQueryEvaluator(queryContextNode);
         for (TPresentationParameter p : task.getTaskDefinition().getPresentationParameters())
{
-            XQueryEvaluator evaluator2 = buildQueryEvaluator();
-            List eavaluationResult = evaluator2.evaluateExpression(DOMUtil.getChildText(p.getDomNode()),
null);
+            List eavaluationResult = buildQueryEvaluator(p.getDomNode()).evaluateExpression(DOMUtil.getChildText(p.getDomNode()),
null);
             Object v = null;
             if (!eavaluationResult.isEmpty()) {
                 v = eavaluationResult.get(0);
@@ -373,23 +375,27 @@ public class TaskEvaluator {
 
     public String evalPresentationSubject() {
         String subjectExpr;
+        Node subjectNode = null;
         try {
-            subjectExpr = getTemplateExpr(Arrays.asList(new Object[] {task.getTaskDefinition().getPresentationElements().getSubjectList().get(0).getDomNode()}));
+            subjectNode = task.getTaskDefinition().getPresentationElements().getSubjectList().get(0).getDomNode();
+            subjectExpr = getTemplateExpr(Arrays.asList(new Object[] {subjectNode}));
         } catch (Throwable t) {
             return null;
         }
-        XQueryEvaluator e = buildPresentationEvaluator();
+        XQueryEvaluator e = buildPresentationEvaluator(subjectNode);
         return "" + e.evaluateExpression(subjectExpr, null).get(0);
     }
 
     public String evalPresentationDescription() {
         String descExpr;
+        Node descNode = null;
         try {
-            descExpr = getTemplateExpr(Arrays.asList(new Object[] {task.getTaskDefinition().getPresentationElements().getDescriptionList().get(0).getDomNode()}));
+            descNode = task.getTaskDefinition().getPresentationElements().getDescriptionList().get(0).getDomNode();
+            descExpr = getTemplateExpr(Arrays.asList(new Object[] {descNode}));
         } catch (Throwable t) {
             return null;
         }
-        XQueryEvaluator e = buildPresentationEvaluator();
+        XQueryEvaluator e = buildPresentationEvaluator(descNode);
         return "" + e.evaluateExpression(descExpr, null).get(0);
     }
 }

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java?rev=984691&r1=984690&r2=984691&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java
Thu Aug 12 08:57:37 2010
@@ -43,6 +43,7 @@ import net.sf.saxon.value.SequenceType;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.ws.commons.schema.utils.NodeNamespaceContext;
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Node;
@@ -159,4 +160,12 @@ public class XQueryEvaluator {
     		
     		sqc.declareNamespace(prefix, uri);
     }
+
+    public void setNamespaceContext(Node queryContextNode) {
+        NodeNamespaceContext namespaceContext = NodeNamespaceContext.getNamespaceContext(queryContextNode);
+        for (String prefix : namespaceContext.getDeclaredPrefixes()) {
+            sqc.declareNamespace(prefix, namespaceContext.getNamespaceURI(prefix));
+        }
+
+    }
 }

Modified: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/CompilerTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/CompilerTest.java?rev=984691&r1=984690&r2=984691&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/CompilerTest.java (original)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/CompilerTest.java Thu
Aug 12 08:57:37 2010
@@ -27,6 +27,7 @@ import javax.xml.namespace.QName;
 import org.apache.hise.engine.store.CompileException;
 import org.apache.hise.engine.store.HumanInteractionsCompiler;
 import org.apache.hise.lang.HumanInteractions;
+import org.apache.ws.commons.schema.utils.DOMUtil;
 import org.junit.Assert;
 import org.junit.Test;
 import org.springframework.core.io.ClassPathResource;
@@ -44,7 +45,7 @@ public class CompilerTest {
         Assert.assertTrue(s.contains(QName.valueOf("{http://www.insurance.example.com/claims}Task2")));
         Assert.assertTrue(s.contains(QName.valueOf("{http://www.insurance.example.com/claims}Task3")));
         Assert.assertTrue(s.contains(QName.valueOf("{http://www.insurance.example.com/claims}Notify2")));
-        Assert.assertEquals("someOutput", hi.getTaskDefinitions().get(QName.valueOf("{http://www.insurance.example.com/claims}Task1")).getOutcomeExpression());
+        Assert.assertEquals("someOutput", DOMUtil.getChildText(hi.getTaskDefinitions().get(QName.valueOf("{http://www.insurance.example.com/claims}Task1")).getOutcomeExpression()));
         Assert.assertEquals("approve", hi.getTaskDefinitions().get(QName.valueOf("{http://www.insurance.example.com/claims}Task1")).getTaskInterface().getOperation());
         Assert.assertEquals("notify", hi.getTaskDefinitions().get(QName.valueOf("{http://www.insurance.example.com/claims}Notify2")).getTaskInterface().getOperation());
     }

Modified: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java?rev=984691&r1=984690&r2=984691&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java
(original)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java
Thu Aug 12 08:57:37 2010
@@ -99,7 +99,7 @@ public class TaskEvaluatorTest {
     	String[] condition = new String[5];
     	List r[] = new List[5];
     	for(int i = 0;i < 5; ++i){
-    		e[i] = buildTaskEvaluator().buildQueryEvaluator();
+    		e[i] = buildTaskEvaluator().buildQueryEvaluator(null);
     		e[i].declareNamespace("htd","http://www.example.org/WS-HT");
     	}
 
@@ -122,7 +122,7 @@ public class TaskEvaluatorTest {
 
     @Test
     public void testEvalGetInput() throws Exception {
-        XQueryEvaluator e = buildTaskEvaluator().buildQueryEvaluator();
+        XQueryEvaluator e = buildTaskEvaluator().buildQueryEvaluator(null);
         e.declareNamespace("htd","http://www.example.org/WS-HT");
         Object r = e.evaluateExpression("xs:string(htd:getInput('request')/b)", null);
         Assert.assertTrue(r.toString().equals("[text1]"));
@@ -131,7 +131,7 @@ public class TaskEvaluatorTest {
     @Test
     public void testEvalOutcome2() throws Exception {
         System.out.println("testEvalOutcome2");
-        XQueryEvaluator e = buildTaskEvaluator().buildQueryEvaluator();
+        XQueryEvaluator e = buildTaskEvaluator().buildQueryEvaluator(null);
         Object r = DOMUtils.domToString((Node) e.evaluateExpression(IOUtils.toString(getClass().getResourceAsStream("/outcome2.xml")),
null).get(0));
         Assert.assertTrue(r.toString().contains("<firstname>text1</firstname><lastname>text1</lastname><taskId>1234</taskId>"));
         System.out.println("~testEvalOutcome2");

Modified: incubator/hise/trunk/hise-test-example-osgi/src/main/resources/testHtd1.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-test-example-osgi/src/main/resources/testHtd1.xml?rev=984691&r1=984690&r2=984691&view=diff
==============================================================================
--- incubator/hise/trunk/hise-test-example-osgi/src/main/resources/testHtd1.xml (original)
+++ incubator/hise/trunk/hise-test-example-osgi/src/main/resources/testHtd1.xml Thu Aug 12
08:57:37 2010
@@ -9,6 +9,7 @@ Business Machines Corporation, Oracle In
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     xmlns:tns="http://www.insurance.example.com/claims"
+    xmlns:cla="http://www.insurance.example.com/claims"
     targetNamespace="http://www.insurance.example.com/claims"
     xsi:schemaLocation="http://www.example.org/WS-HT file:/usr/share/schemas/ws-humantask.xsd">
     
@@ -44,9 +45,7 @@ Business Machines Corporation, Oracle In
             <htd:documentation xml:lang="en-US">This task is used to handle claims
that require manual approval. </htd:documentation>
             <htd:interface portType="tns:ClaimsHandlingPT" operation="approve" responsePortType="tns:ClaimsResolvingPT"
responseOperation="resolve"/>
             <htd:priority> 
-				declare namespace cla="http://www.insurance.example.com/claims";
-				declare namespace htd="http://www.example.org/WS-HT";  
-				xs:integer(htd:getInput("ClaimApprovalRequest")/cla:prio)
+		xs:integer(htd:getInput("ClaimApprovalRequest")/cla:prio)
             </htd:priority>
             
 			<htd:autoActivate>true</htd:autoActivate>
@@ -115,20 +114,14 @@ Business Machines Corporation, Oracle In
                 <htd:presentationParameters>
                     
                     <htd:presentationParameter name="firstname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="lastname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
 </htd:presentationParameter>
                         
@@ -156,8 +149,6 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <expression>
                     <![CDATA[
                    
-                        declare namespace htd="http://www.example.org/WS-HT"; 
-                                      
                         <example name="anyname" xmlns:cla="http://www.insurance.example.com/claims">
                             <param name="type" value="{htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname/text()}"/>
                         </example>
@@ -182,8 +173,6 @@ xs:double(htd:getInput("ClaimApprovalReq
       
       	<htd:condition>
   			<![CDATA[
-				declare namespace cla="http://www.insurance.example.com/claims";
-				declare namespace htd="http://www.example.org/WS-HT";            
 				((htd:getInput("ClaimApprovalRequest")/cla:prio < 6 and htd:getInput("ClaimApprovalRequest")/cla:prio
> 4) 
 				or htd:getInput("ClaimApprovalRequest")/cla:prio = 10)
   			]]>
@@ -232,8 +221,6 @@ xs:double(htd:getInput("ClaimApprovalReq
       
       	<htd:condition>
   			<![CDATA[
-				declare namespace cla="http://www.insurance.example.com/claims";
-				declare namespace htd="http://www.example.org/WS-HT";  
 				htd:getInput("ClaimApprovalRequest")/cla:prio < 3
   			]]>
 	 	</htd:condition>
@@ -266,8 +253,6 @@ xs:double(htd:getInput("ClaimApprovalReq
             <htd:documentation xml:lang="en-US">This task is used to handle claims
that require manual approval. </htd:documentation>
             <htd:interface portType="tns:ClaimsHandlingPT" operation="approve2" responsePortType="tns:ClaimsHandlingCallbackPT"
responseOperation="approvalResponse"/>
             <htd:priority>
-                declare namespace cla="http://www.insurance.example.com/claims";
-				declare namespace htd="http://www.example.org/WS-HT";  
 				xs:integer(htd:getInput("ClaimApprovalRequest")/cla:prio)
             </htd:priority>
             
@@ -345,20 +330,14 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <htd:presentationParameters>
                     
                     <htd:presentationParameter name="firstname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
 </htd:presentationParameter>
 
                     <htd:presentationParameter name="lastname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
 </htd:presentationParameter>
 
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
 </htd:presentationParameter>
                         
@@ -414,20 +393,14 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <htd:presentationParameters>
                     
                     <htd:presentationParameter name="firstname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
 </htd:presentationParameter>
 
                     <htd:presentationParameter name="lastname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
 </htd:presentationParameter>
 
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
 </htd:presentationParameter>
                         
@@ -509,8 +482,6 @@ xs:double(htd:getInput("ClaimApprovalReq
             <htd:documentation xml:lang="en-US">This task is used to handle claims
that require manual approval. </htd:documentation>
             <htd:interface portType="tns:ClaimsHandlingPT" operation="approve" responsePortType="tns:ClaimsResolvingPT"
responseOperation="resolve"/>
             <htd:priority>
-                declare namespace cla="http://www.insurance.example.com/claims";
-				declare namespace htd="http://www.example.org/WS-HT";  
 				xs:integer(htd:getInput("ClaimApprovalRequest")/cla:prio)
             </htd:priority>
             
@@ -566,8 +537,6 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <htd:businessAdministrators>
                     <htd:from logicalPeopleGroup="regionEmployees">
                         <htd:argument name="region">
-                            declare namespace cla="http://www.insurance.example.com/claims";
-                            declare namespace htd="http://www.example.org/WS-HT";
                             xs:string(htd:getInput("ClaimApprovalRequest")/cla:region)
                         </htd:argument>
                     </htd:from>
@@ -596,20 +565,14 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <htd:presentationParameters>
                     
                     <htd:presentationParameter name="firstname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="lastname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
 </htd:presentationParameter>
                         
@@ -713,20 +676,14 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <htd:presentationParameters>
                     
                     <htd:presentationParameter name="firstname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="lastname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
 </htd:presentationParameter>
                         
@@ -753,8 +710,6 @@ xs:double(htd:getInput("ClaimApprovalReq
           <htd:documentation xml:lang="en-US">This task is used to handle claims that
require manual approval. </htd:documentation>
             <htd:interface portType="tns:ClaimsHandlingPT" operation="approve" responsePortType="tns:ClaimsResolvingPT"
responseOperation="resolve"/>
             <htd:priority> 
-                declare namespace cla="http://www.insurance.example.com/claims";
-				declare namespace htd="http://www.example.org/WS-HT";  
 				xs:integer(htd:getInput("ClaimApprovalRequest")/cla:prio)
             </htd:priority>
             
@@ -826,20 +781,14 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <htd:presentationParameters>
                     
                     <htd:presentationParameter name="firstname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="lastname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
 </htd:presentationParameter>
                         
@@ -867,8 +816,6 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <expression>
                     <![CDATA[
                    
-                        declare namespace htd="http://www.example.org/WS-HT"; 
-                                      
                         <example name="anyname" xmlns:cla="http://www.insurance.example.com/claims">
                             <param name="type" value="{htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname/text()}"/>
                         </example>
@@ -896,8 +843,6 @@ xs:double(htd:getInput("ClaimApprovalReq
             <htd:documentation xml:lang="en-US">This task is used to handle claims
that require manual approval. </htd:documentation>
             <htd:interface portType="tns:ClaimsHandlingPT" operation="approve" responsePortType="tns:ClaimsResolvingPT"
responseOperation="resolve"/>
             <htd:priority>
-                declare namespace cla="http://www.insurance.example.com/claims";
-				declare namespace htd="http://www.example.org/WS-HT";  
 				xs:integer(htd:getInput("ClaimApprovalRequest")/cla:prio)
             </htd:priority>
             
@@ -967,20 +912,14 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <htd:presentationParameters>
                     
                     <htd:presentationParameter name="firstname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="lastname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
 </htd:presentationParameter>
                         
@@ -1007,8 +946,6 @@ xs:double(htd:getInput("ClaimApprovalReq
             <htd:documentation xml:lang="en-US">This task is used to handle claims
that require manual approval. </htd:documentation>
             <htd:interface portType="tns:ClaimsHandlingPT" operation="approve" responsePortType="tns:ClaimsResolvingPT"
responseOperation="resolve"/>
             <htd:priority>
-                declare namespace cla="http://www.insurance.example.com/claims";
-				declare namespace htd="http://www.example.org/WS-HT";  
 				xs:integer(htd:getInput("ClaimApprovalRequest")/cla:prio)
             </htd:priority>
             
@@ -1083,20 +1020,14 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <htd:presentationParameters>
                     
                     <htd:presentationParameter name="firstname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="lastname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
 </htd:presentationParameter>
                         
@@ -1123,8 +1054,6 @@ xs:double(htd:getInput("ClaimApprovalReq
           <htd:documentation xml:lang="en-US">This task is used to handle claims that
require manual approval. </htd:documentation>
             <htd:interface portType="tns:ClaimsHandlingPT" operation="approve" responsePortType="tns:ClaimsResolvingPT"
responseOperation="resolve"/>
             <htd:priority> 
-                declare namespace cla="http://www.insurance.example.com/claims";
-				declare namespace htd="http://www.example.org/WS-HT";  
 				xs:integer(htd:getInput("ClaimApprovalRequest")/cla:prio)
             </htd:priority>
             
@@ -1196,20 +1125,14 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <htd:presentationParameters>
                     
                     <htd:presentationParameter name="firstname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="lastname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
 </htd:presentationParameter>
                         
@@ -1237,8 +1160,6 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <expression>
                     <![CDATA[
                    
-                        declare namespace htd="http://www.example.org/WS-HT"; 
-                                      
                         <example name="anyname" xmlns:cla="http://www.insurance.example.com/claims">
                             <param name="type" value="{htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname/text()}"/>
                         </example>
@@ -1324,8 +1245,6 @@ xs:double(htd:getInput("ClaimApprovalReq
           <htd:documentation xml:lang="en-US">This task is used to handle claims that
require manual approval. </htd:documentation>
             <htd:interface portType="tns:ClaimsHandlingPT" operation="approve" responsePortType="tns:ClaimsResolvingPT"
responseOperation="resolve"/>
             <htd:priority> 
-                declare namespace cla="http://www.insurance.example.com/claims";
-				declare namespace htd="http://www.example.org/WS-HT";  
 				xs:integer(htd:getInput("ClaimApprovalRequest")/cla:prio)
             </htd:priority>
             
@@ -1394,20 +1313,14 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <htd:presentationParameters>
                     
                     <htd:presentationParameter name="firstname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="lastname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
 </htd:presentationParameter>
                         
@@ -1478,8 +1391,6 @@ xs:double(htd:getInput("ClaimApprovalReq
           <htd:documentation xml:lang="en-US">This task is used to handle claims that
require manual approval. </htd:documentation>
             <htd:interface portType="tns:ClaimsHandlingPT" operation="approve" responsePortType="tns:ClaimsResolvingPT"
responseOperation="resolve"/>
             <htd:priority> 
-                declare namespace cla="http://www.insurance.example.com/claims";
-				declare namespace htd="http://www.example.org/WS-HT";  
 				xs:integer(htd:getInput("ClaimApprovalRequest")/cla:prio)
             </htd:priority>
             
@@ -1548,20 +1459,14 @@ xs:double(htd:getInput("ClaimApprovalReq
                 <htd:presentationParameters>
                     
                     <htd:presentationParameter name="firstname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="lastname" type="xsd:string">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
 </htd:presentationParameter>
                     
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-declare namespace cla="http://www.insurance.example.com/claims";
-declare namespace htd="http://www.example.org/WS-HT";
 xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
 </htd:presentationParameter>
                         



Mime
View raw message