incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r966641 [1/2] - in /incubator/hise/trunk: hise-services/src/main/java/org/apache/hise/dao/ hise-services/src/main/java/org/apache/hise/engine/ hise-services/src/main/java/org/apache/hise/engine/jaxws/ hise-services/src/main/java/org/apache/...
Date Thu, 22 Jul 2010 13:15:18 GMT
Author: rr
Date: Thu Jul 22 13:15:17 2010
New Revision: 966641

URL: http://svn.apache.org/viewvc?rev=966641&view=rev
Log:
HISE-51: Implement task delegation (Thanks to Michał Więcław)

Modified:
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/GenericHumanRole.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/Task.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/TaskChecker.java
    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/Task.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java
    incubator/hise/trunk/hise-test-example-osgi/src/main/resources/META-INF/spring/beans.xml
    incubator/hise/trunk/hise-test-example-osgi/src/main/resources/testHtd1.xml
    incubator/hise/trunk/itest/hise-soapui-project.xml

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/GenericHumanRole.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/GenericHumanRole.java?rev=966641&r1=966640&r2=966641&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/GenericHumanRole.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/GenericHumanRole.java Thu Jul 22 13:15:17 2010
@@ -31,5 +31,6 @@ public enum GenericHumanRole {
     EXCLUDEDOWNERS,
     BUSINESSADMINISTRATORS,
     TASKINITIATOR,
-    RECIPIENTS
+    RECIPIENTS,
+    POTENTIALDELEGATEES
 }

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/Task.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/Task.java?rev=966641&r1=966640&r2=966641&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/Task.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/Task.java Thu Jul 22 13:15:17 2010
@@ -20,6 +20,7 @@
 package org.apache.hise.dao;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -37,8 +38,11 @@ import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
 import javax.persistence.Lob;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
 import javax.persistence.MapKey;
 import javax.persistence.OneToMany;
 import javax.persistence.OneToOne;
@@ -48,6 +52,7 @@ import javax.xml.namespace.QName;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hise.dao.TaskOrgEntity.OrgEntityType;
 import org.springframework.beans.factory.annotation.Configurable;
 
 
@@ -181,6 +186,12 @@ public class Task extends JpaBase {
     private Status status;
 
     /**
+     * Defines to whom the task may be delegated 
+     */
+    @Enumerated(EnumType.STRING)
+    private PotentialDelegates potentialDelegates;
+    
+    /**
      * Previous status of SUSPENDED Task. When Task is resumed this
      * status is copied to the status field.
      */
@@ -242,7 +253,7 @@ public class Task extends JpaBase {
 //
   //  @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
    // @JoinTable(name = "TASK_BUSINESS_AMINISTRATORS", joinColumns = @JoinColumn(name = "TASK"), inverseJoinColumns = @JoinColumn(name = "ASSIGNEE"))
-    //private Set<TaskOrgEntity> businessAdministrators;
+   // private Set<TaskOrgEntity> businessAdministrators;
 //
 //    @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
 //    @JoinTable(name = "TASK_NOTIFICATION_RECIPIENTS", joinColumns = @JoinColumn(name = "TASK"), inverseJoinColumns = @JoinColumn(name = "ASSIGNEE"))
@@ -450,6 +461,12 @@ public class Task extends JpaBase {
         this.peopleAssignments = peopleAssignments;
     }
 
+    public void addPeopleAssignments(Set<TaskOrgEntity> peopleAssignments){
+    	for(TaskOrgEntity e: peopleAssignments){
+    		this.peopleAssignments.add(e);
+    	}
+    }
+    
     public List<Comment> getComments() {
         return comments;
     }
@@ -511,6 +528,15 @@ public class Task extends JpaBase {
     public Set<TaskOrgEntity> getPotentialOwners(){
     	return getFromPeopleAssignments(GenericHumanRole.POTENTIALOWNERS);
     }
+    
+    public void setPotentalDelegates(PotentialDelegates potentialDelegates){
+    	this.potentialDelegates = potentialDelegates;
+    }
+    
+    public PotentialDelegates getPotentialDelegates(){
+    	return potentialDelegates;
+    }
+    
     private Set<TaskOrgEntity> getFromPeopleAssignments(GenericHumanRole role){
         Set<TaskOrgEntity> result = new HashSet<TaskOrgEntity>();
         for(TaskOrgEntity e: peopleAssignments)

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/TaskChecker.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/TaskChecker.java?rev=966641&r1=966640&r2=966641&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/TaskChecker.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/TaskChecker.java Thu Jul 22 13:15:17 2010
@@ -66,10 +66,10 @@ public class TaskChecker {
 	 * 
 	 * @return true if is permission
 	 */
-	static public boolean checkPermission(TaskChecker.HumanOperationName operaionName, String userID, Task task, HISEEngineImpl engine)
+	static public boolean checkPermission(TaskChecker.HumanOperationName operaionName, String userID, Task task)
 	{
 		Collection<GenericHumanRole> humanRoles = new HashSet<GenericHumanRole>();
-		humanRoles = getGenericHumanRolesForTask(userID, task, engine);
+		humanRoles = task.getGenericHumanRolesForUser(userID);
 		
 		switch(operaionName){
 			//every group of operations have the same conditions to get permission 
@@ -81,7 +81,7 @@ public class TaskChecker {
 			case DELETE_OUTPUT:
 			case SET_FAULT:
 			case DELELE_FAULT:
-				if(isActualOwner(userID, task)) 
+				if(isActualOwner(humanRoles)) 
 					return true;
 				else return false;
 			
@@ -93,7 +93,7 @@ public class TaskChecker {
 				
 				//G3 conditions: user is ActualOwner or (is PotentalOwner and task's state is ready)
 			case START:
-				if(isActualOwner(userID, task) || isPotentialOwnersWithReadyState(humanRoles, task))
+				if(isActualOwner(humanRoles) || isPotentialOwnersWithReadyState(humanRoles, task))
 					return true;
 				else return false;
 				
@@ -105,7 +105,7 @@ public class TaskChecker {
 			case DELETE_ATTACHMENTS:
 			case GET_OUTPUT:
 			case GET_FAULT:
-				if(isActualOwner(userID, task) || isBusinessAdministrator(humanRoles) || isTaskStakeholders(humanRoles))
+				if(isActualOwner(humanRoles) || isBusinessAdministrator(humanRoles) || isTaskStakeholders(humanRoles))
 					return true;
 				else return false;
 				
@@ -114,7 +114,7 @@ public class TaskChecker {
 			case SUSPEND_UNTIL:
 			case RESUME:
 			case DELEGATE:
-				if(isPotentialOwnersWithReadyState(humanRoles, task) || isActualOwner(userID, task) ||
+				if(isPotentialOwnersWithReadyState(humanRoles, task) || isActualOwner(humanRoles) ||
 					isBusinessAdministrator(humanRoles) || isTaskStakeholders(humanRoles))
 						return true;
 				else return false;
@@ -126,14 +126,14 @@ public class TaskChecker {
 			case GET_COMMENTS:
 			case FORWARD:
 			case GET_INPUT:
-				if(isPotentialOwners(humanRoles) || isActualOwner(userID, task) ||
+				if(isPotentialOwners(humanRoles) || isActualOwner(humanRoles) ||
 					isBusinessAdministrator(humanRoles) || isTaskStakeholders(humanRoles))
 						return true;
 				else return false;
 				
 				//G7 conditions: user is TaskInitiator or ActualOwner or BusinessOwner or TaskStakeholders 
 			case SKIP:
-				if(isTaskInitiator(userID, task) || isActualOwner(userID, task) ||
+				if(isTaskInitiator(humanRoles) || isActualOwner(humanRoles) ||
 					isBusinessAdministrator(humanRoles) || isTaskStakeholders(humanRoles))
 						return true;
 				else return false;
@@ -163,39 +163,9 @@ public class TaskChecker {
 		return false;
 	}
 	
-	/**
-	 * Give list of user's GenericHumanRole for Task
-	 * 
-	 * @return list of user's GenericHumanRole
-	 */
-	static public Collection<GenericHumanRole> getGenericHumanRolesForTask(String userID, Task task, HISEEngineImpl engine)
+	static private boolean isActualOwner(Collection<GenericHumanRole> humanRoles)
 	{
-		Collection<GenericHumanRole> humanRoles = new HashSet<GenericHumanRole>();
-		HISEDao dao = engine.getHiseDao();
-		org.apache.hise.dao.OrgEntity user = dao.find(org.apache.hise.dao.OrgEntity.class, userID);
-		
-		Collection<String> userGrupsName = new HashSet<String>();
-		
-		for(OrgEntity i : user.getUserGroups()){
-			userGrupsName.add(i.getName());
-		}
-		
-		for(TaskOrgEntity i : task.getTaskDto().getPeopleAssignments()){
-			if((i.getType() == TaskOrgEntity.OrgEntityType.USER)&&(i.getName().equals(userID))){
-				humanRoles.add(i.getGenericHumanRole());
-			}
-			else if((i.getType() == TaskOrgEntity.OrgEntityType.GROUP)&&(userGrupsName.contains(i.getName()))){
-				humanRoles.add(i.getGenericHumanRole());
-			}
-		}
-		
-		return humanRoles;
-	}
-	
-	static private boolean isActualOwner(String userID, Task task)
-	{
-		String actualOwner = task.getTaskDto().getActualOwner();
-		if((actualOwner != null)&&(actualOwner.equals(userID))) 
+		if(humanRoles.contains(GenericHumanRole.ACTUALOWNER))
 			return true;
 		
 		return false;
@@ -234,13 +204,11 @@ public class TaskChecker {
 		return false;
 	}
 	
-	static private boolean isTaskInitiator(String userID, Task task)
+	static private boolean isTaskInitiator(Collection<GenericHumanRole> humanRoles)
 	{
-		String taskInitiator = task.getTaskDto().getCreatedBy();
-		if((taskInitiator != null)&&(taskInitiator.equals(userID)))
+		if(humanRoles.contains(GenericHumanRole.TASKINITIATOR))
 			return true;
 		
-		
 		return false;
 	}
 

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=966641&r1=966640&r2=966641&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 Jul 22 13:15:17 2010
@@ -25,6 +25,7 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 import java.util.Vector;
 
 import javax.jws.WebService;
@@ -158,7 +159,7 @@ public class TaskOperationsImpl implemen
      */
     public Object getInput(String identifier, String part) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_INPUT, getUserString(), t, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_INPUT, getUserString(), t))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         t.setCurrentUser(getUserString());
         return t.getInput(part);
@@ -169,7 +170,7 @@ public class TaskOperationsImpl implemen
      */
     public Object getOutput(String identifier, String part) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_OUTPUT, getUserString(), t, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_OUTPUT, getUserString(), t))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         t.setCurrentUser(getUserString());
         return t.getOutput(part);
@@ -180,7 +181,7 @@ public class TaskOperationsImpl implemen
      */
     public void stop(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.STOP, getUserString(), t, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.STOP, getUserString(), t))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         t.setCurrentUser(getUserString());
         
@@ -193,7 +194,7 @@ public class TaskOperationsImpl implemen
 
     public void suspend(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SUSPEND, getUserString(), t, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SUSPEND, getUserString(), t))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         t.setCurrentUser(getUserString());
         
@@ -206,7 +207,7 @@ public class TaskOperationsImpl implemen
 
     public void suspendUntil(String identifier, TTime time) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SUSPEND_UNTIL, getUserString(), t, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SUSPEND_UNTIL, getUserString(), t))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         t.setCurrentUser(getUserString());
         Date when = time.getPointOfTime();
@@ -225,7 +226,7 @@ public class TaskOperationsImpl implemen
 
     public void remove(String identifier) throws IllegalAccessFault, IllegalArgumentFault {
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.REMOVE, getUserString(), t, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.REMOVE, getUserString(), t))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         t.setCurrentUser(getUserString());
         t.remove();
@@ -234,7 +235,7 @@ public class TaskOperationsImpl implemen
     public void resume(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         // OrgEntity user = loadUser();
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.RESUME, getUserString(), t, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.RESUME, getUserString(), t))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         t.setCurrentUser(getUserString());
         
@@ -251,7 +252,7 @@ public class TaskOperationsImpl implemen
 
     public void claim(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
         Task task = Task.load(hiseEngine, Long.valueOf(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.CLAIM, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.CLAIM, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         task.setCurrentUser(getUserString());
         
@@ -267,7 +268,7 @@ public class TaskOperationsImpl implemen
     public void fail(String identifier, String faultName, Object faultData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault,
             IllegalOperationFault {
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.FAIL, getUserString(), t, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.FAIL, getUserString(), t))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         t.setCurrentUser(getUserString());
         
@@ -281,7 +282,7 @@ public class TaskOperationsImpl implemen
     public void forward(String identifier, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.FORWARD, getUserString(), t, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.FORWARD, getUserString(), t))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         t.setCurrentUser(getUserString());
         
@@ -300,7 +301,7 @@ public class TaskOperationsImpl implemen
 
     public void release(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.RELEASE, getUserString(), t, hiseEngine))) {
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.RELEASE, getUserString(), t))) {
         	throw new IllegalAccessFault("Illegal access to operations");
         }
         t.setCurrentUser(getUserString());
@@ -314,7 +315,7 @@ public class TaskOperationsImpl implemen
 
     public void start(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.START, getUserString(), t, hiseEngine))) {
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.START, getUserString(), t))) {
         	throw new IllegalAccessFault("Illegal access to operations");
         }
         t.setCurrentUser(getUserString());
@@ -328,7 +329,7 @@ public class TaskOperationsImpl implemen
 
     public void complete(String identifier, Object taskData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.COMPLETE, getUserString(), t, hiseEngine))) {
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.COMPLETE, getUserString(), t))) {
         	throw new IllegalAccessFault("Illegal access to operations");
         }
         t.setCurrentUser(getUserString());
@@ -344,7 +345,7 @@ public class TaskOperationsImpl implemen
 
     public void setOutput(String identifier, String part, Object taskData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         Task t = Task.load(hiseEngine, Long.valueOf(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SET_OUTPUT, getUserString(), t, hiseEngine))) {
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SET_OUTPUT, getUserString(), t))) {
         	throw new IllegalAccessFault("Illegal access to operations");
         }
         t.setCurrentUser(getUserString());
@@ -362,7 +363,7 @@ public class TaskOperationsImpl implemen
 	 */
 	public void addComment(String identifier, String text) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
 		Task task = Task.load(hiseEngine, new Long(identifier));
-		if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.ADD_COMMENT, getUserString(), task, hiseEngine))) { 
+		if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.ADD_COMMENT, getUserString(), task))) { 
         	throw new IllegalAccessFault("Illegal access to operations");
 		}
 		org.apache.hise.dao.Task taskDto = task.getTaskDto();
@@ -381,7 +382,7 @@ public class TaskOperationsImpl implemen
 	 */
     public List<TComment> getComments(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_COMMENTS, getUserString(), task, hiseEngine))) {
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_COMMENTS, getUserString(), task))) {
         	throw new IllegalAccessFault("Illegal access to operations");
         }
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
@@ -399,7 +400,7 @@ public class TaskOperationsImpl implemen
 
     public void activate(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
     	Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.ACTIVATE, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.ACTIVATE, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         // TODO Auto-generated method stub
 
@@ -409,7 +410,7 @@ public class TaskOperationsImpl implemen
             IllegalArgumentFault {
 
         Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.ADD_ATTACHMENT, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.ADD_ATTACHMENT, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         org.apache.hise.dao.Attachment newAttachment= new Attachment();
@@ -433,14 +434,33 @@ public class TaskOperationsImpl implemen
             IllegalArgumentFault {
 
         Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.DELEGATE, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.DELEGATE, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
+        
+        String userID = task.checkCanDelegate(organizationalEntity);
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
+        
+        try {
+			task.setActualOwner(userID);
+		} catch (HiseIllegalStateException e) {
+			throw new IllegalStateFault();
+		}
+		
+		if(!(task.getGenericHumanRolesForUser(userID).contains(GenericHumanRole.POTENTIALOWNERS))){
+        	Set<TaskOrgEntity> peopeAssignments = taskDto.getPeopleAssignments();
+        	TaskOrgEntity taskOrgEntity = new TaskOrgEntity();
+        	taskOrgEntity.setGenericHumanRole(GenericHumanRole.POTENTIALOWNERS);
+        	taskOrgEntity.setName(userID);
+        	taskOrgEntity.setType(OrgEntityType.USER);
+        	taskOrgEntity.setTask(task.getTaskDto());
+        	peopeAssignments.add(taskOrgEntity);
+        	taskDto.setPeopleAssignments(peopeAssignments);
+        }
     }
 
     public void deleteAttachments(String identifier, String attachmentName) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.DELETE_ATTACHMENTS, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.DELETE_ATTACHMENTS, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         List<Attachment> attachments=taskDto.getAttachments();
@@ -464,7 +484,7 @@ public class TaskOperationsImpl implemen
 
     public void deleteFault(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
     	Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.DELELE_FAULT, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.DELELE_FAULT, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         
         // TODO Auto-generated method stub
@@ -473,7 +493,7 @@ public class TaskOperationsImpl implemen
 
     public void deleteOutput(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
     	Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.DELETE_OUTPUT, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.DELETE_OUTPUT, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         
         // TODO Auto-generated method stub
@@ -483,7 +503,7 @@ public class TaskOperationsImpl implemen
     public List<TAttachmentInfo> getAttachmentInfos(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
 
         Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_ATTACHMENT_INFOS, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_ATTACHMENT_INFOS, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         List<Attachment> attachments=taskDto.getAttachments();
@@ -502,7 +522,7 @@ public class TaskOperationsImpl implemen
     public List<TAttachment> getAttachments(String identifier, String attachmentName) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
 
         Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_ATTACHMENTS, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_ATTACHMENTS, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         List<Attachment> attachments=taskDto.getAttachments();
@@ -609,7 +629,7 @@ public class TaskOperationsImpl implemen
 
     public void nominate(String identifier, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.NOMINATE, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.NOMINATE, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         if(taskDto.getStatus()==Status.CREATED){
@@ -624,7 +644,7 @@ public class TaskOperationsImpl implemen
     public void setFault(String identifier, String faultName, Object faultData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault,
             IllegalOperationFault {
     	Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SET_FAULT, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SET_FAULT, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
     	
         // TODO Auto-generated method stub
@@ -634,7 +654,7 @@ public class TaskOperationsImpl implemen
     public void setGenericHumanRole(String identifier, String genericHumanRole, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault,
             IllegalStateFault, IllegalArgumentFault {
     	Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SET_GENERIC_HUMAN_ROLE, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SET_GENERIC_HUMAN_ROLE, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
     	
         // TODO Auto-generated method stub
@@ -643,7 +663,7 @@ public class TaskOperationsImpl implemen
 
     public void setPriority(String identifier, BigInteger priority) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
         Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SET_PRIORITY, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SET_PRIORITY, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         taskDto.setPriority(priority.intValue());
@@ -655,7 +675,7 @@ public class TaskOperationsImpl implemen
     			IllegalAccessFault, IllegalStateFault, IllegalArgumentFault, 
     				IllegalOperationFault {
         Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SKIP, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SKIP, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         if(taskDto.isSkippable()){
@@ -671,7 +691,7 @@ public class TaskOperationsImpl implemen
     public void getFault(String identifier, Holder<String> faultName, Holder<Object> faultData) throws IllegalArgumentFault, IllegalStateFault,
             IllegalOperationFault, IllegalAccessFault {
     	Task task = Task.load(hiseEngine, new Long(identifier));
-        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_FAULT, getUserString(), task, hiseEngine))) 
+        if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.GET_FAULT, getUserString(), task))) 
         	throw new IllegalAccessFault("Illegal access to operations");
     	
         // TODO Auto-generated method stub

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=966641&r1=966640&r2=966641&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 Jul 22 13:15:17 2010
@@ -30,10 +30,12 @@ import org.apache.commons.lang.Validate;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hise.lang.xsd.htd.TDeadlines;
+import org.apache.hise.lang.xsd.htd.TDelegation;
 import org.apache.hise.lang.xsd.htd.TFrom;
 import org.apache.hise.lang.xsd.htd.TLiteral;
 import org.apache.hise.lang.xsd.htd.TNotification;
 import org.apache.hise.lang.xsd.htd.TPeopleAssignments;
+import org.apache.hise.lang.xsd.htd.TPotentialDelegatees;
 import org.apache.hise.lang.xsd.htd.TPresentationElements;
 import org.apache.hise.lang.xsd.htd.TPresentationParameters;
 import org.apache.hise.lang.xsd.htd.TPriority;
@@ -380,5 +382,8 @@ public class TaskDefinition {
 	public TRenderings getRenderings() {
 		return tTask.getRenderings();
 	}
+	public TDelegation getDelegation(){
+		return tTask.getDelegation();
+	}
    
 }

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/Task.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/Task.java?rev=966641&r1=966640&r2=966641&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/Task.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/Task.java Thu Jul 22 13:15:17 2010
@@ -21,6 +21,7 @@ package org.apache.hise.runtime;
 
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -41,14 +42,19 @@ import javax.xml.xpath.XPathFactory;
 import org.apache.commons.lang.Validate;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hise.api.PeopleQueryProvider;
 import org.apache.hise.dao.GenericHumanRole;
 import org.apache.hise.dao.HISEDao;
 import org.apache.hise.dao.Job;
 import org.apache.hise.dao.Message;
+import org.apache.hise.dao.OrgEntity;
+import org.apache.hise.dao.PotentialDelegates;
 import org.apache.hise.dao.TaskOrgEntity;
 import org.apache.hise.dao.Task.Status;
 import org.apache.hise.dao.TaskOrgEntity.OrgEntityType;
 import org.apache.hise.engine.HISEEngineImpl;
+import org.apache.hise.engine.wsdl.IllegalStateFault;
+import org.apache.hise.engine.wsdl.RecipientNotAllowed;
 import org.apache.hise.lang.TaskDefinition;
 import org.apache.hise.lang.xsd.htd.TGrouplist;
 import org.apache.hise.lang.xsd.htd.TOrganizationalEntity;
@@ -213,6 +219,11 @@ public class Task {
         taskDto.setSkippable(true);
         t.taskDto = taskDto;
         taskDto.setPeopleAssignments(t.getTaskEvaluator().evaluatePeopleAssignments());
+        taskDto.setPotentalDelegates(t.getTaskEvaluator().evaluatePotentialDelegates());
+        if(taskDto.getPotentialDelegates().equals(PotentialDelegates.OTHER)){
+        	taskDto.addPeopleAssignments(t.getTaskEvaluator().evaluatePeopleDelegated());
+        }
+        
         Vector<TaskOrgEntity> temp=new Vector<TaskOrgEntity>(taskDto.getPeopleAssignments());
         int k=temp.size();
         engine.getHiseDao().persist(taskDto);
@@ -380,6 +391,49 @@ public class Task {
         return taskDefinition;
     }
 
+    /**
+     * Checks if the task can be delegated. Throws exception if it can't.
+     * 
+     * @return user name (ID)
+     */
+     public String checkCanDelegate(TOrganizationalEntity delegatee) throws RecipientNotAllowed, IllegalStateFault {
+         
+    	 Status taskStatus = taskDto.getStatus();
+    	 
+    	 if (!(taskStatus.equals(Status.READY) ||  taskStatus.equals(Status.RESERVED) || taskStatus.equals(Status.IN_PROGRESS))){
+    		 throw new IllegalStateFault("Only active tasks can be delegated.");
+    	 }
+    	 
+    	 List<String> userList = delegatee.getUsers().getUser();
+    	 if(userList.size() != 1){
+    		 throw new RecipientNotAllowed("Only one user can by delegated to the task");
+    	 }
+    	 String userID = userList.get(0);
+    	 OrgEntity user = hiseEngine.getHiseDao().find(org.apache.hise.dao.OrgEntity.class, userID);
+    	 if(user == null){
+    		 throw new RecipientNotAllowed("Can't delegate. The user is unknown");
+    	 }
+    	  
+    	 switch(taskDto.getPotentialDelegates()){
+    	 	case ANYBODY:
+    	 		break;
+    	 	case POTENTIAL_OWNERS:
+    	 		if(!(getGenericHumanRolesForUser(userID).contains(GenericHumanRole.POTENTIALOWNERS))){
+    	 				throw new RecipientNotAllowed("Only PotentialOwners can be delegate to this task");
+    	 		}
+    	 		break;
+    	 	case OTHER:
+    	 		Collection<GenericHumanRole> role = this.getGenericHumanRolesForUser(userID);
+    	 		if(!(role.contains(GenericHumanRole.POTENTIALDELEGATEES))){
+    	 			throw new RecipientNotAllowed("Can't delegate. The user is not authorised to this operation");
+    	 		}
+    	 		break;
+    	 	case NOBODY:
+    	 		throw new RecipientNotAllowed("Nobody can be delegated to this task");
+    	 }    
+    	 return userID;
+     }
+    
     // /**
     // * If there is only one person in the given list, it
     // * returns this person. Otherwise, it returns null.
@@ -1241,4 +1295,41 @@ public class Task {
     public Node getOutput(String part) {
         return DOMUtils.parse(taskDto.getOutput().get(part).getMessage()).getDocumentElement();
     }
+    
+    /**
+	 * Give list of user's GenericHumanRole for Task
+	 * 
+	 * @return list of user's GenericHumanRole
+	 */
+    public Collection<GenericHumanRole> getGenericHumanRolesForUser(String userID)
+	{
+		Collection<GenericHumanRole> humanRoles = new HashSet<GenericHumanRole>();
+		org.apache.hise.dao.OrgEntity user = hiseEngine.getHiseDao().find(org.apache.hise.dao.OrgEntity.class, userID);
+		if(user == null) return humanRoles;
+		
+		Collection<String> userGrupsName = new HashSet<String>();
+		
+		for(OrgEntity i : user.getUserGroups()){
+			userGrupsName.add(i.getName());
+		}
+		
+		for(TaskOrgEntity i : taskDto.getPeopleAssignments()){
+			if((i.getType() == TaskOrgEntity.OrgEntityType.USER)&&(i.getName().equals(userID))){
+				humanRoles.add(i.getGenericHumanRole());
+			}
+			else if((i.getType() == TaskOrgEntity.OrgEntityType.GROUP)&&(userGrupsName.contains(i.getName()))){
+				humanRoles.add(i.getGenericHumanRole());
+			}
+		}
+		
+		if(userID.equals(taskDto.getActualOwner())){
+			humanRoles.add(GenericHumanRole.ACTUALOWNER);
+		}
+		if(userID.equals(taskDto.getCreatedBy())){
+			humanRoles.add(GenericHumanRole.TASKINITIATOR);
+		}
+		
+		return humanRoles;
+	}
+    
 }

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=966641&r1=966640&r2=966641&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 Jul 22 13:15:17 2010
@@ -37,8 +37,11 @@ import org.apache.hise.api.PeopleQueryPr
 import org.apache.hise.api.PeopleQueryProvider.QueryRecord;
 import org.apache.hise.api.PeopleQueryProvider.RecordType;
 import org.apache.hise.dao.GenericHumanRole;
+import org.apache.hise.dao.OrgEntity;
+import org.apache.hise.dao.PotentialDelegates;
 import org.apache.hise.dao.TaskOrgEntity;
 import org.apache.hise.dao.TaskOrgEntity.OrgEntityType;
+import org.apache.hise.engine.wsdl.IllegalStateFault;
 import org.apache.hise.lang.xsd.htd.TDeadline;
 import org.apache.hise.lang.xsd.htd.TDeadlines;
 import org.apache.hise.lang.xsd.htd.TEscalation;
@@ -46,6 +49,7 @@ import org.apache.hise.lang.xsd.htd.TExp
 import org.apache.hise.lang.xsd.htd.TFrom;
 import org.apache.hise.lang.xsd.htd.TGenericHumanRole;
 import org.apache.hise.lang.xsd.htd.TPeopleAssignments;
+import org.apache.hise.lang.xsd.htd.TPotentialDelegatees;
 import org.apache.hise.lang.xsd.htd.TPresentationParameter;
 import org.apache.hise.lang.xsd.htd.TToPart;
 import org.apache.hise.lang.xsd.htd.TToParts;
@@ -120,6 +124,50 @@ public class TaskEvaluator {
        
         return result;
     }
+    
+    public PotentialDelegates evaluatePotentialDelegates(){
+    		TPotentialDelegatees p = task.getTaskDefinition().getDelegation().getPotentialDelegatees();
+    		return PotentialDelegates.mapFromTPotentalDelegates(p);	
+    }
+    
+    
+    public Set<TaskOrgEntity> evaluatePeopleDelegated(){
+    	TFrom from = task.getTaskDefinition().getDelegation().getFrom();
+    	QName name = from.getLogicalPeopleGroup();
+    	Set<TaskOrgEntity> result = new HashSet<TaskOrgEntity>();
+    	
+    	if(name != null){
+    		TaskOrgEntity x = new TaskOrgEntity();
+            x.setGenericHumanRole(GenericHumanRole.POTENTIALDELEGATEES);
+            x.setName(name.toString());
+            x.setType(OrgEntityType.USER);
+            x.setTask(task.getTaskDto());
+            result.add(x);
+    	}
+    	else{
+    		Element literal = DOMUtils.findElement(QName.valueOf("{http://www.example.org/WS-HT}literal"), from.getContent());
+    		
+    		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)) { 
+                	TaskOrgEntity x = new TaskOrgEntity();
+                    x.setGenericHumanRole(GenericHumanRole.POTENTIALDELEGATEES);
+                    x.setName(user);
+                    x.setType(OrgEntityType.USER);
+                    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)) {  
+                	TaskOrgEntity x = new TaskOrgEntity();
+                    x.setGenericHumanRole(GenericHumanRole.POTENTIALDELEGATEES);
+                    x.setName(group);
+                    x.setType(OrgEntityType.GROUP);
+                    x.setTask(task.getTaskDto());
+                    result.add(x);
+                }
+    		}
+    	}
+    	return result;
+    }
 
     public Set<TaskOrgEntity> evaluateGenericHumanRole(TGenericHumanRole role, GenericHumanRole assignmentRole) {
         Set<TaskOrgEntity> result = new HashSet<TaskOrgEntity>();

Modified: incubator/hise/trunk/hise-test-example-osgi/src/main/resources/META-INF/spring/beans.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-test-example-osgi/src/main/resources/META-INF/spring/beans.xml?rev=966641&r1=966640&r2=966641&view=diff
==============================================================================
--- incubator/hise/trunk/hise-test-example-osgi/src/main/resources/META-INF/spring/beans.xml (original)
+++ incubator/hise/trunk/hise-test-example-osgi/src/main/resources/META-INF/spring/beans.xml Thu Jul 22 13:15:17 2010
@@ -46,6 +46,7 @@ xsi:schemaLocation="
               <property name="sender" ref="hiseJaxWSSender2"/>
             </bean>
             
+            
             <bean class="org.apache.hise.engine.store.TaskDD">
               <property name="taskName">
                 <bean class="javax.xml.namespace.QName" factory-method="valueOf">
@@ -59,6 +60,26 @@ xsi:schemaLocation="
             <bean class="org.apache.hise.engine.store.TaskDD">
               <property name="taskName">
                 <bean class="javax.xml.namespace.QName" factory-method="valueOf">
+                  <constructor-arg type="java.lang.String" value="{http://www.insurance.example.com/claims}Task7"></constructor-arg>
+                </bean>
+              </property>
+              <property name="handler" ref="hiseJaxWSService7"/>
+              <property name="sender" ref="hiseJaxWSSender7"/>
+            </bean>
+            
+            <bean class="org.apache.hise.engine.store.TaskDD">
+              <property name="taskName">
+                <bean class="javax.xml.namespace.QName" factory-method="valueOf">
+                  <constructor-arg type="java.lang.String" value="{http://www.insurance.example.com/claims}Task8"></constructor-arg>
+                </bean>
+              </property>
+              <property name="handler" ref="hiseJaxWSService8"/>
+              <property name="sender" ref="hiseJaxWSSender8"/>
+            </bean>
+            
+            <bean class="org.apache.hise.engine.store.TaskDD">
+              <property name="taskName">
+                <bean class="javax.xml.namespace.QName" factory-method="valueOf">
                   <constructor-arg type="java.lang.String" value="{http://www.insurance.example.com/claims}Notify2"></constructor-arg>
                 </bean>
               </property>
@@ -128,5 +149,39 @@ xsi:schemaLocation="
     </property>
   </bean>
 
+ <bean id="hiseJaxWSService7" class="org.apache.hise.engine.jaxws.HISEJaxWSService" init-method="init">
+    <!--property name="id" value="hiseJaxWSService7"/-->
+    <property name="hiseEngine" ref="hiseEngine"/>
+    <property name="transactionManager" ref="transactionManager"></property>
+  </bean>
+
+  <jaxws:endpoint id="testHtd7" address="/ClaimsHandlingService7/" implementor="#hiseJaxWSService7" serviceName="ins:ClaimsHandlingService" endpointName="ins:ClaimsHandlingPort" publish="true" wsdlLocation="classpath:ExampleTasks.wsdl"/>
+
+  <bean id="hiseJaxWSSender7" class="org.apache.hise.engine.jaxws.HISEJaxWSClient" init-method="init">
+    <property name="wsdlDocumentLocation" value="classpath:ExampleTasks.wsdl"></property>
+    <property name="serviceName">
+      <bean class="javax.xml.namespace.QName" factory-method="valueOf">
+        <constructor-arg type="java.lang.String" value="{http://www.insurance.example.com/claims}ClaimsResolvingService"></constructor-arg>
+      </bean>
+    </property>
+  </bean>
+  
+   <bean id="hiseJaxWSService8" class="org.apache.hise.engine.jaxws.HISEJaxWSService" init-method="init">
+    <!--property name="id" value="hiseJaxWSService8"/-->
+    <property name="hiseEngine" ref="hiseEngine"/>
+    <property name="transactionManager" ref="transactionManager"></property>
+  </bean>
+
+  <jaxws:endpoint id="testHtd8" address="/ClaimsHandlingService8/" implementor="#hiseJaxWSService8" serviceName="ins:ClaimsHandlingService" endpointName="ins:ClaimsHandlingPort" publish="true" wsdlLocation="classpath:ExampleTasks.wsdl"/>
+
+  <bean id="hiseJaxWSSender8" class="org.apache.hise.engine.jaxws.HISEJaxWSClient" init-method="init">
+    <property name="wsdlDocumentLocation" value="classpath:ExampleTasks.wsdl"></property>
+    <property name="serviceName">
+      <bean class="javax.xml.namespace.QName" factory-method="valueOf">
+        <constructor-arg type="java.lang.String" value="{http://www.insurance.example.com/claims}ClaimsResolvingService"></constructor-arg>
+      </bean>
+    </property>
+  </bean>
+
 </beans>    
 

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=966641&r1=966640&r2=966641&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 Jul 22 13:15:17 2010
@@ -305,7 +305,7 @@ xs:double(htd:getInput("ClaimApprovalReq
                 
             </htd:peopleAssignments>
             
-            <htd:delegation potentialDelegatees="nobody"/>
+            <htd:delegation potentialDelegatees="abody"/>
             
             <htd:presentationElements>
                 
@@ -548,7 +548,7 @@ xs:double(htd:getInput("ClaimApprovalReq
                 
             </htd:peopleAssignments>
             
-            <htd:delegation potentialDelegatees="nobody"/>
+            <htd:delegation potentialDelegatees="potentialOwners"/>
             
             <htd:presentationElements>
                 
@@ -664,7 +664,233 @@ xs:double(htd:getInput("ClaimApprovalReq
                 </htd:recipients>
                 
             </htd:peopleAssignments>
+              
+            <htd:delegation potentialDelegatees="anybody"/>
             
+            <htd:presentationElements>
+                
+                <htd:name xml:lang="en-US"> Approve Claim </htd:name>
+                
+                <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>
+                        
+                </htd:presentationParameters>
+                
+                <htd:subject xml:lang="en-US"> Approve the insurance claim for PLN {$euroAmount} on behalf of {$firstname} {$lastname} </htd:subject>
+
+                <htd:description xml:lang="en-US" contentType="text/plain"> Approve this claim following corporate guideline #4711.0815/7 for {$firstname} {$lastname} </htd:description>
+
+            </htd:presentationElements>
+            
+            <htd:outcome>
+                <![CDATA[
+                  <cla:resolve xmlns:cla="http://www.insurance.example.com/claims" xmlns:htd="http://www.example.org/WS-HT">
+                     <claimId>{htd:getInput("ClaimApprovalRequest")/cla:cust/cla:id/text()}</claimId>
+                     <ok>{$outcome}</ok>
+                  </cla:resolve>
+                ]]>
+            </htd:outcome>
+        </htd:task>   
+ 
+ 
+ 		<htd:task name="Task7">
+            
+            <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";
+                htd:getInput("ClaimApprovalRequest")/cla:priority
+            </htd:priority>
+            
+            <htd:peopleAssignments>
+                
+                <htd:businessAdministrators>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:groups>
+                                <htd:group>group4</htd:group>
+                            </htd:groups>
+                            <htd:users>
+                                <htd:user>user5</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:businessAdministrators>
+                
+            	<htd:taskStakeholders>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user6</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:taskStakeholders>
+                
+                
+                <htd:recipients>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user4</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:recipients>
+                
+            </htd:peopleAssignments>
+              
+            <htd:delegation potentialDelegatees="other">
+ 				<htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:groups>
+                                <htd:group>group4</htd:group>
+                            </htd:groups>
+                            <htd:users>
+                                <htd:user>user2</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                </htd:from>
+            </htd:delegation>
+            
+            <htd:presentationElements>
+                
+                <htd:name xml:lang="en-US"> Approve Claim </htd:name>
+                
+                <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>
+                        
+                </htd:presentationParameters>
+                
+                <htd:subject xml:lang="en-US"> Approve the insurance claim for PLN {$euroAmount} on behalf of {$firstname} {$lastname} </htd:subject>
+
+                <htd:description xml:lang="en-US" contentType="text/plain"> Approve this claim following corporate guideline #4711.0815/7 for {$firstname} {$lastname} </htd:description>
+
+            </htd:presentationElements>
+            
+            <htd:outcome>
+                <![CDATA[
+                  <cla:resolve xmlns:cla="http://www.insurance.example.com/claims" xmlns:htd="http://www.example.org/WS-HT">
+                     <claimId>{htd:getInput("ClaimApprovalRequest")/cla:cust/cla:id/text()}</claimId>
+                     <ok>{$outcome}</ok>
+                  </cla:resolve>
+                ]]>
+            </htd:outcome>
+        </htd:task>   
+        
+        <htd:task name="Task8">
+            
+            <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";
+                htd:getInput("ClaimApprovalRequest")/cla:priority
+            </htd:priority>
+            
+            <htd:peopleAssignments>
+                
+                <htd:potentialOwners>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:groups>
+                                <htd:group>group3</htd:group>
+                            </htd:groups>
+                            <htd:users>
+                                <htd:user>user1</htd:user>
+                                <htd:user>user2</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:potentialOwners>
+                
+                <htd:businessAdministrators>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:groups>
+                                <htd:group>group4</htd:group>
+                            </htd:groups>
+                            <htd:users>
+                                <htd:user>user5</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:businessAdministrators>
+                
+            	<htd:taskStakeholders>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user6</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:taskStakeholders>
+                
+                
+                <htd:recipients>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user4</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:recipients>
+                
+            </htd:peopleAssignments>
+              
             <htd:delegation potentialDelegatees="nobody"/>
             
             <htd:presentationElements>
@@ -708,7 +934,6 @@ xs:double(htd:getInput("ClaimApprovalReq
                 ]]>
             </htd:outcome>
         </htd:task>   
- 
 </htd:tasks> 
     
     <htd:notifications>



Mime
View raw message