incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r988122 - in /incubator/hise/trunk: hise-bundle/src/main/resources/META-INF/spring/ hise-services/src/main/java/org/apache/hise/api/ hise-services/src/main/java/org/apache/hise/engine/ hise-services/src/main/java/org/apache/hise/engine/jaxw...
Date Mon, 23 Aug 2010 13:52:34 GMT
Author: rr
Date: Mon Aug 23 13:52:33 2010
New Revision: 988122

URL: http://svn.apache.org/viewvc?rev=988122&view=rev
Log:
HISE-63: Management API exposed as OSGI service (Thanks to PaweĊ‚ Byszewski)

Added:
    incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/TaskLifecycleTest.java
Modified:
    incubator/hise/trunk/hise-bundle/src/main/resources/META-INF/spring/hise.xml
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/api/Management.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/ManagementImpl.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/TaskOperationsAdministrativeImpl.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java
    incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestImpl.java
    incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/ManagementApiTest.java
    incubator/hise/trunk/rtests/src/test/resources/hise-ctx.xml

Modified: incubator/hise/trunk/hise-bundle/src/main/resources/META-INF/spring/hise.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-bundle/src/main/resources/META-INF/spring/hise.xml?rev=988122&r1=988121&r2=988122&view=diff
==============================================================================
--- incubator/hise/trunk/hise-bundle/src/main/resources/META-INF/spring/hise.xml (original)
+++ incubator/hise/trunk/hise-bundle/src/main/resources/META-INF/spring/hise.xml Mon Aug 23
13:52:33 2010
@@ -100,10 +100,12 @@
 
   <bean id="taskOperationsAdministrative" class="org.apache.hise.engine.jaxws.TaskOperationsAdministrativeImpl">
     <property name="hiseEngine" ref="hiseEngine"/>
+    <property name="administrationMode" value="true"/>
   </bean>
 
   <bean name="taskOperations" class="org.apache.hise.engine.jaxws.TaskOperationsImpl"
init-method="init">
     <property name="hiseEngine" ref="hiseEngine"/>
+        <property name="administrationMode" value="false"/>
   </bean>
 
   <jaxws:endpoint id="taskOperationsEndpoint" name="taskOperationsEndpoint" address="/taskOperations/"
implementor="#taskOperations" serviceName="htdaw:taskOperations" publish="true" wsdlLocation="classpath:ws-humantask.wsdl">

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/api/Management.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/api/Management.java?rev=988122&r1=988121&r2=988122&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/api/Management.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/api/Management.java Mon
Aug 23 13:52:33 2010
@@ -69,8 +69,8 @@ public interface Management {
 	 
 	 public HISEDao getHiseDao();
 	 
-	 public void delegate(String identifier, TOrganizationalEntity organizationalEntity) throws
RecipientNotAllowed, IllegalStateFault;
-	 public void delegate(String identifier, List<String> usersList, List<String>
groupsList) throws RecipientNotAllowed, IllegalStateFault;
+	 public void delegate(String identifier, TOrganizationalEntity organizationalEntity, String
name) throws RecipientNotAllowed, IllegalStateFault;
+	 public void delegate(String identifier, List<String> usersList, List<String>
groupsList, String name) throws RecipientNotAllowed, IllegalStateFault;
 	 
 	 public StartResponseDocument start(StartDocument start, String userName) throws IllegalArgumentFault,
IllegalStateFault, IllegalAccessFault;
 	 public StartResponseDocument start(String taskIdentifier, String name) throws IllegalArgumentFault,
IllegalStateFault, IllegalAccessFault;

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/ManagementImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/ManagementImpl.java?rev=988122&r1=988121&r2=988122&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/ManagementImpl.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/ManagementImpl.java
Mon Aug 23 13:52:33 2010
@@ -153,12 +153,13 @@ public class ManagementImpl implements M
 	}
 
 	public void delegate(String identifier,
-			TOrganizationalEntity organizationalEntity) throws RecipientNotAllowed, IllegalStateFault
{
-        Task task = Task.load((HISEEngineImpl) hiseEngine, new Long(identifier));       

+			TOrganizationalEntity organizationalEntity, String name) throws RecipientNotAllowed, IllegalStateFault
{
+        Task task = Task.load((HISEEngineImpl) hiseEngine, new Long(identifier));  
         String userID = task.checkCanDelegate(organizationalEntity);
-        task.setCurrentUser("administrator");
+        adminOperations.setUserName(name);
         
         try {
+        	 task.setCurrentUser(adminOperations.getUser());
 			task.setActualOwner(userID);
 			task.addGenericHumanRole(userID, GenericHumanRole.POTENTIALOWNERS);
 		} catch (HiseIllegalStateException e) {
@@ -166,7 +167,7 @@ public class ManagementImpl implements M
 		}
 		
 	}
-	public void delegate(String identifier, List<String> usersList, List<String>
groupsList) throws RecipientNotAllowed, IllegalStateFault{
+	public void delegate(String identifier, List<String> usersList, List<String>
groupsList,  String userName) throws RecipientNotAllowed, IllegalStateFault{
 		TOrganizationalEntity tOrganizational = TOrganizationalEntity.Factory.newInstance();
         
 		TUserlist users=TUserlist.Factory.newInstance();
@@ -180,7 +181,7 @@ public class ManagementImpl implements M
         tOrganizational.setGroups(groups);
         tOrganizational.setUsers(users);
         
-        delegate(identifier, tOrganizational);
+        delegate(identifier, tOrganizational, userName);
 	}
 	
 	public StartResponseDocument start(StartDocument start, String name)

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=988122&r1=988121&r2=988122&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
Mon Aug 23 13:52:33 2010
@@ -69,7 +69,7 @@ public class TaskChecker {
 	 * Throws exception if it can't.
 	 * 
 	 */
-	static public void checkHumanRolePermission(TaskChecker.HumanOperationName operaionName,
String userID, Task task) throws IllegalAccessFault
+	static public void checkHumanRolePermission(TaskChecker.HumanOperationName operaionName,
String userID, Task task, boolean adminMode) throws IllegalAccessFault
 	{
 		Collection<GenericHumanRole> humanRoles = new HashSet<GenericHumanRole>();
 		humanRoles = task.getGenericHumanRolesForUser(userID);
@@ -108,7 +108,8 @@ public class TaskChecker {
 			case DELETE_ATTACHMENTS:
 			case GET_OUTPUT:
 			case GET_FAULT:
-				if(isActualOwner(humanRoles) || isBusinessAdministrator(humanRoles) || isTaskStakeholders(humanRoles))
+				System.out.println("------"+adminMode);
+				if(adminMode || isActualOwner(humanRoles) || isBusinessAdministrator(humanRoles) || isTaskStakeholders(humanRoles))
 					return;
 				else throw new IllegalAccessFault("Illegal access to operations");
 				
@@ -117,7 +118,7 @@ public class TaskChecker {
 			case SUSPEND_UNTIL:
 			case RESUME:
 			case DELEGATE:
-				if(isPotentialOwnersWithReadyState(humanRoles, task) || isActualOwner(humanRoles) ||
+				if(adminMode || isPotentialOwnersWithReadyState(humanRoles, task) || isActualOwner(humanRoles)
||
 					isBusinessAdministrator(humanRoles) || isTaskStakeholders(humanRoles))
 						return;
 				else throw new IllegalAccessFault("Illegal access to operations");
@@ -143,7 +144,7 @@ public class TaskChecker {
 				
 				//G8 conditions: user is Recipients
 			case REMOVE:
-				if(isRecipients(humanRoles))
+				if(adminMode || isRecipients(humanRoles))
 					return;
 				else throw new IllegalAccessFault("Illegal access to operations");
 				
@@ -151,7 +152,7 @@ public class TaskChecker {
 			case ACTIVATE:
 			case NOMINATE:
 			case SET_GENERIC_HUMAN_ROLE:
-				if(isBusinessAdministrator(humanRoles) || isTaskStakeholders(humanRoles))
+				if(adminMode || isBusinessAdministrator(humanRoles) || isTaskStakeholders(humanRoles))
 					return;
 				else throw new IllegalAccessFault("Illegal access to operations");
 				
@@ -161,7 +162,7 @@ public class TaskChecker {
 			case GET_TASK_INFO:
 			case GET_TASK_DESCRIPTION:
 				humanRoles.remove(GenericHumanRole.POTENTIALDELEGATEES);
-				if(humanRoles.size() > 0)
+				if(adminMode || humanRoles.size() > 0)
 					return;
 				else throw new IllegalAccessFault("Illegal access to operations");
 		}

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrativeImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrativeImpl.java?rev=988122&r1=988121&r2=988122&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrativeImpl.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrativeImpl.java
Mon Aug 23 13:52:33 2010
@@ -9,13 +9,19 @@ public class TaskOperationsAdministrativ
 
 	private String userName;
 	@Override
-	protected String getUserString() {
-		return userName;
+	public String getUserString() {
+		if(userName==null)
+			return new String("Administrator");
+		else
+			return userName;
 	}
 
 
 	public String getUserName() {
-		return userName;
+		if(userName==null)
+			return new String("Administrator");
+		else
+			return userName;
 	}
 
 	public void setUserName(String userNameinAdministrativeMode) {

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java?rev=988122&r1=988121&r2=988122&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java
Mon Aug 23 13:52:33 2010
@@ -185,6 +185,8 @@ public abstract class TaskOperationsBase
     private HISEEngineImpl hiseEngine;
 
     protected WebServiceContext context;
+    
+    protected boolean administrationMode=false;
 
 
     abstract protected String getUserString();
@@ -320,7 +322,7 @@ public abstract class TaskOperationsBase
         String part = getInput.getGetInput().getPart();
 
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_INPUT, getUserString(),
t);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_INPUT, getUserString(),
t, administrationMode);
         t.setCurrentUser(getUserString());
 
         GetInputResponseDocument responseDocument =  GetInputResponseDocument.Factory.newInstance();
@@ -344,7 +346,7 @@ public abstract class TaskOperationsBase
         String part = getOutput.getGetOutput().getPart();
 
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_OUTPUT, getUserString(),
t);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_OUTPUT, getUserString(),
t, administrationMode);
         t.setCurrentUser(getUserString());
 
         GetOutputResponseDocument responseDocument = GetOutputResponseDocument.Factory.newInstance();
@@ -368,7 +370,7 @@ public abstract class TaskOperationsBase
     }
     public StopResponseDocument stop(Long id) throws IllegalArgumentFault, IllegalStateFault,
IllegalAccessFault {
         Task t = Task.load(hiseEngine, id);
-        TaskChecker.checkHumanRolePermission(HumanOperationName.STOP, getUserString(), t);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.STOP, getUserString(), t,
administrationMode);
         TaskChecker.checkStatePermission(HumanOperationName.STOP, t);
         t.setCurrentUser(getUserString());
         
@@ -393,7 +395,7 @@ public abstract class TaskOperationsBase
     }
     public SuspendResponseDocument suspend(Long id) throws IllegalArgumentFault, IllegalStateFault,
IllegalAccessFault {
         Task t = Task.load(hiseEngine, id);
-        TaskChecker.checkHumanRolePermission(HumanOperationName.SUSPEND, getUserString(),
t);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SUSPEND, getUserString(),
t, administrationMode);
         TaskChecker.checkStatePermission(HumanOperationName.SUSPEND, t);
         t.setCurrentUser(getUserString());
         
@@ -419,7 +421,7 @@ public abstract class TaskOperationsBase
     }
     public SuspendUntilResponseDocument suspendUntil(Long id, TTime time) throws IllegalArgumentFault,
IllegalStateFault, IllegalAccessFault {
     	 Task t = Task.load(hiseEngine,id);
-    	 TaskChecker.checkHumanRolePermission(HumanOperationName.SUSPEND_UNTIL, getUserString(),
t);
+    	 TaskChecker.checkHumanRolePermission(HumanOperationName.SUSPEND_UNTIL, getUserString(),
t, administrationMode);
          TaskChecker.checkStatePermission(HumanOperationName.SUSPEND_UNTIL, t);
          t.setCurrentUser(getUserString());
          GDate when;
@@ -454,7 +456,7 @@ public abstract class TaskOperationsBase
     
     public RemoveResponseDocument remove(Long id) throws IllegalArgumentFault, IllegalAccessFault
{
         Task t = Task.load(hiseEngine, id);
-        TaskChecker.checkHumanRolePermission(HumanOperationName.REMOVE, getUserString(),
t);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.REMOVE, getUserString(),
t, administrationMode);
         t.setCurrentUser(getUserString());
         t.remove();
 
@@ -472,7 +474,7 @@ public abstract class TaskOperationsBase
     public ResumeResponseDocument resume(Long id) throws IllegalArgumentFault, IllegalStateFault,
IllegalAccessFault {
     	// OrgEntity user = loadUser();
         Task t = Task.load(hiseEngine, id);
-        TaskChecker.checkHumanRolePermission(HumanOperationName.RESUME, getUserString(),
t);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.RESUME, getUserString(),
t, administrationMode);
         TaskChecker.checkStatePermission(HumanOperationName.RESUME, t);
         t.setCurrentUser(getUserString());
         
@@ -511,7 +513,7 @@ public abstract class TaskOperationsBase
     }
     public ClaimResponseDocument claim(Long id) throws IllegalArgumentFault, IllegalStateFault,
IllegalAccessFault {
         Task task = Task.load(hiseEngine, id);
-        TaskChecker.checkHumanRolePermission(HumanOperationName.CLAIM, getUserString(), task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.CLAIM, getUserString(), task,
administrationMode);
         TaskChecker.checkStatePermission(HumanOperationName.CLAIM, task);
         task.setCurrentUser(getUserString());
         
@@ -538,7 +540,7 @@ public abstract class TaskOperationsBase
         XmlObject faultData = fail.getFail().getFaultData();
 
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.FAIL, getUserString(), t);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.FAIL, getUserString(), t,
administrationMode);
         t.setCurrentUser(getUserString());
         
         try {
@@ -560,7 +562,7 @@ public abstract class TaskOperationsBase
         TOrganizationalEntity organizationalEntity = forward.getForward().getOrganizationalEntity();
 
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.FORWARD, getUserString(),
t);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.FORWARD, getUserString(),
t, administrationMode);
         TaskChecker.checkStatePermission(HumanOperationName.FORWARD, t);
         t.setCurrentUser(getUserString());
         
@@ -599,7 +601,7 @@ public abstract class TaskOperationsBase
     }
     public ReleaseResponseDocument release(Long id) throws IllegalArgumentFault, IllegalStateFault,
IllegalAccessFault {
           Task t = Task.load(hiseEngine, id);
-          TaskChecker.checkHumanRolePermission(HumanOperationName.RELEASE, getUserString(),
t);
+          TaskChecker.checkHumanRolePermission(HumanOperationName.RELEASE, getUserString(),
t, administrationMode);
           t.setCurrentUser(getUserString());
           
           try {
@@ -620,7 +622,7 @@ public abstract class TaskOperationsBase
         String identifier = start.getStart().getIdentifier();
 
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.START, getUserString(), t);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.START, getUserString(), t,
administrationMode);
         TaskChecker.checkStatePermission(HumanOperationName.START, t);
         t.setCurrentUser(getUserString());
         
@@ -645,7 +647,7 @@ public abstract class TaskOperationsBase
         XmlObject taskData = complete.getComplete().getTaskData();
 
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.COMPLETE, getUserString(),
t);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.COMPLETE, getUserString(),
t, administrationMode);
         t.setCurrentUser(getUserString());
         //TODO set output
         //t.setOutput(((Node) taskData).getFirstChild());
@@ -669,7 +671,7 @@ public abstract class TaskOperationsBase
         XmlObject taskData = setOutput.getSetOutput().getTaskData();
 
         Task t = Task.load(hiseEngine, Long.valueOf(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_OUTPUT, getUserString(),
t);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_OUTPUT, getUserString(),
t, administrationMode);
         t.setCurrentUser(getUserString());
         t.setOutput(((Node) taskData.getDomNode()).getFirstChild());
 
@@ -695,7 +697,7 @@ public abstract class TaskOperationsBase
         String text = addComment.getAddComment().getText();
 
 	Task task = Task.load(hiseEngine, new Long(identifier));
-	TaskChecker.checkHumanRolePermission(HumanOperationName.ADD_COMMENT, getUserString(), task);
+	TaskChecker.checkHumanRolePermission(HumanOperationName.ADD_COMMENT, getUserString(), task,
administrationMode);
 	org.apache.hise.dao.Task taskDto = task.getTaskDto();
 	org.apache.hise.dao.Comment newComment = new Comment(text, taskDto, getUserString());
 	taskDto.getComments().add(newComment);
@@ -720,7 +722,7 @@ public abstract class TaskOperationsBase
 //    public List<TComment> getComments(String identifier) throws IllegalAccessFault,
IllegalStateFault, IllegalArgumentFault {
         String identifier = getComments.getGetComments().getIdentifier();
         Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_COMMENTS, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_COMMENTS, getUserString(),
task, administrationMode);
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         List<TComment> result = convertComments(taskDto.getComments());
 
@@ -750,7 +752,7 @@ public abstract class TaskOperationsBase
     }
     public ActivateResponseDocument activate(Long id) throws IllegalArgumentFault, IllegalStateFault,
IllegalAccessFault {
     	Task task = Task.load(hiseEngine, id);
-        TaskChecker.checkHumanRolePermission(HumanOperationName.ACTIVATE, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.ACTIVATE, getUserString(),
task, administrationMode);
         TaskChecker.checkStatePermission(HumanOperationName.ACTIVATE, task);
         
         task.activate();
@@ -779,7 +781,7 @@ public abstract class TaskOperationsBase
                 XmlObject attachment = addAttachment.getAddAttachment().getAttachment();
 
         Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.ADD_ATTACHMENT, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.ADD_ATTACHMENT, getUserString(),
task, administrationMode);
         
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         org.apache.hise.dao.Attachment newAttachment= new Attachment();
@@ -811,7 +813,7 @@ public abstract class TaskOperationsBase
         TOrganizationalEntity organizationalEntity = delegate.getDelegate().getOrganizationalEntity();
 
         Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.DELEGATE, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.DELEGATE, getUserString(),
task, administrationMode);
         TaskChecker.checkStatePermission(HumanOperationName.DELEGATE, task);
         
         String userID = task.checkCanDelegate(organizationalEntity);
@@ -837,7 +839,7 @@ public abstract class TaskOperationsBase
         String attachmentName = deleteAttachments.getDeleteAttachments().getAttachmentName();
 
         Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.DELETE_ATTACHMENTS, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.DELETE_ATTACHMENTS, getUserString(),
task, administrationMode);
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         List<Attachment> attachments=taskDto.getAttachments();
         Iterator<Attachment> attachemntIterator=attachments.iterator();
@@ -869,7 +871,7 @@ public abstract class TaskOperationsBase
         String identifier = deleteFault.getDeleteFault().getIdentifier();
 
     	Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.DELELE_FAULT, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.DELELE_FAULT, getUserString(),
task, administrationMode);
         task.setCurrentUser(getUserString());
         // TODO Auto-generated method stub
 
@@ -886,7 +888,7 @@ public abstract class TaskOperationsBase
         String identifier = deleteOutput.getDeleteOutput().getIdentifier();
 
     	Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.DELETE_OUTPUT, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.DELETE_OUTPUT, getUserString(),
task, administrationMode);
         task.setCurrentUser(getUserString());
         // TODO Auto-generated method stub
 
@@ -902,7 +904,7 @@ public abstract class TaskOperationsBase
         String identifier = getAttachmentInfos.getGetAttachmentInfos().getIdentifier();
 
         Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_ATTACHMENT_INFOS, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_ATTACHMENT_INFOS, getUserString(),
task, administrationMode);
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         List<Attachment> attachments=taskDto.getAttachments();
         List<TAttachmentInfo> result= new ArrayList<TAttachmentInfo>();
@@ -935,7 +937,7 @@ public abstract class TaskOperationsBase
         String attachmentName = getAttachments.getGetAttachments().getAttachmentName();
 
         Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_ATTACHMENTS, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_ATTACHMENTS, getUserString(),
task, administrationMode);
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         List<Attachment> attachments=taskDto.getAttachments();
         List<TAttachment> result= new ArrayList<TAttachment>();
@@ -1084,7 +1086,7 @@ public abstract class TaskOperationsBase
         TOrganizationalEntity organizationalEntity = nominate.getNominate().getOrganizationalEntity();
 
         Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.NOMINATE, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.NOMINATE, getUserString(),
task, administrationMode);
         TaskChecker.checkStatePermission(HumanOperationName.NOMINATE, task);
  
         TUserlist tUsers = organizationalEntity.getUsers();
@@ -1123,7 +1125,7 @@ public abstract class TaskOperationsBase
         String faultName =  setFault.getSetFault().getFaultName();
 
     	Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_FAULT, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_FAULT, getUserString(),
task, administrationMode);
         task.setCurrentUser(getUserString());
         // TODO Auto-generated method stub
 
@@ -1143,7 +1145,7 @@ public abstract class TaskOperationsBase
         TOrganizationalEntity organizationalEntity = setGenericHumanRole.getSetGenericHumanRole().getOrganizationalEntity();
 
     	Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_GENERIC_HUMAN_ROLE, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_GENERIC_HUMAN_ROLE, getUserString(),
task, administrationMode);
     	
         TUserlist tUsers = organizationalEntity.getUsers();
         TGrouplist tGroup = organizationalEntity.getGroups();
@@ -1182,7 +1184,7 @@ public abstract class TaskOperationsBase
     }
     public SetPriorityResponseDocument setPriority(Long id, BigInteger priority) throws IllegalArgumentFault,
IllegalStateFault, IllegalAccessFault {
         Task task = Task.load(hiseEngine, id);
-        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_PRIORITY, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_PRIORITY, getUserString(),
task, administrationMode);
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         taskDto.setPriority(priority.intValue());
 
@@ -1200,7 +1202,7 @@ public abstract class TaskOperationsBase
         String identifier = skip.getSkip().getIdentifier();
 
         Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.SKIP, getUserString(), task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SKIP, getUserString(), task,
administrationMode);
         task.setCurrentUser(getUserString());
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         if(taskDto.isSkippable()){
@@ -1226,7 +1228,7 @@ public abstract class TaskOperationsBase
         String faultName = getFault.getGetFault().getFaultName();
 
     	Task task = Task.load(hiseEngine, new Long(identifier));
-        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_FAULT, getUserString(),
task);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_FAULT, getUserString(),
task, administrationMode);
     	
         // TODO Auto-generated method stub
 
@@ -1447,4 +1449,18 @@ public abstract class TaskOperationsBase
         this.hiseEngine = hiseEngine;
     }
 
+
+
+	public boolean isAdministrationMode() {
+		return administrationMode;
+	}
+
+
+
+	public void setAdministrationMode(boolean administrationMode) {
+		this.administrationMode = administrationMode;
+	}
+    
+    
+
 }
\ No newline at end of file

Modified: incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestImpl.java?rev=988122&r1=988121&r2=988122&view=diff
==============================================================================
--- incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestImpl.java
(original)
+++ incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestImpl.java
Mon Aug 23 13:52:33 2010
@@ -65,7 +65,7 @@ public class TestImpl implements Test {
         tt.execute(new TransactionCallback() {
             public Object doInTransaction(TransactionStatus status) {
             	try {
-					management.delegate(identifier, organizationalEntity);
+					management.delegate(identifier, organizationalEntity, null);
 				} catch (RecipientNotAllowed e) {
 				
 				} catch (IllegalStateFault e) {

Modified: incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/ManagementApiTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/ManagementApiTest.java?rev=988122&r1=988121&r2=988122&view=diff
==============================================================================
--- incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/ManagementApiTest.java
(original)
+++ incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/ManagementApiTest.java
Mon Aug 23 13:52:33 2010
@@ -88,7 +88,8 @@ public class ManagementApiTest extends T
     	
     	List<String> users= new ArrayList<String>();
     	users.add(new String("newUser"));
-    	management.delegate(id.toString(), users,new ArrayList<String>());
+    	management.delegate(id.toString(), users,new ArrayList<String>(), null);
+    	System.out.println("-------++--"+task.getTaskDto().getActualOwner());
     	Assert.assertEquals(new String("newUser"), task.getTaskDto().getActualOwner());
     
     }

Added: incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/TaskLifecycleTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/TaskLifecycleTest.java?rev=988122&view=auto
==============================================================================
--- incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/TaskLifecycleTest.java
(added)
+++ incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/TaskLifecycleTest.java
Mon Aug 23 13:52:33 2010
@@ -0,0 +1,89 @@
+package org.apache.hise.managementApi;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.hise.TaskTestBase;
+import org.apache.hise.dao.Task.Status;
+import org.apache.hise.engine.wsdl.IllegalAccessFault;
+import org.apache.hise.engine.wsdl.IllegalArgumentFault;
+import org.apache.hise.engine.wsdl.IllegalStateFault;
+import org.apache.hise.runtime.Task;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.transaction.support.TransactionTemplate;
+
+public class TaskLifecycleTest extends TaskTestBase {
+
+    private Task task = null;
+    
+    
+
+    @Before
+      public void setUp() throws Exception {
+          init("test-example/test.xml");
+          task = getTask("test-example/approveHeader.xml", "test-example/approveBody.xml",
new QName("http://www.insurance.example.com/claims", "Task1"));
+          addUser("user1");
+          addUser("user3");
+      }
+    
+    @Test
+    public void lifecycleTest() throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault{
+    	Long id= task.getTaskDto().getId();
+    	
+
+		Assert.assertEquals(Status.RESERVED, task.getTaskDto().getStatus());
+		
+		management.start(id.toString(), "user1");
+		Assert.assertEquals(Status.IN_PROGRESS, task.getTaskDto().getStatus());
+		
+		management.stop(id.toString(), "user1");
+		Assert.assertEquals(Status.RESERVED, task.getTaskDto().getStatus());
+		
+		management.start(id.toString(), "user1");
+		Assert.assertEquals(Status.IN_PROGRESS, task.getTaskDto().getStatus());
+		
+		management.release(id, task.getTaskDto().getActualOwner());
+		Assert.assertEquals(Status.READY, task.getTaskDto().getStatus());
+		
+		management.claim(id, "user1");
+		Assert.assertEquals(Status.RESERVED, task.getTaskDto().getStatus());
+		
+		management.suspend(id, "user1");
+		Assert.assertEquals(Status.SUSPENDED, task.getTaskDto().getStatus());
+		
+		management.resume(id, "user1");
+		Assert.assertEquals(Status.RESERVED, task.getTaskDto().getStatus());
+    	
+    }
+    
+    @Test
+    public void lifecycleInAdminModeTest()throws IllegalArgumentFault, IllegalStateFault,
IllegalAccessFault{
+    	Long id= task.getTaskDto().getId();
+    	
+		Assert.assertEquals(Status.RESERVED, task.getTaskDto().getStatus());
+		
+		management.start(id.toString(), "user1");
+		Assert.assertEquals(Status.IN_PROGRESS, task.getTaskDto().getStatus());
+		
+		management.stop(id.toString(), null);
+		Assert.assertEquals(Status.RESERVED, task.getTaskDto().getStatus());
+		
+		management.start(id.toString(), "user1");
+		Assert.assertEquals(Status.IN_PROGRESS, task.getTaskDto().getStatus());
+		
+		management.release(id, null);
+		Assert.assertEquals(Status.READY, task.getTaskDto().getStatus());
+		
+		management.claim(id, "user1");
+		Assert.assertEquals(Status.RESERVED, task.getTaskDto().getStatus());
+		
+		management.suspend(id, null);
+		Assert.assertEquals(Status.SUSPENDED, task.getTaskDto().getStatus());
+		
+		management.resume(id, null);
+		Assert.assertEquals(Status.RESERVED, task.getTaskDto().getStatus());
+    }
+    
+}

Modified: incubator/hise/trunk/rtests/src/test/resources/hise-ctx.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/resources/hise-ctx.xml?rev=988122&r1=988121&r2=988122&view=diff
==============================================================================
--- incubator/hise/trunk/rtests/src/test/resources/hise-ctx.xml (original)
+++ incubator/hise/trunk/rtests/src/test/resources/hise-ctx.xml Mon Aug 23 13:52:33 2010
@@ -118,6 +118,7 @@
   
   <bean id="taskOperationsAdministrative" class="org.apache.hise.engine.jaxws.TaskOperationsAdministrativeImpl">
     <property name="hiseEngine" ref="hiseEngine"/>
+     <property name="administrationMode" value="true"/>
   </bean>
 
 </beans>
\ No newline at end of file



Mime
View raw message