incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r987241 [1/4] - 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/en...
Date Thu, 19 Aug 2010 17:37:40 GMT
Author: rr
Date: Thu Aug 19 17:37:40 2010
New Revision: 987241

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

Added:
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrative.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/rtests/src/test/java/org/apache/hise/managementApi/
    incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/ManagementApiTest.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/jaxws/TaskOperationsImpl.java
    incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/Test.java
    incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestImpl.java
    incubator/hise/trunk/itest/hise-management.xml
    incubator/hise/trunk/pom.xml
    incubator/hise/trunk/rtests/src/test/java/org/apache/hise/TaskTestBase.java
    incubator/hise/trunk/rtests/src/test/resources/hise-ctx.xml
    incubator/hise/trunk/rtests/src/test/resources/test-example/testHtd1.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=987241&r1=987240&r2=987241&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 Thu Aug 19 17:37:40 2010
@@ -67,6 +67,7 @@
   
   <bean id="management" class="org.apache.hise.engine.ManagementImpl">
   <property name="hiseEngine" ref="hiseEngine"/>
+  <property name="adminOperations" ref="taskOperationsAdministrative"/>
   </bean>
   
   <osgi:service id="managmentOsgi" ref="management" interface="org.apache.hise.api.Management"/>
@@ -97,6 +98,10 @@
 
   <osgi:service id="transactionManagerOsgi" interface="org.springframework.transaction.PlatformTransactionManager" ref="transactionManager"/>
 
+  <bean id="taskOperationsAdministrative" class="org.apache.hise.engine.jaxws.TaskOperationsAdministrativeImpl">
+    <property name="hiseEngine" ref="hiseEngine"/>
+  </bean>
+
   <bean name="taskOperations" class="org.apache.hise.engine.jaxws.TaskOperationsImpl" init-method="init">
     <property name="hiseEngine" ref="hiseEngine"/>
   </bean>

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=987241&r1=987240&r2=987241&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 Thu Aug 19 17:37:40 2010
@@ -21,12 +21,27 @@ package org.apache.hise.api;
 import java.util.List;
 
 import org.apache.hise.dao.HISEDao;
+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.engine.wsdl.RecipientNotAllowed;
 import org.apache.hise.lang.xsd.htd.TOrganizationalEntity;
 import org.apache.hise.lang.xsd.htda.TStatus;
 import org.apache.hise.lang.xsd.htda.TTask;
+import org.apache.hise.lang.xsd.htdt.CompleteDocument;
+import org.apache.hise.lang.xsd.htdt.CompleteResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetMyTaskAbstractsDocument;
+import org.apache.hise.lang.xsd.htdt.GetMyTaskAbstractsResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetTaskInfoDocument;
+import org.apache.hise.lang.xsd.htdt.GetTaskInfoResponseDocument;
+import org.apache.hise.lang.xsd.htdt.NominateDocument;
+import org.apache.hise.lang.xsd.htdt.NominateResponseDocument;
+import org.apache.hise.lang.xsd.htdt.ReleaseDocument;
+import org.apache.hise.lang.xsd.htdt.ReleaseResponseDocument;
+import org.apache.hise.lang.xsd.htdt.StartDocument;
+import org.apache.hise.lang.xsd.htdt.StartResponseDocument;
+import org.apache.hise.lang.xsd.htdt.StopDocument;
+import org.apache.hise.lang.xsd.htdt.StopResponseDocument;
 
 public interface Management {
 
@@ -39,5 +54,25 @@ 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 StartResponseDocument start(StartDocument start, String userName) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+	 public StartResponseDocument start(String taskIdentifier, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+	 
+	 public CompleteResponseDocument complete(CompleteDocument complete, String userName) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+	 
+	 public StopResponseDocument stop(StopDocument stop, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+	 public StopResponseDocument stop(String id, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+
+	 public GetTaskInfoResponseDocument getTaskInfo(GetTaskInfoDocument getTaskInfo) throws IllegalArgumentFault;
+	 public GetTaskInfoResponseDocument getTaskInfo(Long id) throws IllegalArgumentFault;
+	 
+	 public ReleaseResponseDocument release(ReleaseDocument release, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+	 public ReleaseResponseDocument release(Long id, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+
+	 public GetMyTaskAbstractsResponseDocument getMyTaskAbstracts(GetMyTaskAbstractsDocument getMyTaskAbstracts, String name) throws IllegalArgumentFault, IllegalStateFault;
+	 
+	 public NominateResponseDocument nominate(NominateDocument nominate, 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=987241&r1=987240&r2=987241&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 Thu Aug 19 17:37:40 2010
@@ -26,23 +26,52 @@ import org.apache.hise.api.HISEEngine;
 import org.apache.hise.api.Management;
 import org.apache.hise.dao.GenericHumanRole;
 import org.apache.hise.dao.HISEDao;
+import org.apache.hise.dao.TaskOrgEntity;
 import org.apache.hise.dao.TaskQuery;
+import org.apache.hise.dao.TaskOrgEntity.OrgEntityType;
 import org.apache.hise.engine.TaskChecker.HumanOperationName;
 
+import org.apache.hise.engine.jaxws.TaskOperationsAdministrative;
+import org.apache.hise.engine.jaxws.TaskOperationsAdministrativeImpl;
+import org.apache.hise.engine.jaxws.TaskOperationsBaseImpl;
+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.engine.wsdl.RecipientNotAllowed;
 import org.apache.hise.engine.wsdl.TaskOperations;
+import org.apache.hise.lang.xsd.htd.TGrouplist;
 import org.apache.hise.lang.xsd.htd.TOrganizationalEntity;
+import org.apache.hise.lang.xsd.htd.TUserlist;
 import org.apache.hise.lang.xsd.htda.TStatus;
 import org.apache.hise.lang.xsd.htda.TTask;
 import org.apache.hise.runtime.HiseIllegalStateException;
 import org.apache.hise.runtime.Task;
+import org.apache.hise.lang.xsd.htdt.CompleteDocument;
+import org.apache.hise.lang.xsd.htdt.CompleteResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetMyTaskAbstractsDocument;
+import org.apache.hise.lang.xsd.htdt.GetMyTaskAbstractsResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetTaskInfoDocument;
+import org.apache.hise.lang.xsd.htdt.GetTaskInfoResponseDocument;
+import org.apache.hise.lang.xsd.htdt.NominateDocument;
+import org.apache.hise.lang.xsd.htdt.NominateResponseDocument;
+import org.apache.hise.lang.xsd.htdt.ReleaseDocument;
+import org.apache.hise.lang.xsd.htdt.ReleaseResponseDocument;
+import org.apache.hise.lang.xsd.htdt.StartDocument;
+import org.apache.hise.lang.xsd.htdt.StartResponseDocument;
+import org.apache.hise.lang.xsd.htdt.StopDocument;
+import org.apache.hise.lang.xsd.htdt.StopResponseDocument;
+import org.apache.hise.lang.xsd.htdt.StartDocument.Start;
+import org.apache.hise.lang.xsd.htdt.impl.StartDocumentImpl;
 
 public class ManagementImpl implements Management {
 	
 	private HISEEngine hiseEngine;
 
+	private TaskOperationsAdministrativeImpl taskOperations;
+	
+	private TaskOperations to;
+	
+	private TaskOperationsAdministrative adminOperations;
 	
 	public String getText(){
 		return new String("test");
@@ -122,6 +151,109 @@ public class ManagementImpl implements M
 		}
 		
 	}
+	public void delegate(String identifier, List<String> usersList, List<String> groupsList) throws RecipientNotAllowed, IllegalStateFault{
+		TOrganizationalEntity tOrganizational = TOrganizationalEntity.Factory.newInstance();
+        
+		TUserlist users=TUserlist.Factory.newInstance();
+        for(String name : usersList)
+        		users.getUserList().add(name);
+        
+        TGrouplist groups=TGrouplist.Factory.newInstance();
+        for(String name: groupsList)
+        		groups.getGroupList().add(name);
+        
+        tOrganizational.setGroups(groups);
+        tOrganizational.setUsers(users);
+        
+        delegate(identifier, tOrganizational);
+	}
+	
+	public StartResponseDocument start(StartDocument start, String name)
+	throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+		
+		adminOperations.setUserName(name);
+			return adminOperations.start(start);
+	}
+	
+	public StartResponseDocument start(String taskIdentifier, String name)
+	throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+		
+		StartDocument startDoc = StartDocument.Factory.newInstance();
+		Start start=Start.Factory.newInstance();
+		start.setIdentifier(taskIdentifier);
+		startDoc.setStart(start);
+		adminOperations.setUserName(name);
+			return adminOperations.start(startDoc);
+	}
+	
+	public CompleteResponseDocument complete(CompleteDocument complete, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault{
+		adminOperations.setUserName(name);
+		return adminOperations.complete(complete);
+		
+	}
+	
+	public StopResponseDocument stop(StopDocument stop, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault{
+		adminOperations.setUserName(name);
+		return adminOperations.stop(stop);
+	}
+	public StopResponseDocument stop(String id, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault{
+		adminOperations.setUserName(name);
+		//adminOperations.st
+		return adminOperations.stop(Long.parseLong(id));
+	}
+	
+	
+	public TaskOperationsAdministrativeImpl getTaskOperations() {
+		return taskOperations;
+	}
+
+	public void setTaskOperations(TaskOperationsAdministrativeImpl taskOperations) {
+		this.taskOperations = taskOperations;
+	}
+
+	public TaskOperations getTo() {
+		return to;
+	}
+
+	public void setTo(TaskOperations to) {
+		this.to = to;
+		
+	}
+	public TaskOperationsAdministrative getAdminOperations() {
+		return adminOperations;
+	}
+
+	public void setAdminOperations(TaskOperationsAdministrative adminOperations) {
+		this.adminOperations = adminOperations;
+	}
+	
+	
+	public GetTaskInfoResponseDocument getTaskInfo(GetTaskInfoDocument getTaskInfo) throws IllegalArgumentFault{
+		 return adminOperations.getTaskInfo(getTaskInfo);
+	 }
+	 
+	public GetTaskInfoResponseDocument getTaskInfo(Long id) throws IllegalArgumentFault{
+		 return adminOperations.getTaskInfo(id);
+	 }
+	
+	 public ReleaseResponseDocument release(ReleaseDocument release, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault{
+		 adminOperations.setUserName(name);
+		 return adminOperations.release(release);
+	 }
+	 public ReleaseResponseDocument release(Long id, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault{
+		 adminOperations.setUserName(name);
+		 return adminOperations.release(id);
+	 }
+	 
+	 public GetMyTaskAbstractsResponseDocument getMyTaskAbstracts(GetMyTaskAbstractsDocument getMyTaskAbstracts, String name) throws IllegalArgumentFault, IllegalStateFault{
+		 adminOperations.setUserName(name);
+		 return adminOperations.getMyTaskAbstracts(getMyTaskAbstracts);
+	 }
+	 
+	 public NominateResponseDocument nominate(NominateDocument nominate, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault{
+		 adminOperations.setUserName(name);
+		 return adminOperations.nominate(nominate);		 
+	 }
 	
 	
 

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrative.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrative.java?rev=987241&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrative.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrative.java Thu Aug 19 17:37:40 2010
@@ -0,0 +1,23 @@
+package org.apache.hise.engine.jaxws;
+
+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.engine.wsdl.TaskOperations;
+import org.apache.hise.lang.xsd.htdt.GetTaskInfoResponseDocument;
+import org.apache.hise.lang.xsd.htdt.ReleaseResponseDocument;
+import org.apache.hise.lang.xsd.htdt.RemoveResponseDocument;
+import org.apache.hise.lang.xsd.htdt.StopResponseDocument;
+import org.apache.hise.lang.xsd.htdt.SuspendUntilResponseDocument;
+import org.apache.hise.lang.xsd.htdt.TTime;
+
+public interface TaskOperationsAdministrative extends TaskOperations {
+
+	public String getUserName();
+	public void setUserName(String userNameinAdministrativeMode);
+	public StopResponseDocument stop(Long id) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+	public ReleaseResponseDocument release(Long id) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault ;
+	public GetTaskInfoResponseDocument getTaskInfo(Long id) throws IllegalArgumentFault;
+	public SuspendUntilResponseDocument suspendUntil(Long id, TTime time) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+	public RemoveResponseDocument remove(Long id) throws IllegalArgumentFault, IllegalAccessFault;	  
+}

Added: 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=987241&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrativeImpl.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrativeImpl.java Thu Aug 19 17:37:40 2010
@@ -0,0 +1,25 @@
+package org.apache.hise.engine.jaxws;
+
+import org.apache.hise.engine.wsdl.TaskOperations;
+
+
+
+
+public class TaskOperationsAdministrativeImpl extends TaskOperationsBaseImpl implements TaskOperationsAdministrative, TaskOperations{
+
+	private String userName;
+	@Override
+	protected String getUserString() {
+		return userName;
+	}
+
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userNameinAdministrativeMode) {
+		this.userName = userNameinAdministrativeMode;
+	}
+
+}

Added: 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=987241&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java Thu Aug 19 17:37:40 2010
@@ -0,0 +1,1437 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hise.engine.jaxws;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hise.dao.Attachment;
+import org.apache.hise.dao.Comment;
+import org.apache.hise.dao.GenericHumanRole;
+import org.apache.hise.dao.Job;
+import org.apache.hise.dao.Task.Status;
+import org.apache.hise.dao.TaskOrgEntity;
+import org.apache.hise.dao.TaskOrgEntity.OrgEntityType;
+import org.apache.hise.dao.TaskQuery;
+import org.apache.hise.engine.HISEEngineImpl;
+import org.apache.hise.engine.TaskChecker;
+import org.apache.hise.engine.TaskChecker.HumanOperationName;
+
+import org.apache.hise.engine.wsdl.IllegalAccessFault;
+import org.apache.hise.engine.wsdl.IllegalArgumentFault;
+import org.apache.hise.engine.wsdl.IllegalOperationFault;
+import org.apache.hise.engine.wsdl.IllegalStateFault;
+
+import org.apache.hise.engine.wsdl.RecipientNotAllowed;
+
+import org.apache.hise.engine.wsdl.TaskOperations;
+
+import org.apache.hise.lang.xsd.htd.TDeadlineInfo;
+import org.apache.hise.lang.xsd.htd.TDeadlinesInfo;
+import org.apache.hise.lang.xsd.htd.TGrouplist;
+import org.apache.hise.lang.xsd.htd.TOrganizationalEntity;
+import org.apache.hise.lang.xsd.htd.TRendering;
+import org.apache.hise.lang.xsd.htd.TRenderings;
+import org.apache.hise.lang.xsd.htd.TUserlist;
+
+import org.apache.hise.lang.xsd.htda.TAttachment;
+import org.apache.hise.lang.xsd.htda.TAttachmentInfo;
+import org.apache.hise.lang.xsd.htda.TComment;
+import org.apache.hise.lang.xsd.htda.TStatus;
+import org.apache.hise.lang.xsd.htda.TTask;
+import org.apache.hise.lang.xsd.htda.TTaskAbstract;
+import org.apache.hise.lang.xsd.htdt.ActivateDocument;
+import org.apache.hise.lang.xsd.htdt.ActivateResponseDocument;
+import org.apache.hise.lang.xsd.htdt.AddAttachmentDocument;
+import org.apache.hise.lang.xsd.htdt.AddAttachmentResponseDocument;
+import org.apache.hise.lang.xsd.htdt.AddCommentDocument;
+import org.apache.hise.lang.xsd.htdt.AddCommentResponseDocument;
+import org.apache.hise.lang.xsd.htdt.ClaimDocument;
+import org.apache.hise.lang.xsd.htdt.ClaimResponseDocument;
+import org.apache.hise.lang.xsd.htdt.CompleteDocument;
+import org.apache.hise.lang.xsd.htdt.CompleteResponseDocument;
+import org.apache.hise.lang.xsd.htdt.DelegateDocument;
+import org.apache.hise.lang.xsd.htdt.DelegateResponseDocument;
+import org.apache.hise.lang.xsd.htdt.DeleteAttachmentsDocument;
+import org.apache.hise.lang.xsd.htdt.DeleteAttachmentsResponseDocument;
+import org.apache.hise.lang.xsd.htdt.DeleteFaultDocument;
+import org.apache.hise.lang.xsd.htdt.DeleteFaultResponseDocument;
+import org.apache.hise.lang.xsd.htdt.DeleteOutputDocument;
+import org.apache.hise.lang.xsd.htdt.DeleteOutputResponseDocument;
+import org.apache.hise.lang.xsd.htdt.FailDocument;
+import org.apache.hise.lang.xsd.htdt.FailResponseDocument;
+import org.apache.hise.lang.xsd.htdt.ForwardDocument;
+import org.apache.hise.lang.xsd.htdt.ForwardResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetAttachmentInfosDocument;
+import org.apache.hise.lang.xsd.htdt.GetAttachmentInfosResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetAttachmentsDocument;
+import org.apache.hise.lang.xsd.htdt.GetAttachmentsResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetCommentsDocument;
+import org.apache.hise.lang.xsd.htdt.GetCommentsResposneDocument;
+import org.apache.hise.lang.xsd.htdt.GetFaultDocument;
+import org.apache.hise.lang.xsd.htdt.GetFaultResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetInputDocument;
+import org.apache.hise.lang.xsd.htdt.GetInputResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetMyTaskAbstractsDocument;
+import org.apache.hise.lang.xsd.htdt.GetMyTaskAbstractsResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetMyTasksDocument;
+import org.apache.hise.lang.xsd.htdt.GetMyTasksResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetOutputDocument;
+import org.apache.hise.lang.xsd.htdt.GetOutputResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetRenderingDocument;
+import org.apache.hise.lang.xsd.htdt.GetRenderingResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetRenderingTypesDocument;
+import org.apache.hise.lang.xsd.htdt.GetRenderingTypesResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetTaskDescriptionDocument;
+import org.apache.hise.lang.xsd.htdt.GetTaskDescriptionResponseDocument;
+import org.apache.hise.lang.xsd.htdt.GetTaskInfoDocument;
+import org.apache.hise.lang.xsd.htdt.GetTaskInfoResponseDocument;
+import org.apache.hise.lang.xsd.htdt.NominateDocument;
+import org.apache.hise.lang.xsd.htdt.NominateResponseDocument;
+import org.apache.hise.lang.xsd.htdt.QueryDocument;
+import org.apache.hise.lang.xsd.htdt.QueryResponseDocument;
+import org.apache.hise.lang.xsd.htdt.ReleaseDocument;
+import org.apache.hise.lang.xsd.htdt.ReleaseResponseDocument;
+import org.apache.hise.lang.xsd.htdt.RemoveDocument;
+import org.apache.hise.lang.xsd.htdt.RemoveResponseDocument;
+import org.apache.hise.lang.xsd.htdt.ResumeDocument;
+import org.apache.hise.lang.xsd.htdt.ResumeResponseDocument;
+import org.apache.hise.lang.xsd.htdt.SetFaultDocument;
+import org.apache.hise.lang.xsd.htdt.SetFaultResponseDocument;
+import org.apache.hise.lang.xsd.htdt.SetGenericHumanRoleDocument;
+import org.apache.hise.lang.xsd.htdt.SetGenericHumanRoleResponseDocument;
+import org.apache.hise.lang.xsd.htdt.SetOutputDocument;
+import org.apache.hise.lang.xsd.htdt.SetOutputResponseDocument;
+import org.apache.hise.lang.xsd.htdt.SetPriorityDocument;
+import org.apache.hise.lang.xsd.htdt.SetPriorityResponseDocument;
+import org.apache.hise.lang.xsd.htdt.SkipDocument;
+import org.apache.hise.lang.xsd.htdt.SkipResponseDocument;
+import org.apache.hise.lang.xsd.htdt.StartDocument;
+import org.apache.hise.lang.xsd.htdt.StartResponseDocument;
+import org.apache.hise.lang.xsd.htdt.StopDocument;
+import org.apache.hise.lang.xsd.htdt.StopResponseDocument;
+import org.apache.hise.lang.xsd.htdt.SuspendDocument;
+import org.apache.hise.lang.xsd.htdt.SuspendResponseDocument;
+import org.apache.hise.lang.xsd.htdt.SuspendUntilDocument;
+import org.apache.hise.lang.xsd.htdt.SuspendUntilResponseDocument;
+
+import org.apache.hise.lang.xsd.htdt.TTime;
+import org.apache.hise.runtime.HiseIllegalAccessException;
+import org.apache.hise.runtime.HiseIllegalStateException;
+import org.apache.hise.runtime.Task;
+import org.apache.hise.runtime.TaskEvaluator;
+import org.apache.hise.utils.DOMUtils;
+import org.apache.ws.commons.schema.utils.DOMUtil;
+import org.apache.xmlbeans.GDate;
+import org.apache.xmlbeans.GDuration;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.springframework.transaction.annotation.Transactional;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.apache.xmlbeans.XmlString;
+
+/**
+ * Implementation of WS-HT API. Operations are executed by end users, i.e.
+ * actual or potential owners. The identity of the user is implicitly passed
+ * when invoking any of the operations listed in the table below. The
+ * participant operations listed below only apply to tasks unless explicitly
+ * noted otherwise. The authorization column indicates people of which roles are
+ * authorized to perform the operation. Stakeholders of the task are not
+ * mentioned explicitly. They have the same authorization rights as business
+ * administrators.
+ * @author Witek Wołejszo
+ * @author Warren Crossing
+ */
+
+@Transactional
+@WebService
+public abstract class TaskOperationsBaseImpl implements TaskOperations {
+    
+    private static final Log log = LogFactory.getLog(TaskOperationsBaseImpl.class);
+
+    private HISEEngineImpl hiseEngine;
+
+    protected WebServiceContext context;
+
+
+    abstract protected String getUserString();
+
+
+
+    /**
+     * Sets up {@link WebServiceContext} used to lookup authenticated user
+     * performing operations.
+     * 
+     * @throws Exception
+     */
+    public void init() throws Exception {
+        context = (WebServiceContext) Class.forName("org.apache.cxf.jaxws.context.WebServiceContextImpl").newInstance();
+    }
+
+
+    // implementation in progress
+
+    /**
+     * {@inheritDoc}
+     */
+    public GetMyTasksResponseDocument getMyTasks(GetMyTasksDocument getMyTasks) throws IllegalArgumentFault, IllegalStateFault {
+//    public List<TTask> getMyTasks(String taskType, String genericHumanRole, String workQueue, List<TStatus> status, String whereClause, String createdOnClause,
+//            Integer maxTasks) throws IllegalArgumentFault, IllegalStateFault {
+
+        String taskType = getMyTasks.getGetMyTasks().getTaskType();
+        String genericHumanRole = getMyTasks.getGetMyTasks().getGenericHumanRole();
+        String workQueue = getMyTasks.getGetMyTasks().getWorkQueue();
+        List<TStatus.Enum> status = getMyTasks.getGetMyTasks().getStatusList();
+        String whereClause = getMyTasks.getGetMyTasks().getWhereClause();
+        String createdOnClause = getMyTasks.getGetMyTasks().getCreatedOnClause();
+        Integer maxTasks = getMyTasks.getGetMyTasks().getMaxTasks();
+
+        List<TTask> result = new ArrayList<TTask>();
+
+        String user = getUserString();
+
+        TaskQuery query = new TaskQuery();
+        query.setUser(user);
+        query.setUserGroups(hiseEngine.getHiseUserDetails().getUserGroups(user));
+        query.setTaskType(taskType);
+        if(genericHumanRole==null) {
+            query.setGenericHumanRole(null);
+        }
+        else {
+            query.setGenericHumanRole(GenericHumanRole.valueOf(genericHumanRole));
+        }
+        query.setWorkQueue(workQueue);
+        query.setStatuses(status);
+        query.setWhereClause(whereClause);
+        query.setCreatedOnClause(createdOnClause);
+
+        if (maxTasks != null) {
+            query.setMaxTasks(maxTasks);
+        }
+
+        List<org.apache.hise.dao.Task> tasks = hiseEngine.getHiseDao().getUserTasks(query);
+   
+        for (org.apache.hise.dao.Task u : tasks) {
+            TTask t = null;
+
+            t = convertTasktoTTask(u);
+
+            result.add(t);
+        }
+
+        GetMyTasksResponseDocument responseDocument = GetMyTasksResponseDocument.Factory.newInstance();
+        GetMyTasksResponseDocument.GetMyTasksResponse response = GetMyTasksResponseDocument.GetMyTasksResponse.Factory.newInstance();
+        TTask[] taskArray = new TTask[result.size()];
+        taskArray = result.toArray(taskArray);
+        response.setTaskAbstractArray(taskArray);
+        responseDocument.setGetMyTasksResponse(response);
+
+        return responseDocument;
+    }
+    
+    private TTask convertTasktoTTask(org.apache.hise.dao.Task t) throws IllegalArgumentFault {
+        TTask result = convertTask(t.getId());
+        result.setDeadlinesInfo(convertToDeadlinesInfo(t));
+
+        return result;
+    }
+
+    private TDeadlinesInfo convertToDeadlinesInfo(org.apache.hise.dao.Task t) throws IllegalArgumentFault {
+        TDeadlinesInfo result = TDeadlinesInfo.Factory.newInstance();
+        Set<Job> job = t.getDeadlines();
+        if (t.getDeadlines() != null && job.size() > 0) {
+            for (org.apache.hise.dao.Job j : job) {
+                String details = j.getDetails();
+                StringTokenizer st = new StringTokenizer(details, ";", true);
+                String name = new String();
+                String type = new String();
+                if (st.countTokens() < 2) {
+                    throw new IllegalArgumentFault("START or COMPLETION information missing in deadine details");
+                }
+                while (st.hasMoreTokens()) {
+                    String token = st.nextToken();
+                    if (st.hasMoreTokens()) {
+                        name += token;
+                    } else {
+                        type = token;
+                    }
+                }
+                if (type.equalsIgnoreCase("START")) {
+                    TDeadlineInfo startBy = result.addNewStartBy();
+                    Calendar startDate = Calendar.getInstance();
+                    startDate.setTime(j.getFire());
+                    startBy.setDate(startDate);
+                    startBy.setName(name);
+                } else {
+                    TDeadlineInfo completeBy = result.addNewCompleteBy();
+                    Calendar completeDate = Calendar.getInstance();
+                    completeDate.setTime(j.getFire());
+                    completeBy.setDate(completeDate);
+                    completeBy.setName(name);
+                }
+
+            }
+
+        }
+
+
+        return result;
+    }    
+
+    /**
+     * {@inheritDoc}
+     */
+    public GetInputResponseDocument getInput(GetInputDocument getInput) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public Object getInput(String identifier, String part) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = getInput.getGetInput().getIdentifier();
+        String part = getInput.getGetInput().getPart();
+
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_INPUT, getUserString(), t);
+        t.setCurrentUser(getUserString());
+
+        GetInputResponseDocument responseDocument =  GetInputResponseDocument.Factory.newInstance();
+        GetInputResponseDocument.GetInputResponse response = GetInputResponseDocument.GetInputResponse.Factory.newInstance();
+        try {
+            response.setTaskData(XmlObject.Factory.parse(t.getInput(part)));
+        } catch (XmlException ex) {
+            throw new IllegalStateFault("", ex);
+        }
+        responseDocument.setGetInputResponse(response);
+
+        return responseDocument;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public GetOutputResponseDocument getOutput(GetOutputDocument getOutput) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public Object getOutput(String identifier, String part) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = getOutput.getGetOutput().getIdentifier();
+        String part = getOutput.getGetOutput().getPart();
+
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_OUTPUT, getUserString(), t);
+        t.setCurrentUser(getUserString());
+
+        GetOutputResponseDocument responseDocument = GetOutputResponseDocument.Factory.newInstance();
+        GetOutputResponseDocument.GetOutputResponse response = GetOutputResponseDocument.GetOutputResponse.Factory.newInstance();
+        try {
+            response.setTaskData(XmlObject.Factory.parse(t.getOutput(part)));
+        } catch (XmlException ex) {
+            throw new IllegalStateFault("", ex);
+        }
+        responseDocument.setGetOutputResponse(response);
+        return responseDocument;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public StopResponseDocument stop(StopDocument stop) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//   public void stop(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = stop.getStop().getIdentifier();
+        return stop(Long.parseLong(identifier));
+    }
+    public StopResponseDocument stop(Long id) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+        Task t = Task.load(hiseEngine, id);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.STOP, getUserString(), t);
+        TaskChecker.checkStatePermission(HumanOperationName.STOP, t);
+        t.setCurrentUser(getUserString());
+        
+        try {
+            t.stop();
+        } catch (HiseIllegalStateException e) {
+            throw new IllegalStateFault(e.getMessage());
+        }
+
+        StopResponseDocument responseDocument = StopResponseDocument.Factory.newInstance();
+        StopResponseDocument.StopResponse response = StopResponseDocument.StopResponse.Factory.newInstance();
+        responseDocument.setStopResponse(response);
+        return responseDocument;
+    }
+    
+
+    public SuspendResponseDocument suspend(SuspendDocument suspend) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void suspend(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = suspend.getSuspend().getIdentifier();
+
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SUSPEND, getUserString(), t);
+        TaskChecker.checkStatePermission(HumanOperationName.SUSPEND, t);
+        t.setCurrentUser(getUserString());
+        
+        try {
+            t.suspend();
+        } catch (HiseIllegalStateException e) {
+            throw new IllegalStateFault(e.getMessage());
+        }
+
+        SuspendResponseDocument.SuspendResponse response = SuspendResponseDocument.SuspendResponse.Factory.newInstance();
+        SuspendResponseDocument responseDocument = SuspendResponseDocument.Factory.newInstance();
+        responseDocument.setSuspendResponse(response);
+
+        return responseDocument;
+    }
+
+    public SuspendUntilResponseDocument suspendUntil(SuspendUntilDocument suspendUntil) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void suspendUntil(String identifier, TTime time) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = suspendUntil.getSuspendUntil().getIdentifier();
+        TTime time =  suspendUntil.getSuspendUntil().getTime();
+        return suspendUntil(Long.parseLong(identifier), time);
+
+    }
+    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.checkStatePermission(HumanOperationName.SUSPEND_UNTIL, t);
+         t.setCurrentUser(getUserString());
+         GDate when;
+         if (time.getPointOfTime() == null) {
+             GDuration when2 = time.getTimePeriod();
+             when = new GDate(new Date());
+
+             when = when.add(when2);
+//             when2.addTo(when);
+         } else {
+             when = new GDate(time.getPointOfTime().getTime());
+         }
+
+         try {
+             t.suspendUntil(when.getCalendar().getTime());
+         } catch (HiseIllegalStateException e) {
+             throw new IllegalStateFault(e.getMessage());
+         }
+         SuspendUntilResponseDocument responseDocument = SuspendUntilResponseDocument.Factory.newInstance();
+         SuspendUntilResponseDocument.SuspendUntilResponse response = SuspendUntilResponseDocument.SuspendUntilResponse.Factory.newInstance();
+         responseDocument.setSuspendUntilResponse(response);
+
+         return responseDocument;
+    }
+
+    public RemoveResponseDocument remove(RemoveDocument remove) throws IllegalArgumentFault, IllegalAccessFault {
+//    public void remove(String identifier) throws IllegalAccessFault, IllegalArgumentFault {
+        String identifier = remove.getRemove().getIdentifier();
+
+        return remove(Long.parseLong(identifier));
+    }
+    
+    public RemoveResponseDocument remove(Long id) throws IllegalArgumentFault, IllegalAccessFault {
+        Task t = Task.load(hiseEngine, id);
+        TaskChecker.checkHumanRolePermission(HumanOperationName.REMOVE, getUserString(), t);
+        t.setCurrentUser(getUserString());
+        t.remove();
+
+        RemoveResponseDocument responseDocument = RemoveResponseDocument.Factory.newInstance();
+        RemoveResponseDocument.RemoveResponse response = RemoveResponseDocument.RemoveResponse.Factory.newInstance();
+        responseDocument.setRemoveResponse(response);
+
+        return responseDocument;
+    }
+    public ResumeResponseDocument resume(ResumeDocument resume) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void resume(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = resume.getResume().getIdentifier();
+
+        // OrgEntity user = loadUser();
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.RESUME, getUserString(), t);
+        TaskChecker.checkStatePermission(HumanOperationName.RESUME, t);
+        t.setCurrentUser(getUserString());
+        
+        try {
+            t.resume();
+        } catch (HiseIllegalStateException e) {
+            throw new IllegalStateFault(e.getMessage());
+        }
+
+        ResumeResponseDocument responseDocument = ResumeResponseDocument.Factory.newInstance();
+        ResumeResponseDocument.ResumeResponse response = ResumeResponseDocument.ResumeResponse.Factory.newInstance();
+        responseDocument.setResumeResponse(response);
+
+        return responseDocument;
+    }
+
+    public GetTaskInfoResponseDocument getTaskInfo(GetTaskInfoDocument getTaskInfo) throws IllegalArgumentFault {
+//    public org.apache.hise.lang.xsd.htda.TTask getTaskInfo(String identifier) throws IllegalArgumentFault {
+        String identifier = getTaskInfo.getGetTaskInfo().getIdentifier();
+        return getTaskInfo(Long.parseLong(identifier));
+    }
+    
+    public GetTaskInfoResponseDocument getTaskInfo(Long id) throws IllegalArgumentFault {
+        GetTaskInfoResponseDocument responseDocument = GetTaskInfoResponseDocument.Factory.newInstance();
+        GetTaskInfoResponseDocument.GetTaskInfoResponse response = GetTaskInfoResponseDocument.GetTaskInfoResponse.Factory.newInstance();
+        response.setTask(convertTask(hiseEngine.getHiseDao().find(org.apache.hise.dao.Task.class, id).getId()));
+        responseDocument.setGetTaskInfoResponse(response);
+        return responseDocument;
+    }
+    
+
+    public ClaimResponseDocument claim(ClaimDocument claim) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void claim(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+        String identifier = claim.getClaim().getIdentifier();
+
+        Task task = Task.load(hiseEngine, Long.valueOf(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.CLAIM, getUserString(), task);
+        TaskChecker.checkStatePermission(HumanOperationName.CLAIM, task);
+        task.setCurrentUser(getUserString());
+        
+        try {
+            task.claim();
+        } catch (HiseIllegalStateException e) {
+            throw new IllegalStateFault(e.getMessage());
+        } catch (HiseIllegalAccessException e) {
+            throw new IllegalAccessFault(e.getMessage());
+        }
+
+        ClaimResponseDocument responseDocument = ClaimResponseDocument.Factory.newInstance();
+        ClaimResponseDocument.ClaimResponse response = ClaimResponseDocument.ClaimResponse.Factory.newInstance();
+        responseDocument.setClaimResponse(response);
+
+        return responseDocument;
+    }
+
+    public FailResponseDocument fail(FailDocument fail) throws IllegalArgumentFault, IllegalStateFault, IllegalOperationFault, IllegalAccessFault {
+//    public void fail(String identifier, String faultName, Object faultData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault,
+//            IllegalOperationFault {
+        String identifier = fail.getFail().getIdentifier();
+        String faultName = fail.getFail().getFaultName();
+        XmlObject faultData = fail.getFail().getFaultData();
+
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.FAIL, getUserString(), t);
+        t.setCurrentUser(getUserString());
+        
+        try {
+            t.fail();
+        } catch (HiseIllegalStateException e) {
+            throw new IllegalStateFault(e.getMessage());
+        }
+
+        FailResponseDocument responseDocument = FailResponseDocument.Factory.newInstance();
+        FailResponseDocument.FailResponse response = FailResponseDocument.FailResponse.Factory.newInstance();
+        responseDocument.setFailResponse(response);
+
+        return responseDocument;
+    }
+
+    public ForwardResponseDocument forward(ForwardDocument forward) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void forward(String identifier, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = forward.getForward().getIdentifier();
+        TOrganizationalEntity organizationalEntity = forward.getForward().getOrganizationalEntity();
+
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.FORWARD, getUserString(), t);
+        TaskChecker.checkStatePermission(HumanOperationName.FORWARD, t);
+        t.setCurrentUser(getUserString());
+        
+        try {
+            t.forward(organizationalEntity);
+        } catch (HiseIllegalStateException e) {
+            throw new IllegalStateFault(e.getMessage());
+        }
+
+        ForwardResponseDocument responseDocument = ForwardResponseDocument.Factory.newInstance();
+        ForwardResponseDocument.ForwardResponse response = ForwardResponseDocument.ForwardResponse.Factory.newInstance();
+        responseDocument.setForwardResponse(response);
+
+        return responseDocument;
+    }
+
+    public GetTaskDescriptionResponseDocument getTaskDescription(GetTaskDescriptionDocument getTaskDescription) throws IllegalArgumentFault {
+//    public String getTaskDescription(String identifier, String contentType) throws IllegalArgumentFault {
+        String identifier = getTaskDescription.getGetTaskDescription().getIdentifier();
+        String contentType = getTaskDescription.getGetTaskDescription().getContentType();
+
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        t.setCurrentUser(getUserString());
+
+        GetTaskDescriptionResponseDocument responseDocument = GetTaskDescriptionResponseDocument.Factory.newInstance();
+        GetTaskDescriptionResponseDocument.GetTaskDescriptionResponse response = GetTaskDescriptionResponseDocument.GetTaskDescriptionResponse.Factory.newInstance();
+        response.setDescription(t.getTaskEvaluator().evalPresentationDescription());
+        responseDocument.setGetTaskDescriptionResponse(response);
+        return responseDocument;
+    }
+
+    public ReleaseResponseDocument release(ReleaseDocument release) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+        String identifier = release.getRelease().getIdentifier();
+       return release( Long.parseLong(identifier));
+     
+    }
+    public ReleaseResponseDocument release(Long id) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+          Task t = Task.load(hiseEngine, id);
+          TaskChecker.checkHumanRolePermission(HumanOperationName.RELEASE, getUserString(), t);
+          t.setCurrentUser(getUserString());
+          
+          try {
+              t.release();
+          } catch (HiseIllegalStateException e) {
+              throw new IllegalStateFault(e.getMessage());
+          }
+
+          ReleaseResponseDocument responseDocument = ReleaseResponseDocument.Factory.newInstance();
+          ReleaseResponseDocument.ReleaseResponse response = ReleaseResponseDocument.ReleaseResponse.Factory.newInstance();
+          responseDocument.setReleaseResponse(response);
+
+          return responseDocument;
+      }
+
+    public StartResponseDocument start(StartDocument start) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void start(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+        String identifier = start.getStart().getIdentifier();
+
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.START, getUserString(), t);
+        TaskChecker.checkStatePermission(HumanOperationName.START, t);
+        t.setCurrentUser(getUserString());
+        
+        try {
+            t.start();
+        } catch (HiseIllegalStateException e) {
+            throw new IllegalStateFault(e.getMessage());
+        }
+
+        StartResponseDocument responseDocument = StartResponseDocument.Factory.newInstance();
+        StartResponseDocument.StartResponse response = StartResponseDocument.StartResponse.Factory.newInstance();
+        responseDocument.setStartResponse(response);
+
+        return responseDocument;
+    }
+    
+
+
+    public CompleteResponseDocument complete(CompleteDocument complete) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void complete(String identifier, Object taskData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = complete.getComplete().getIdentifier();
+        XmlObject taskData = complete.getComplete().getTaskData();
+
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.COMPLETE, getUserString(), t);
+        t.setCurrentUser(getUserString());
+        //TODO set output
+        //t.setOutput(((Node) taskData).getFirstChild());
+        
+        try {
+            t.complete();
+        } catch (HiseIllegalStateException e) {
+            throw new IllegalStateFault(e.getMessage());
+        }
+
+        CompleteResponseDocument.CompleteResponse response = CompleteResponseDocument.CompleteResponse.Factory.newInstance();
+        CompleteResponseDocument responseDocument = CompleteResponseDocument.Factory.newInstance();
+        responseDocument.setCompleteResponse(response);
+        return responseDocument;
+    }
+
+    public SetOutputResponseDocument setOutput(SetOutputDocument setOutput) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void setOutput(String identifier, String part, Object taskData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = setOutput.getSetOutput().getIdentifier();
+        String part = setOutput.getSetOutput().getPart();
+        XmlObject taskData = setOutput.getSetOutput().getTaskData();
+
+        Task t = Task.load(hiseEngine, Long.valueOf(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_OUTPUT, getUserString(), t);
+        t.setCurrentUser(getUserString());
+        t.setOutput(((Node) taskData.getDomNode()).getFirstChild());
+
+        SetOutputResponseDocument responseDocument = SetOutputResponseDocument.Factory.newInstance();
+        SetOutputResponseDocument.SetOutputResponse response = SetOutputResponseDocument.SetOutputResponse.Factory.newInstance();
+        responseDocument.setSetOutputResponse(response);
+
+        return responseDocument;
+    }
+
+	/**
+	 * Adds comment to a task. Can be performed by: 
+	 * - potential owners 
+	 * - actual owner 
+	 * - business administrators
+	 * 
+	 * @param identifier task's identifier
+	 * @param text comment to add
+	 */
+    public AddCommentResponseDocument addComment(AddCommentDocument addComment) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//	public void addComment(String identifier, String text) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = addComment.getAddComment().getIdentifier();
+        String text = addComment.getAddComment().getText();
+
+	Task task = Task.load(hiseEngine, new Long(identifier));
+	TaskChecker.checkHumanRolePermission(HumanOperationName.ADD_COMMENT, getUserString(), task);
+	org.apache.hise.dao.Task taskDto = task.getTaskDto();
+	org.apache.hise.dao.Comment newComment = new Comment(text, taskDto, getUserString());
+	taskDto.getComments().add(newComment);
+
+        AddCommentResponseDocument responseDocument = AddCommentResponseDocument.Factory.newInstance();
+        AddCommentResponseDocument.AddCommentResponse response = AddCommentResponseDocument.AddCommentResponse.Factory.newInstance();
+        responseDocument.setAddCommentResponse(response);
+
+        return responseDocument;
+    }
+
+	/**
+	 * Gets all comments of a task.
+	 * Can be performed by:
+	 *  - potential owners
+	 *  - actual owner
+	 *  - business administrators
+	 *  
+	 *  @param identifier task's identifier
+	 */
+    public GetCommentsResposneDocument getComments(GetCommentsDocument getComments) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    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);
+        org.apache.hise.dao.Task taskDto = task.getTaskDto();
+        List<TComment> result = convertComments(taskDto.getComments());
+
+        GetCommentsResposneDocument resposneDocument = GetCommentsResposneDocument.Factory.newInstance();
+        GetCommentsResposneDocument.GetCommentsResposne resposne = GetCommentsResposneDocument.GetCommentsResposne.Factory.newInstance();
+        TComment[] commentArray = new TComment[result.size()];
+        commentArray = result.toArray(commentArray);
+        resposne.setCommentArray(commentArray);
+        resposneDocument.setGetCommentsResposne(resposne);
+
+        return resposneDocument;
+    }
+
+    // not started
+
+    public QueryResponseDocument query(QueryDocument query) throws IllegalArgumentFault, IllegalStateFault {
+//    public TTaskQueryResultSet query(String selectClause, String whereClause, String orderByClause, Integer maxTasks, Integer taskIndexOffset)
+//            throws IllegalArgumentFault, IllegalStateFault {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ActivateResponseDocument activate(ActivateDocument activate) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void activate(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = activate.getActivate().getIdentifier();
+    	Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.ACTIVATE, getUserString(), task);
+        TaskChecker.checkStatePermission(HumanOperationName.ACTIVATE, task);
+        
+        task.activate();
+       
+        try {
+        	task.setStatus(Status.READY);
+        } catch (HiseIllegalStateException e) {
+        	throw new IllegalStateFault("Illegal State Fault");
+        }
+        task.setCurrentUser(getUserString());
+
+        ActivateResponseDocument responseDocument = ActivateResponseDocument.Factory.newInstance();
+        ActivateResponseDocument.ActivateResponse response = ActivateResponseDocument.ActivateResponse.Factory.newInstance();
+        responseDocument.setActivateResponse(response);
+
+        return responseDocument;
+    }
+
+    public AddAttachmentResponseDocument addAttachment(AddAttachmentDocument addAttachment) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void addAttachment(String identifier, String attachmentName, String accessType, Object attachment) throws IllegalAccessFault, IllegalStateFault,
+//            IllegalArgumentFault {
+
+        String identifier = addAttachment.getAddAttachment().getIdentifier();
+                String attachmentName = addAttachment.getAddAttachment().getName();
+                String accessType = addAttachment.getAddAttachment().getAccessType();
+                XmlObject attachment = addAttachment.getAddAttachment().getAttachment();
+
+        Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.ADD_ATTACHMENT, getUserString(), task);
+        
+        org.apache.hise.dao.Task taskDto = task.getTaskDto();
+        org.apache.hise.dao.Attachment newAttachment= new Attachment();
+        newAttachment.setAccessType(accessType);
+        newAttachment.setName(attachmentName);
+        newAttachment.setAttachedAt(new Date());
+        newAttachment.setTask(taskDto);
+        newAttachment.setUserName(getUserString());
+        if(attachment.getDomNode() instanceof org.w3c.dom.Element){
+        	newAttachment.setAttachment(DOMUtil.getChildText(attachment.getDomNode()));
+        }
+        else{
+        	newAttachment.setAttachment(new String(""));
+        }
+        taskDto.getAttachments().add(newAttachment);
+
+        AddAttachmentResponseDocument responseDocument = AddAttachmentResponseDocument.Factory.newInstance();
+        AddAttachmentResponseDocument.AddAttachmentResponse response = AddAttachmentResponseDocument.AddAttachmentResponse.Factory.newInstance();
+        responseDocument.setAddAttachmentResponse(response);
+
+        return responseDocument;
+    }
+
+
+    public DelegateResponseDocument delegate(DelegateDocument delegate) throws RecipientNotAllowed, IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void delegate(String identifier, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, RecipientNotAllowed,
+//            IllegalArgumentFault {
+        String identifier = delegate.getDelegate().getIdentifier();
+        TOrganizationalEntity organizationalEntity = delegate.getDelegate().getOrganizationalEntity();
+
+        Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.DELEGATE, getUserString(), task);
+        TaskChecker.checkStatePermission(HumanOperationName.DELEGATE, task);
+        
+        String userID = task.checkCanDelegate(organizationalEntity);
+        task.setCurrentUser(getUserString());
+        
+        try {
+			task.setActualOwner(userID);
+			task.addGenericHumanRole(userID, GenericHumanRole.POTENTIALOWNERS);
+		} catch (HiseIllegalStateException e) {
+			throw new IllegalStateFault();
+		}
+
+        DelegateResponseDocument responseDocument = DelegateResponseDocument.Factory.newInstance();
+        DelegateResponseDocument.DelegateResponse response = DelegateResponseDocument.DelegateResponse.Factory.newInstance();
+        responseDocument.setDelegateResponse(response);
+
+        return responseDocument;
+    }
+    
+    public DeleteAttachmentsResponseDocument deleteAttachments(DeleteAttachmentsDocument deleteAttachments) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void deleteAttachments(String identifier, String attachmentName) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = deleteAttachments.getDeleteAttachments().getIdentifier();
+        String attachmentName = deleteAttachments.getDeleteAttachments().getAttachmentName();
+
+        Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.DELETE_ATTACHMENTS, getUserString(), task);
+        org.apache.hise.dao.Task taskDto = task.getTaskDto();
+        List<Attachment> attachments=taskDto.getAttachments();
+        Iterator<Attachment> attachemntIterator=attachments.iterator();
+        Attachment attachment;
+        while(attachemntIterator.hasNext()){
+        	attachment=attachemntIterator.next();
+        	if(attachment.getName().equals(attachmentName)){
+        		hiseEngine.getHiseDao().remove(attachment);
+        		attachemntIterator.remove();
+        	}
+        }
+//        TODO Attachments provided by
+//        the enclosing context are
+//        not affected by this
+//        operation.
+
+
+        DeleteAttachmentsResponseDocument responseDocument = DeleteAttachmentsResponseDocument.Factory.newInstance();
+        DeleteAttachmentsResponseDocument.DeleteAttachmentsResponse response = DeleteAttachmentsResponseDocument.DeleteAttachmentsResponse.Factory.newInstance();
+        responseDocument.setDeleteAttachmentsResponse(response);
+
+        return responseDocument;
+        
+
+    }
+
+    public DeleteFaultResponseDocument deleteFault(DeleteFaultDocument deleteFault) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void deleteFault(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = deleteFault.getDeleteFault().getIdentifier();
+
+    	Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.DELELE_FAULT, getUserString(), task);
+        task.setCurrentUser(getUserString());
+        // TODO Auto-generated method stub
+
+        DeleteFaultResponseDocument responseDocument = DeleteFaultResponseDocument.Factory.newInstance();
+        DeleteFaultResponseDocument.DeleteFaultResponse response = DeleteFaultResponseDocument.DeleteFaultResponse.Factory.newInstance();
+        responseDocument.setDeleteFaultResponse(response);
+
+        return responseDocument;
+
+    }
+
+    public DeleteOutputResponseDocument deleteOutput(DeleteOutputDocument deleteOutput) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void deleteOutput(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = deleteOutput.getDeleteOutput().getIdentifier();
+
+    	Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.DELETE_OUTPUT, getUserString(), task);
+        task.setCurrentUser(getUserString());
+        // TODO Auto-generated method stub
+
+        DeleteOutputResponseDocument responseDocument = DeleteOutputResponseDocument.Factory.newInstance();
+        DeleteOutputResponseDocument.DeleteOutputResponse response = DeleteOutputResponseDocument.DeleteOutputResponse.Factory.newInstance();
+        responseDocument.setDeleteOutputResponse(response);
+
+        return responseDocument;
+    }
+
+    public GetAttachmentInfosResponseDocument getAttachmentInfos(GetAttachmentInfosDocument getAttachmentInfos) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public List<TAttachmentInfo> getAttachmentInfos(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = getAttachmentInfos.getGetAttachmentInfos().getIdentifier();
+
+        Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_ATTACHMENT_INFOS, getUserString(), task);
+        org.apache.hise.dao.Task taskDto = task.getTaskDto();
+        List<Attachment> attachments=taskDto.getAttachments();
+        List<TAttachmentInfo> result= new ArrayList<TAttachmentInfo>();
+        for(Attachment a: attachments){
+        	TAttachmentInfo info=TAttachmentInfo.Factory.newInstance();
+        	info.setName(a.getName());
+                Calendar attachedAt =  Calendar.getInstance();
+                attachedAt.setTime(a.getAttachedAt());
+                info.setAttachedAt(attachedAt);
+                info.setAccessType(a.getAccessType());
+        	info.setAttachedBy(a.getuserName());
+
+        	result.add(info);
+        }
+
+        GetAttachmentInfosResponseDocument responseDocument =  GetAttachmentInfosResponseDocument.Factory.newInstance();
+        GetAttachmentInfosResponseDocument.GetAttachmentInfosResponse infosResponse = GetAttachmentInfosResponseDocument.GetAttachmentInfosResponse.Factory.newInstance();
+        TAttachmentInfo[] attachmentInfos = new TAttachmentInfo[result.size()];
+        attachmentInfos = result.toArray(attachmentInfos);
+        infosResponse.setInfoArray(attachmentInfos);
+        responseDocument.setGetAttachmentInfosResponse(infosResponse);
+        return responseDocument;
+
+    }
+
+    public GetAttachmentsResponseDocument getAttachments(GetAttachmentsDocument getAttachments) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public List<TAttachment> getAttachments(String identifier, String attachmentName) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+
+        String identifier = getAttachments.getGetAttachments().getIdentifier();
+        String attachmentName = getAttachments.getGetAttachments().getAttachmentName();
+
+        Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_ATTACHMENTS, getUserString(), task);
+        org.apache.hise.dao.Task taskDto = task.getTaskDto();
+        List<Attachment> attachments=taskDto.getAttachments();
+        List<TAttachment> result= new ArrayList<TAttachment>();
+        for(Attachment a: attachments){
+        	if(a.getName().equals(attachmentName)){
+        	TAttachment ta=TAttachment.Factory.newInstance();
+        	TAttachmentInfo info=TAttachmentInfo.Factory.newInstance();
+        	info.setName(a.getName());
+                Calendar attachedAt =  Calendar.getInstance();
+                attachedAt.setTime(a.getAttachedAt());
+                info.setAttachedAt(attachedAt);
+                info.setAccessType(a.getAccessType());
+
+        	info.setAttachedBy(a.getuserName());
+                info.setContentType(a.getContentType());
+
+        	ta.setAttachmentInfo(info);
+                ta.addNewValue().set(XmlString.Factory.newValue(a.getAttachment()));
+
+        	result.add(ta);
+        	}
+        }
+        GetAttachmentsResponseDocument responseDocument = GetAttachmentsResponseDocument.Factory.newInstance();
+        GetAttachmentsResponseDocument.GetAttachmentsResponse response = GetAttachmentsResponseDocument.GetAttachmentsResponse.Factory.newInstance();
+        TAttachment[] attachmentsArray = new TAttachment[result.size()];
+        attachmentsArray = result.toArray(attachmentsArray);
+        response.setAttachmentArray(attachmentsArray);
+        responseDocument.setGetAttachmentsResponse(response);
+
+        return responseDocument;
+
+    }
+
+    /**
+     * Returns the rendering specified by the type.
+     * Applies to both tasks and notifications.
+     * @param identifier task identifier
+     * @param renderingType rendering type
+     * @return any type
+     * @since 0.3.0
+     */
+    public GetRenderingResponseDocument getRendering(GetRenderingDocument getRendering) throws IllegalArgumentFault {
+//    public Object getRendering(Object identifier, QName renderingType) throws IllegalArgumentFault {
+        String identifier = getRendering.getGetRendering().getIdentifier();
+        QName renderingType = getRendering.getGetRendering().getRenderingType();
+
+//        if(identifier.getDomNode() instanceof org.w3c.dom.Element){
+//                Long id = new Long(DOMUtil.getChildText(identifier.getDomNode()));
+        Long id = new Long(identifier);
+    		Task task = Task.load(hiseEngine, id);
+            TRenderings tr = task.getTaskDefinition().getRenderings();
+            TRendering rendering = null;
+            for(TRendering r: tr.getRenderingList()){
+            	if(renderingType.equals(r.getType())){
+            		rendering = r;
+            		break;
+            	}
+            }
+            if(rendering == null) return null;
+
+            GetRenderingResponseDocument responseDocument = GetRenderingResponseDocument.Factory.newInstance();
+            GetRenderingResponseDocument.GetRenderingResponse response = GetRenderingResponseDocument.GetRenderingResponse.Factory.newInstance();
+            try {
+                response.setRendering(XmlObject.Factory.parse(convertRendering(rendering, task)));
+            } catch (XmlException ex) {
+                throw new RuntimeException(ex);
+            }
+            responseDocument.setGetRenderingResponse(response);
+
+            return responseDocument;
+//        }
+//        return null;
+   
+    }
+
+	private Element convertRendering(TRendering rendering, Task task) {
+		Node rend = DOMUtil.getFirstChildElement(rendering.getDomNode(),"expression");
+		TaskEvaluator evaluator = task.getTaskEvaluator();
+		String expression = DOMUtil.getChildText(rend);
+
+		List queryResponse = evaluator.buildQueryEvaluator(rend)
+				.evaluateExpression(expression, null);
+
+		if (queryResponse.get(0) instanceof Node) {
+			Document result = convertRenderingFromXML((Node) queryResponse.get(0));
+			return result == null ? null : result.getDocumentElement();
+		} else {
+			Document result = convertRenderingFromString(queryResponse.get(0).toString());
+			return result == null ? null : result.getDocumentElement();
+		}
+	}
+
+	private Document convertRenderingFromString(String response) {
+		Document resultDocument = DOMUtils.createEmptyDomDocument(); 
+		if(resultDocument==null)//there was problem with create document
+			return null;
+		Element element = resultDocument.createElement("root");
+		element.appendChild(resultDocument.createTextNode(response)); 
+		resultDocument.appendChild(element);
+		return resultDocument;
+	}
+
+    private Document convertRenderingFromXML(Node response) {
+        Document resultDocument = DOMUtils.createEmptyDomDocument();
+        if (resultDocument == null) {//there was problem with create document
+            return null;
+        }
+        resultDocument.appendChild(resultDocument.importNode(response, true));
+        return resultDocument;
+    }
+	
+
+	/**
+     * Returns the rendering types available for the task or notification.
+     * @param identifier task identifier
+     * @return available renderings
+     * @since 0.3.0
+     */
+    public GetRenderingTypesResponseDocument getRenderingTypes(GetRenderingTypesDocument getRenderingTypes) throws IllegalArgumentFault {
+//    public List<QName> getRenderingTypes(Object identifier) throws IllegalArgumentFault {
+        XmlObject identifier = getRenderingTypes.getGetRenderingTypes().getIdentifier();
+
+        List<QName> result=new ArrayList<QName>();
+    	if(identifier.getDomNode() instanceof org.w3c.dom.Element){
+//    		Long id=DOMUtils.domToLong((org.w3c.dom.Element)identifier);
+                Long id = new Long(DOMUtil.getChildText(identifier.getDomNode()));
+    		Task task = Task.load(hiseEngine, id);
+            TRenderings tr = task.getTaskDefinition().getRenderings();
+            for(TRendering r: tr.getRenderingList()){
+            	result.add(r.getType());
+            }
+        }
+        GetRenderingTypesResponseDocument responseDocument = GetRenderingTypesResponseDocument.Factory.newInstance();
+        GetRenderingTypesResponseDocument.GetRenderingTypesResponse response = GetRenderingTypesResponseDocument.GetRenderingTypesResponse.Factory.newInstance();
+        QName[] renderingTypeArray = new QName[result.size()];
+        renderingTypeArray = result.toArray(renderingTypeArray);
+        response.setRenderingTypeArray(renderingTypeArray);
+        responseDocument.setGetRenderingTypesResponse(response);
+
+        return responseDocument;
+    }
+
+    public NominateResponseDocument nominate(NominateDocument nominate) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void nominate(String identifier, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = nominate.getNominate().getIdentifier();
+        TOrganizationalEntity organizationalEntity = nominate.getNominate().getOrganizationalEntity();
+
+        Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.NOMINATE, getUserString(), task);
+        TaskChecker.checkStatePermission(HumanOperationName.NOMINATE, task);
+ 
+        TUserlist tUsers = organizationalEntity.getUsers();
+        TGrouplist tGroup = organizationalEntity.getGroups();
+        try {
+        	//When only one user is nominate, he become ActualOwner
+        	if((tGroup == null)&&(tUsers != null)&&(tUsers.getUserList().size() == 1)){
+       			task.setActualOwner(tUsers.getUserList().get(0));
+       			task.addGenericHumanRole(tUsers.getUserList().get(0), GenericHumanRole.POTENTIALOWNERS);
+       		}else{
+       			if(tGroup != null){
+       				for(String group: tGroup.getGroupList())
+       					task.addGenericHumanRole(group, GenericHumanRole.POTENTIALOWNERS);
+        		}
+        		if(tUsers != null){
+        			for(String user: tUsers.getUserList())
+       					task.addGenericHumanRole(user,GenericHumanRole.POTENTIALOWNERS);
+       			}
+       			task.setStatus(Status.READY);
+       		}
+       	} catch (HiseIllegalStateException e) {
+       		throw new IllegalStateFault("Illegal State Fault");
+       	}
+
+        NominateResponseDocument responseDocument = NominateResponseDocument.Factory.newInstance();
+        NominateResponseDocument.NominateResponse response = NominateResponseDocument.NominateResponse.Factory.newInstance();
+        responseDocument.setNominateResponse(response);
+
+        return responseDocument;
+    }
+
+    public SetFaultResponseDocument setFault(SetFaultDocument setFault) throws IllegalArgumentFault, IllegalStateFault, IllegalOperationFault, IllegalAccessFault {
+//    public void setFault(String identifier, String faultName, Object faultData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault,
+//            IllegalOperationFault {
+        String identifier = setFault.getSetFault().getIdentifier();
+        String faultName =  setFault.getSetFault().getFaultName();
+
+    	Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_FAULT, getUserString(), task);
+        task.setCurrentUser(getUserString());
+        // TODO Auto-generated method stub
+
+        SetFaultResponseDocument responseDocument = SetFaultResponseDocument.Factory.newInstance();
+        SetFaultResponseDocument.SetFaultResponse response = SetFaultResponseDocument.SetFaultResponse.Factory.newInstance();
+        responseDocument.setSetFaultResponse(response);
+
+        return responseDocument;
+    }
+
+    public SetGenericHumanRoleResponseDocument setGenericHumanRole(SetGenericHumanRoleDocument setGenericHumanRole) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void setGenericHumanRole(String identifier, String genericHumanRole, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault,
+//            IllegalStateFault, IllegalArgumentFault {
+
+        String identifier = setGenericHumanRole.getSetGenericHumanRole().getIdentifier();
+        String genericHumanRole = setGenericHumanRole.getSetGenericHumanRole().getGenericHumanRole();
+        TOrganizationalEntity organizationalEntity = setGenericHumanRole.getSetGenericHumanRole().getOrganizationalEntity();
+
+    	Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_GENERIC_HUMAN_ROLE, getUserString(), task);
+    	
+        TUserlist tUsers = organizationalEntity.getUsers();
+        TGrouplist tGroup = organizationalEntity.getGroups();
+        Set<String> orgEntityName = new HashSet<String>();
+        if(tUsers != null){
+        	for(String e: tUsers.getUserList())
+        		orgEntityName.add(e);
+        }
+        if(tGroup != null){
+        	for(String e: tGroup.getGroupList())
+        		orgEntityName.add(e);
+        }
+        	
+        for(String i: orgEntityName){
+        	for(TaskOrgEntity e: task.getTaskDto().getPeopleAssignments()){
+        		if(i.equals(e.getName())){
+        			hiseEngine.getHiseDao().remove(e);
+        	}
+        }
+        	task.addGenericHumanRole(i, GenericHumanRole.valueOf(genericHumanRole));
+        }
+
+        SetGenericHumanRoleResponseDocument responseDocument = SetGenericHumanRoleResponseDocument.Factory.newInstance();
+        SetGenericHumanRoleResponseDocument.SetGenericHumanRoleResponse response = SetGenericHumanRoleResponseDocument.SetGenericHumanRoleResponse.Factory.newInstance();
+        responseDocument.setSetGenericHumanRoleResponse(response);
+
+        return responseDocument;
+    }
+
+    public SetPriorityResponseDocument setPriority(SetPriorityDocument setPriority) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+//    public void setPriority(String identifier, BigInteger priority) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        String identifier = setPriority.getSetPriority().getIdentifier();
+        BigInteger priority = setPriority.getSetPriority().getPriority();
+
+        Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SET_PRIORITY, getUserString(), task);
+        org.apache.hise.dao.Task taskDto = task.getTaskDto();
+        taskDto.setPriority(priority.intValue());
+
+        SetPriorityResponseDocument responseDocument = SetPriorityResponseDocument.Factory.newInstance();
+        SetPriorityResponseDocument.SetPriorityResponse response = SetPriorityResponseDocument.SetPriorityResponse.Factory.newInstance();
+        responseDocument.setSetPriorityResponse(response);
+
+        return responseDocument;
+    }
+
+    public SkipResponseDocument skip(SkipDocument skip) throws IllegalArgumentFault, IllegalStateFault, IllegalOperationFault, IllegalAccessFault {
+//    public void skip(String identifier) throws
+//    			IllegalAccessFault, IllegalStateFault, IllegalArgumentFault,
+//    				IllegalOperationFault {
+        String identifier = skip.getSkip().getIdentifier();
+
+        Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.SKIP, getUserString(), task);
+        task.setCurrentUser(getUserString());
+        org.apache.hise.dao.Task taskDto = task.getTaskDto();
+        if(taskDto.isSkippable()){
+        try {
+			task.setStatus(Status.OBSOLETE);
+		} catch (HiseIllegalStateException e) {
+			 throw new IllegalStateFault("Task is not skipable");	
+		}
+        }
+
+        SkipResponseDocument responseDocument = SkipResponseDocument.Factory.newInstance();
+        SkipResponseDocument.SkipResponse response = SkipResponseDocument.SkipResponse.Factory.newInstance();
+        responseDocument.setSkipResponse(response);
+
+        return responseDocument;
+        
+    }
+
+    public GetFaultResponseDocument getFault(GetFaultDocument getFault) throws IllegalArgumentFault, IllegalStateFault, IllegalOperationFault, IllegalAccessFault {
+//    public void getFault(String identifier, Holder<String> faultName, Holder<Object> faultData) throws IllegalArgumentFault, IllegalStateFault,
+//            IllegalOperationFault, IllegalAccessFault {
+        String identifier = getFault.getGetFault().getIdentifier();
+        String faultName = getFault.getGetFault().getFaultName();
+
+    	Task task = Task.load(hiseEngine, new Long(identifier));
+        TaskChecker.checkHumanRolePermission(HumanOperationName.GET_FAULT, getUserString(), task);
+    	
+        // TODO Auto-generated method stub
+
+        GetFaultResponseDocument responseDocument = GetFaultResponseDocument.Factory.newInstance();
+        GetFaultResponseDocument.GetFaultResponse response = GetFaultResponseDocument.GetFaultResponse.Factory.newInstance();
+        responseDocument.setGetFaultResponse(response);
+        
+        return responseDocument;
+
+    }
+
+    public GetMyTaskAbstractsResponseDocument getMyTaskAbstracts(GetMyTaskAbstractsDocument getMyTaskAbstracts) throws IllegalArgumentFault, IllegalStateFault {
+    //public List<TTaskAbstract> getMyTaskAbstracts(String taskType, String genericHumanRole, String workQueue, List<TStatus> status, String whereClause,
+//            String createdOnClause, Integer maxTasks) throws IllegalArgumentFault, IllegalStateFault {
+
+        String taskType = getMyTaskAbstracts.getGetMyTaskAbstracts().getTaskType();
+        String genericHumanRole = getMyTaskAbstracts.getGetMyTaskAbstracts().getGenericHumanRole();
+        String workQueue = getMyTaskAbstracts.getGetMyTaskAbstracts().getWorkQueue();
+        List<TStatus.Enum> status = getMyTaskAbstracts.getGetMyTaskAbstracts().getStatusList();
+        String whereClause = getMyTaskAbstracts.getGetMyTaskAbstracts().getWhereClause();
+        String createdOnClause = getMyTaskAbstracts.getGetMyTaskAbstracts().getCreatedOnClause();
+        Integer maxTasks = getMyTaskAbstracts.getGetMyTaskAbstracts().getMaxTasks();
+
+        List<TTaskAbstract> result = new ArrayList<TTaskAbstract>();
+
+        String user = getUserString();
+
+        TaskQuery query = new TaskQuery();
+        query.setUser(user);
+        query.setUserGroups(hiseEngine.getHiseUserDetails().getUserGroups(user));
+        query.setTaskType(taskType);
+        query.setGenericHumanRole(GenericHumanRole.valueOf(genericHumanRole));
+        query.setWorkQueue(workQueue);
+        query.setStatuses(status);
+        query.setWhereClause(whereClause);
+        query.setCreatedOnClause(createdOnClause);
+
+        if (maxTasks != null) {
+            query.setMaxTasks(maxTasks);
+        }
+
+        List<org.apache.hise.dao.Task> tasks = hiseEngine.getHiseDao().getUserTasks(query);
+    
+        for (org.apache.hise.dao.Task u : tasks) {
+        	TTaskAbstract t = convertTasktoTTaskAbstract(u.getId());
+            result.add(t);
+        }
+
+        GetMyTaskAbstractsResponseDocument responseDocument = GetMyTaskAbstractsResponseDocument.Factory.newInstance();
+        GetMyTaskAbstractsResponseDocument.GetMyTaskAbstractsResponse response = GetMyTaskAbstractsResponseDocument.GetMyTaskAbstractsResponse.Factory.newInstance();
+        TTaskAbstract[] taskArray = new TTaskAbstract[result.size()];
+        taskArray = result.toArray(taskArray);
+        response.setTaskAbstractArray(taskArray);
+        responseDocument.setGetMyTaskAbstractsResponse(response);
+
+        return responseDocument;
+    }
+
+    private TTaskAbstract convertTasktoTTaskAbstract(Long id) {
+    	Task task = Task.load(hiseEngine, id);
+        org.apache.hise.dao.Task taskDto = task.getTaskDto();
+
+        TTaskAbstract result = TTaskAbstract.Factory.newInstance();
+        result.setId(taskDto.getId().toString());
+            result.setTaskType(taskDto.isNotification() ? "NOTIFICATION" : "TASK");
+            Calendar createdOn = Calendar.getInstance();
+            createdOn.setTime(taskDto.getCreatedOn());
+            result.setCreatedOn(createdOn);
+            Calendar activationTime = Calendar.getInstance();
+            activationTime.setTime(taskDto.getActivationTime());
+            result.setActivationTime(activationTime);
+            result.setPresentationName(task.getTaskEvaluator().getPresentationName());
+            result.setPresentationSubject(task.getTaskEvaluator().evalPresentationSubject());
+            result.setName(taskDto.getTaskDefinitionName());
+            result.setStatus(TStatus.Enum.forString(taskDto.getStatus().toString()));
+
+
+
+        
+//        TOrganizationalEntity tOrganizational = new TOrganizationalEntity();
+//        TUserlist users=new TUserlist();
+//        //TGrouplist groups=new TGrouplist();
+//        for(TaskOrgEntity o : taskDto.getPotentialOwners()){
+//        	if(o.getType()==OrgEntityType.USER)
+//        		users.getUser().add(o.getName());
+//        }
+//        if(!users.getUser().isEmpty())
+//        	tOrganizational.withUsers(users);
+//        if(!users.getUser().isEmpty() )
+//        	result.setPotentialOwners(tOrganizational);
+   
+             
+        result.setPriority(new BigInteger(new Integer(taskDto.getPriority()).toString()));
+        result.setIsSkipable(taskDto.isSkippable());
+
+             
+        result.setPriority(new BigInteger(new Integer(taskDto.getPriority()).toString()));
+        result.setIsSkipable(taskDto.isSkippable());
+
+
+        return result;
+		
+	}
+
+	/**
+     * TODO extract converters to external class
+     */
+    private TTask convertTask(Long id) {
+        Task task = Task.load(hiseEngine, id);
+        org.apache.hise.dao.Task taskDto = task.getTaskDto();
+
+        TTask result = TTask.Factory.newInstance();
+        result.setId(taskDto.getId().toString());
+            result.setTaskType(taskDto.isNotification() ? "NOTIFICATION" : "TASK");
+            Calendar createdOn = Calendar.getInstance();
+            createdOn.setTime(taskDto.getCreatedOn());
+            result.setCreatedOn(createdOn);
+            Calendar activationTime = Calendar.getInstance();
+            activationTime.setTime(taskDto.getActivationTime());
+            result.setActivationTime(activationTime);
+            result.setCreatedBy(taskDto.getCreatedBy());
+            result.setPresentationName(task.getTaskEvaluator().getPresentationName());
+            result.setPresentationSubject(task.getTaskEvaluator().evalPresentationSubject());
+            result.setName(taskDto.getTaskDefinitionName());
+            result.setStatus(TStatus.Enum.forString(taskDto.getStatus().toString()));
+
+        if (taskDto.getActualOwner() != null) {
+            result.setActualOwner(taskDto.getActualOwner());
+        
+        }
+//        Vector<TaskOrgEntity> temp=new Vector<TaskOrgEntity>(taskDto.getPeopleAssignments());
+//        int k=temp.size();
+        TOrganizationalEntity tOrganizational = TOrganizationalEntity.Factory.newInstance();
+        TUserlist users=TUserlist.Factory.newInstance();
+        for(TaskOrgEntity o : taskDto.getBusinessAdministrators()){
+        	if(o.getType()==OrgEntityType.USER)
+        		users.getUserList().add(o.getName());
+        }
+        if(!users.getUserList().isEmpty())
+        	tOrganizational.setUsers(users);
+        if(!users.getUserList().isEmpty() )
+        	result.setBusinessAdministrators(tOrganizational);
+        
+        
+        tOrganizational = TOrganizationalEntity.Factory.newInstance();
+        users=TUserlist.Factory.newInstance();
+        for(TaskOrgEntity o : taskDto.getTaskStakeholders()){
+        	if(o.getType()==OrgEntityType.USER)
+        		users.getUserList().add(o.getName());
+        }
+        if(!users.getUserList().isEmpty())
+        	tOrganizational.setUsers(users);
+        if(!users.getUserList().isEmpty() )
+        	result.setTaskStakeholders(tOrganizational);
+        
+        tOrganizational = TOrganizationalEntity.Factory.newInstance();
+        users=TUserlist.Factory.newInstance();
+        //TGrouplist groups=new TGrouplist();
+        for(TaskOrgEntity o : taskDto.getPotentialOwners()){
+        	if(o.getType()==OrgEntityType.USER)
+        		users.getUserList().add(o.getName());
+        }
+        if(!users.getUserList().isEmpty())
+        	tOrganizational.setUsers(users);
+        if(!users.getUserList().isEmpty() )
+        	result.setPotentialOwners(tOrganizational);
+   
+             
+        result.setPriority(new BigInteger(new Integer(taskDto.getPriority()).toString()));
+        result.setIsSkipable(taskDto.isSkippable());
+
+             
+        result.setPriority(new BigInteger(new Integer(taskDto.getPriority()).toString()));
+        result.setIsSkipable(taskDto.isSkippable());
+
+        //TODO
+        result.setRenderingMethodExists(true);
+
+        return result;
+    }
+    
+    
+    
+    /**
+     * TODO extract converters to external class
+     * @param taskDto
+     * @return
+     */
+	private List<TComment> convertComments(List<Comment> comments) {
+        List<TComment> result = new ArrayList<TComment>();
+        for(Comment comment : comments){
+         	result.add(convertComment(comment));
+        }
+	    return result;
+    }
+
+	/**
+	 * 
+	 * @param comment
+	 * @return
+	 */
+	private TComment convertComment(Comment comment) {
+	    TComment tComment=TComment.Factory.newInstance();
+	    tComment.setText(comment.getContent());
+            Calendar addedAt = new GregorianCalendar();
+            addedAt.setTime(comment.getDate());
+            tComment.setAddedAt(addedAt);
+	    tComment.setAddedBy(comment.getUserName());
+	    return tComment;
+    }
+
+    /**
+     * IoC setter.
+     * 
+     * @param hiseEngine
+     */
+    public void setHiseEngine(HISEEngineImpl hiseEngine) {
+        this.hiseEngine = hiseEngine;
+    }
+
+}
\ No newline at end of file



Mime
View raw message