incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r983989 - in /incubator/hise/trunk: hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java hise-wsdl/src/main/resources/ws-humantask-api-wsdl.xsd
Date Tue, 10 Aug 2010 13:25:26 GMT
Author: rr
Date: Tue Aug 10 13:25:26 2010
New Revision: 983989

URL: http://svn.apache.org/viewvc?rev=983989&view=rev
Log:
HISE-69: Change identifier type in getRenderings method to anyURI (Thanks to Maciej Próchniak)

Modified:
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java
    incubator/hise/trunk/hise-wsdl/src/main/resources/ws-humantask-api-wsdl.xsd

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java?rev=983989&r1=983988&r2=983989&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java
Tue Aug 10 13:25:26 2010
@@ -101,13 +101,14 @@ import org.w3c.dom.NodeList;
  * 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 class TaskOperationsImpl implements TaskOperations {
-    
+
     private static final Log log = LogFactory.getLog(TaskOperationsImpl.class);
 
     private HISEEngineImpl hiseEngine;
@@ -117,7 +118,7 @@ public class TaskOperationsImpl implemen
     /**
      * Sets up {@link WebServiceContext} used to lookup authenticated user
      * performing operations.
-     * 
+     *
      * @throws Exception
      */
     public void init() throws Exception {
@@ -132,11 +133,12 @@ public class TaskOperationsImpl implemen
 
     /**
      * {@inheritDoc}
-     * @throws IllegalArgumentFault 
-     * @throws Exception 
+     *
+     * @throws IllegalArgumentFault
+     * @throws Exception
      */
     public List<TTask> getMyTasks(String taskType, String genericHumanRole, String
workQueue, List<TStatus> status, String whereClause, String createdOnClause,
-            Integer maxTasks) throws IllegalArgumentFault  {
+                                  Integer maxTasks) throws IllegalArgumentFault {
 
         List<TTask> result = new ArrayList<TTask>();
 
@@ -146,10 +148,10 @@ public class TaskOperationsImpl implemen
         query.setUser(user);
         query.setUserGroups(hiseEngine.getHiseUserDetails().getUserGroups(user));
         query.setTaskType(taskType);
-        if(genericHumanRole==null)
-        	query.setGenericHumanRole(null);
+        if (genericHumanRole == null)
+            query.setGenericHumanRole(null);
         else
-        	query.setGenericHumanRole(GenericHumanRole.valueOf(genericHumanRole));
+            query.setGenericHumanRole(GenericHumanRole.valueOf(genericHumanRole));
         query.setWorkQueue(workQueue);
         query.setStatuses(status);
         query.setWhereClause(whereClause);
@@ -161,59 +163,53 @@ public class TaskOperationsImpl implemen
 
         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);
+            TTask t = null;
+
+            t = convertTasktoTTask(u);
 
             result.add(t);
         }
 
         return result;
-        
-        
-        
-        
-        
-        
-        
-        
-        
-    }
-	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=new TDeadlinesInfo();
-		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"))
-					result.getStartBy().add((new TDeadlineInfo().withDate(j.getFire()).withName(name)));
-				else
-					result.getCompleteBy().add((new TDeadlineInfo().withDate(j.getFire()).withName(name)));
-		
-				}
-
-		}
-
-	
-		return result;
-	}
+
+
+    }
+
+    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 = new TDeadlinesInfo();
+        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"))
+                    result.getStartBy().add((new TDeadlineInfo().withDate(j.getFire()).withName(name)));
+                else
+                    result.getCompleteBy().add((new TDeadlineInfo().withDate(j.getFire()).withName(name)));
+
+            }
+
+        }
+
+
+        return result;
+    }
 
     /**
      * {@inheritDoc}
@@ -243,7 +239,7 @@ public class TaskOperationsImpl implemen
         TaskChecker.checkHumanRolePermission(HumanOperationName.STOP, getUserString(), t);
         TaskChecker.checkStatePermission(HumanOperationName.STOP, t);
         t.setCurrentUser(getUserString());
-        
+
         try {
             t.stop();
         } catch (HiseIllegalStateException e) {
@@ -256,7 +252,7 @@ public class TaskOperationsImpl implemen
         TaskChecker.checkHumanRolePermission(HumanOperationName.SUSPEND, getUserString(),
t);
         TaskChecker.checkStatePermission(HumanOperationName.SUSPEND, t);
         t.setCurrentUser(getUserString());
-        
+
         try {
             t.suspend();
         } catch (HiseIllegalStateException e) {
@@ -296,7 +292,7 @@ public class TaskOperationsImpl implemen
         TaskChecker.checkHumanRolePermission(HumanOperationName.RESUME, getUserString(),
t);
         TaskChecker.checkStatePermission(HumanOperationName.RESUME, t);
         t.setCurrentUser(getUserString());
-        
+
         try {
             t.resume();
         } catch (HiseIllegalStateException e) {
@@ -313,7 +309,7 @@ public class TaskOperationsImpl implemen
         TaskChecker.checkHumanRolePermission(HumanOperationName.CLAIM, getUserString(), task);
         TaskChecker.checkStatePermission(HumanOperationName.CLAIM, task);
         task.setCurrentUser(getUserString());
-        
+
         try {
             task.claim();
         } catch (HiseIllegalStateException e) {
@@ -328,7 +324,7 @@ public class TaskOperationsImpl implemen
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
         TaskChecker.checkHumanRolePermission(HumanOperationName.FAIL, getUserString(), t);
         t.setCurrentUser(getUserString());
-        
+
         try {
             t.fail();
         } catch (HiseIllegalStateException e) {
@@ -337,12 +333,12 @@ public class TaskOperationsImpl implemen
     }
 
     public void forward(String identifier, TOrganizationalEntity organizationalEntity) throws
IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
-        
+
         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) {
@@ -360,7 +356,7 @@ public class TaskOperationsImpl implemen
         Task t = Task.load(hiseEngine, Long.parseLong(identifier));
         TaskChecker.checkHumanRolePermission(HumanOperationName.RELEASE, getUserString(),
t);
         t.setCurrentUser(getUserString());
-        
+
         try {
             t.release();
         } catch (HiseIllegalStateException e) {
@@ -373,7 +369,7 @@ public class TaskOperationsImpl implemen
         TaskChecker.checkHumanRolePermission(HumanOperationName.START, getUserString(), t);
         TaskChecker.checkStatePermission(HumanOperationName.START, t);
         t.setCurrentUser(getUserString());
-        
+
         try {
             t.start();
         } catch (HiseIllegalStateException e) {
@@ -387,7 +383,7 @@ public class TaskOperationsImpl implemen
         t.setCurrentUser(getUserString());
         //TODO set output
         //t.setOutput(((Node) taskData).getFirstChild());
-        
+
         try {
             t.complete();
         } catch (HiseIllegalStateException e) {
@@ -402,32 +398,32 @@ public class TaskOperationsImpl implemen
         t.setOutput(((Node) taskData).getFirstChild());
     }
 
-	/**
-	 * 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 void addComment(String identifier, String text) throws IllegalAccessFault, IllegalStateFault,
IllegalArgumentFault {
-		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);
-	}
-
-	/**
-	 * Gets all comments of a task.
-	 * Can be performed by:
-	 *  - potential owners
-	 *  - actual owner
-	 *  - business administrators
-	 *  
-	 *  @param identifier task's identifier
-	 */
+    /**
+     * 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 void addComment(String identifier, String text) throws IllegalAccessFault, IllegalStateFault,
IllegalArgumentFault {
+        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);
+    }
+
+    /**
+     * Gets all comments of a task.
+     * Can be performed by:
+     * - potential owners
+     * - actual owner
+     * - business administrators
+     *
+     * @param identifier task's identifier
+     */
     public List<TComment> getComments(String identifier) throws IllegalAccessFault,
IllegalStateFault, IllegalArgumentFault {
         Task task = Task.load(hiseEngine, new Long(identifier));
         TaskChecker.checkHumanRolePermission(HumanOperationName.GET_COMMENTS, getUserString(),
task);
@@ -445,16 +441,16 @@ public class TaskOperationsImpl implemen
     }
 
     public void activate(String identifier) throws IllegalAccessFault, IllegalStateFault,
IllegalArgumentFault {
-    	Task task = Task.load(hiseEngine, new Long(identifier));
+        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);
+            task.setStatus(Status.READY);
         } catch (HiseIllegalStateException e) {
-        	throw new IllegalStateFault("Illegal State Fault");
+            throw new IllegalStateFault("Illegal State Fault");
         }
         task.setCurrentUser(getUserString());
     }
@@ -464,19 +460,18 @@ public class TaskOperationsImpl implemen
 
         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();
+        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 instanceof org.w3c.dom.Element){
-        	newAttachment.setAttachment(DOMUtils.domToString((org.w3c.dom.Element)attachment));
    	
-        }
-        else{
-        	newAttachment.setAttachment(new String(""));
+        if (attachment instanceof org.w3c.dom.Element) {
+            newAttachment.setAttachment(DOMUtils.domToString((org.w3c.dom.Element) attachment));
+        } else {
+            newAttachment.setAttachment(new String(""));
         }
         taskDto.getAttachments().add(newAttachment);
 
@@ -488,44 +483,43 @@ public class TaskOperationsImpl implemen
         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();
-		}
+            task.setActualOwner(userID);
+            task.addGenericHumanRole(userID, GenericHumanRole.POTENTIALOWNERS);
+        } catch (HiseIllegalStateException e) {
+            throw new IllegalStateFault();
+        }
     }
-    
+
 
     public void deleteAttachments(String identifier, String attachmentName) throws IllegalAccessFault,
IllegalStateFault, IllegalArgumentFault {
         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();
+        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();
-        	}
+        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.
 
-        
 
     }
 
     public void deleteFault(String identifier) throws IllegalAccessFault, IllegalStateFault,
IllegalArgumentFault {
-    	Task task = Task.load(hiseEngine, new Long(identifier));
+        Task task = Task.load(hiseEngine, new Long(identifier));
         TaskChecker.checkHumanRolePermission(HumanOperationName.DELELE_FAULT, getUserString(),
task);
         task.setCurrentUser(getUserString());
         // TODO Auto-generated method stub
@@ -533,7 +527,7 @@ public class TaskOperationsImpl implemen
     }
 
     public void deleteOutput(String identifier) throws IllegalAccessFault, IllegalStateFault,
IllegalArgumentFault {
-    	Task task = Task.load(hiseEngine, new Long(identifier));
+        Task task = Task.load(hiseEngine, new Long(identifier));
         TaskChecker.checkHumanRolePermission(HumanOperationName.DELETE_OUTPUT, getUserString(),
task);
         task.setCurrentUser(getUserString());
         // TODO Auto-generated method stub
@@ -545,14 +539,14 @@ public class TaskOperationsImpl implemen
         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=new TAttachmentInfo();
-        	info.withName(a.getName()).withAttachedAt(a.getAttachedAt()).withAccessType(a.getAccessType())
-        	           .withAttachedBy(a.getuserName());
+        List<Attachment> attachments = taskDto.getAttachments();
+        List<TAttachmentInfo> result = new ArrayList<TAttachmentInfo>();
+        for (Attachment a : attachments) {
+            TAttachmentInfo info = new TAttachmentInfo();
+            info.withName(a.getName()).withAttachedAt(a.getAttachedAt()).withAccessType(a.getAccessType())
+                    .withAttachedBy(a.getuserName());
 
-        	result.add(info);
+            result.add(info);
         }
         return result;
 
@@ -563,17 +557,17 @@ public class TaskOperationsImpl implemen
         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=new TAttachment();
-        	TAttachmentInfo info=new TAttachmentInfo();
-        	info.withName(a.getName()).withAttachedAt(a.getAttachedAt()).withAccessType(a.getAccessType());
-        	info.withAttachedBy(a.getuserName()).withContentType(a.getContentType());
-        	ta.withAttachmentInfo(info).withValue(a.getAttachment());
-        	result.add(ta);
-        	}
+        List<Attachment> attachments = taskDto.getAttachments();
+        List<TAttachment> result = new ArrayList<TAttachment>();
+        for (Attachment a : attachments) {
+            if (a.getName().equals(attachmentName)) {
+                TAttachment ta = new TAttachment();
+                TAttachmentInfo info = new TAttachmentInfo();
+                info.withName(a.getName()).withAttachedAt(a.getAttachedAt()).withAccessType(a.getAccessType());
+                info.withAttachedBy(a.getuserName()).withContentType(a.getContentType());
+                ta.withAttachmentInfo(info).withValue(a.getAttachment());
+                result.add(ta);
+            }
         }
         return result;
 
@@ -582,84 +576,82 @@ public class TaskOperationsImpl implemen
     /**
      * Returns the rendering specified by the type.
      * Applies to both tasks and notifications.
-     * @param identifier task identifier
+     *
+     * @param identifier    task identifier
      * @param renderingType rendering type
      * @return any type
      * @since 0.3.0
      */
-    public Object getRendering(Object identifier, QName renderingType) throws IllegalArgumentFault
{
-        if(identifier instanceof org.w3c.dom.Element){
-        	Long id = DOMUtils.domToLong((org.w3c.dom.Element) identifier);
-    		Task task = Task.load(hiseEngine, id);
-            TRenderings tr = task.getTaskDefinition().getRenderings();
-            TRendering rendering = null;
-            for(TRendering r: tr.getRendering()){
-            	if(renderingType.equals(r.getType())){
-            		rendering = r;
-            		break;
-            	}
+    public Object getRendering(String identifier, QName renderingType) throws IllegalArgumentFault
{
+        Long id = Long.parseLong(identifier);
+        Task task = Task.load(hiseEngine, id);
+        TRenderings tr = task.getTaskDefinition().getRenderings();
+        TRendering rendering = null;
+        for (TRendering r : tr.getRendering()) {
+            if (renderingType.equals(r.getType())) {
+                rendering = r;
+                break;
             }
-            if(rendering == null) return null;
-            return convertRendering(rendering, task);
         }
-        return null;
-   
+        if (rendering == null) return null;
+        return convertRendering(rendering, task);
+
     }
 
     private Object convertRendering(TRendering rendering, Task task) {
-    	List<Object> content = rendering.getAny();
-        if(!content.isEmpty() && content.get(0) instanceof org.w3c.dom.Element){
-        	NodeList nodes=((org.w3c.dom.Element)content.get(0)).getChildNodes();
-        	if(nodes.getLength()==0) return null;
-            TaskEvaluator evaluator=task.getTaskEvaluator();
-        	String expression=nodes.item(0).getTextContent();
-        	List queryResponse=evaluator.buildQueryEvaluator().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();
-        	}
+        List<Object> content = rendering.getAny();
+        if (!content.isEmpty() && content.get(0) instanceof org.w3c.dom.Element)
{
+            NodeList nodes = ((org.w3c.dom.Element) content.get(0)).getChildNodes();
+            if (nodes.getLength() == 0) return null;
+            TaskEvaluator evaluator = task.getTaskEvaluator();
+            String expression = nodes.item(0).getTextContent();
+            List queryResponse = evaluator.buildQueryEvaluator().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();
+            }
         }
         return null;
-	}
+    }
 
-	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;
-		Element element = resultDocument.createElement("root"); 
-		resultDocument.appendChild(element); 
-		element.appendChild(resultDocument.importNode(response,true));	
-		return resultDocument;
-	}
+    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;
+        Element element = resultDocument.createElement("root");
+        resultDocument.appendChild(element);
+        element.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 List<QName> getRenderingTypes(Object identifier) throws IllegalArgumentFault
{
-        List<QName> result=new ArrayList<QName>();
-    	if(identifier instanceof org.w3c.dom.Element){
-    		Long id=DOMUtils.domToLong((org.w3c.dom.Element)identifier);
-    		Task task = Task.load(hiseEngine, id);
+        List<QName> result = new ArrayList<QName>();
+        if (identifier instanceof org.w3c.dom.Element) {
+            Long id = DOMUtils.domToLong((org.w3c.dom.Element) identifier);
+            Task task = Task.load(hiseEngine, id);
             TRenderings tr = task.getTaskDefinition().getRenderings();
-            for(TRendering r: tr.getRendering()){
-            	result.add(r.getType());
+            for (TRendering r : tr.getRendering()) {
+                result.add(r.getType());
             }
         }
         return result;
@@ -669,33 +661,33 @@ public class TaskOperationsImpl implemen
         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.getUser().size()
== 1)){
-       			task.setActualOwner(tUsers.getUser().get(0));
-       			task.addGenericHumanRole(tUsers.getUser().get(0), GenericHumanRole.POTENTIALOWNERS);
-       		}else{
-       			if(tGroup != null){
-       				for(String group: tGroup.getGroup())
-       					task.addGenericHumanRole(group, GenericHumanRole.POTENTIALOWNERS);
-        		}
-        		if(tUsers != null){
-        			for(String user: tUsers.getUser())
-       					task.addGenericHumanRole(user,GenericHumanRole.POTENTIALOWNERS);
-       			}
-       			task.setStatus(Status.READY);
-       		}
-       	} catch (HiseIllegalStateException e) {
-       		throw new IllegalStateFault("Illegal State Fault");
-       	}
+            //When only one user is nominate, he become ActualOwner
+            if ((tGroup == null) && (tUsers != null) && (tUsers.getUser().size()
== 1)) {
+                task.setActualOwner(tUsers.getUser().get(0));
+                task.addGenericHumanRole(tUsers.getUser().get(0), GenericHumanRole.POTENTIALOWNERS);
+            } else {
+                if (tGroup != null) {
+                    for (String group : tGroup.getGroup())
+                        task.addGenericHumanRole(group, GenericHumanRole.POTENTIALOWNERS);
+                }
+                if (tUsers != null) {
+                    for (String user : tUsers.getUser())
+                        task.addGenericHumanRole(user, GenericHumanRole.POTENTIALOWNERS);
+                }
+                task.setStatus(Status.READY);
+            }
+        } catch (HiseIllegalStateException e) {
+            throw new IllegalStateFault("Illegal State Fault");
+        }
     }
 
     public void setFault(String identifier, String faultName, Object faultData) throws IllegalAccessFault,
IllegalStateFault, IllegalArgumentFault,
             IllegalOperationFault {
-    	Task task = Task.load(hiseEngine, new Long(identifier));
+        Task task = Task.load(hiseEngine, new Long(identifier));
         TaskChecker.checkHumanRolePermission(HumanOperationName.SET_FAULT, getUserString(),
task);
         task.setCurrentUser(getUserString());
         // TODO Auto-generated method stub
@@ -704,28 +696,28 @@ public class TaskOperationsImpl implemen
 
     public void setGenericHumanRole(String identifier, String genericHumanRole, TOrganizationalEntity
organizationalEntity) throws IllegalAccessFault,
             IllegalStateFault, IllegalArgumentFault {
-    	Task task = Task.load(hiseEngine, new Long(identifier));
+        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.getUser())
-        		orgEntityName.add(e);
-        }
-        if(tGroup != null){
-        	for(String e: tGroup.getGroup())
-        		orgEntityName.add(e);
-        }
-        	
-        for(String i: orgEntityName){
-        	for(TaskOrgEntity e: task.getTaskDto().getPeopleAssignments()){
-        		if(i.equals(e.getName())){
-        			hiseEngine.getHiseDao().remove(e);
-        	}
+        if (tUsers != null) {
+            for (String e : tUsers.getUser())
+                orgEntityName.add(e);
+        }
+        if (tGroup != null) {
+            for (String e : tGroup.getGroup())
+                orgEntityName.add(e);
         }
-        	task.addGenericHumanRole(i, GenericHumanRole.valueOf(genericHumanRole));
+
+        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));
         }
     }
 
@@ -734,38 +726,38 @@ public class TaskOperationsImpl implemen
         TaskChecker.checkHumanRolePermission(HumanOperationName.SET_PRIORITY, getUserString(),
task);
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
         taskDto.setPriority(priority.intValue());
-        
+
 
     }
 
-    public void skip(String identifier) throws 
-    			IllegalAccessFault, IllegalStateFault, IllegalArgumentFault, 
-    				IllegalOperationFault {
+    public void skip(String identifier) throws
+            IllegalAccessFault, IllegalStateFault, IllegalArgumentFault,
+            IllegalOperationFault {
         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");	
-		}
+        if (taskDto.isSkippable()) {
+            try {
+                task.setStatus(Status.OBSOLETE);
+            } catch (HiseIllegalStateException e) {
+                throw new IllegalStateFault("Task is not skipable");
+            }
         }
-        
+
     }
 
     public void getFault(String identifier, Holder<String> faultName, Holder<Object>
faultData) throws IllegalArgumentFault, IllegalStateFault,
             IllegalOperationFault, IllegalAccessFault {
-    	Task task = Task.load(hiseEngine, new Long(identifier));
+        Task task = Task.load(hiseEngine, new Long(identifier));
         TaskChecker.checkHumanRolePermission(HumanOperationName.GET_FAULT, getUserString(),
task);
-    	
+
         // TODO Auto-generated method stub
 
     }
 
     public List<TTaskAbstract> getMyTaskAbstracts(String taskType, String genericHumanRole,
String workQueue, List<TStatus> status, String whereClause,
-            String createdOnClause, Integer maxTasks) throws IllegalArgumentFault, IllegalStateFault
{
+                                                  String createdOnClause, Integer maxTasks)
throws IllegalArgumentFault, IllegalStateFault {
         List<TTaskAbstract> result = new ArrayList<TTaskAbstract>();
 
         String user = getUserString();
@@ -786,7 +778,7 @@ public class TaskOperationsImpl implemen
 
         List<org.apache.hise.dao.Task> tasks = hiseEngine.getHiseDao().getUserTasks(query);
         for (org.apache.hise.dao.Task u : tasks) {
-        	TTaskAbstract t = convertTasktoTTaskAbstract(u.getId());
+            TTaskAbstract t = convertTasktoTTaskAbstract(u.getId());
             result.add(t);
         }
 
@@ -794,23 +786,20 @@ public class TaskOperationsImpl implemen
     }
 
     private TTaskAbstract convertTasktoTTaskAbstract(Long id) {
-    	Task task = Task.load(hiseEngine, id);
+        Task task = Task.load(hiseEngine, id);
         org.apache.hise.dao.Task taskDto = task.getTaskDto();
 
         TTaskAbstract result = new TTaskAbstract();
         result.withId(taskDto.getId().toString()).
-            withTaskType(taskDto.isNotification() ? "NOTIFICATION" : "TASK").
-            withCreatedOn(taskDto.getCreatedOn()).
-            withActivationTime(taskDto.getActivationTime()).
-            withPresentationName(task.getTaskEvaluator().getPresentationName()).
-            withPresentationSubject(task.getTaskEvaluator().evalPresentationSubject()).
-            withName(taskDto.getTaskDefinitionName()).
-            withStatus(TStatus.fromValue(taskDto.getStatus().toString()));
-
-
+                withTaskType(taskDto.isNotification() ? "NOTIFICATION" : "TASK").
+                withCreatedOn(taskDto.getCreatedOn()).
+                withActivationTime(taskDto.getActivationTime()).
+                withPresentationName(task.getTaskEvaluator().getPresentationName()).
+                withPresentationSubject(task.getTaskEvaluator().evalPresentationSubject()).
+                withName(taskDto.getTaskDefinitionName()).
+                withStatus(TStatus.fromValue(taskDto.getStatus().toString()));
 
 
-        
 //        TOrganizationalEntity tOrganizational = new TOrganizationalEntity();
 //        TUserlist users=new TUserlist();
 //        //TGrouplist groups=new TGrouplist();
@@ -822,21 +811,21 @@ public class TaskOperationsImpl implemen
 //        	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) {
@@ -845,96 +834,96 @@ public class TaskOperationsImpl implemen
 
         TTask result = new TTask();
         result.withId(taskDto.getId().toString()).
-            withTaskType(taskDto.isNotification() ? "NOTIFICATION" : "TASK").
-            withCreatedOn(taskDto.getCreatedOn()).
-            withActivationTime(taskDto.getActivationTime()).
-            withCreatedBy(taskDto.getCreatedBy()).
-            withPresentationName(task.getTaskEvaluator().getPresentationName()).
-            withPresentationSubject(task.getTaskEvaluator().evalPresentationSubject()).
-            withName(taskDto.getTaskDefinitionName()).
-            withStatus(TStatus.fromValue(taskDto.getStatus().toString()));
+                withTaskType(taskDto.isNotification() ? "NOTIFICATION" : "TASK").
+                withCreatedOn(taskDto.getCreatedOn()).
+                withActivationTime(taskDto.getActivationTime()).
+                withCreatedBy(taskDto.getCreatedBy()).
+                withPresentationName(task.getTaskEvaluator().getPresentationName()).
+                withPresentationSubject(task.getTaskEvaluator().evalPresentationSubject()).
+                withName(taskDto.getTaskDefinitionName()).
+                withStatus(TStatus.fromValue(taskDto.getStatus().toString()));
 
         if (taskDto.getActualOwner() != null) {
             result.setActualOwner(taskDto.getActualOwner());
-        
+
         }
-        Vector<TaskOrgEntity> temp=new Vector<TaskOrgEntity>(taskDto.getPeopleAssignments());
-        int k=temp.size();
+        Vector<TaskOrgEntity> temp = new Vector<TaskOrgEntity>(taskDto.getPeopleAssignments());
+        int k = temp.size();
         TOrganizationalEntity tOrganizational = new TOrganizationalEntity();
-        TUserlist users=new TUserlist();        
-        for(TaskOrgEntity o : taskDto.getBusinessAdministrators()){
-        	if(o.getType()==OrgEntityType.USER)
-        		users.getUser().add(o.getName());
-        }
-        if(!users.getUser().isEmpty())
-        	tOrganizational.withUsers(users);
-        if(!users.getUser().isEmpty() )
-        	result.setBusinessAdministrators(tOrganizational);
-        
-        
+        TUserlist users = new TUserlist();
+        for (TaskOrgEntity o : taskDto.getBusinessAdministrators()) {
+            if (o.getType() == OrgEntityType.USER)
+                users.getUser().add(o.getName());
+        }
+        if (!users.getUser().isEmpty())
+            tOrganizational.withUsers(users);
+        if (!users.getUser().isEmpty())
+            result.setBusinessAdministrators(tOrganizational);
+
+
         tOrganizational = new TOrganizationalEntity();
-        users=new TUserlist();
-        for(TaskOrgEntity o : taskDto.getTaskStakeholders()){
-        	if(o.getType()==OrgEntityType.USER)
-        		users.getUser().add(o.getName());
-        }
-        if(!users.getUser().isEmpty())
-        	tOrganizational.withUsers(users);
-        if(!users.getUser().isEmpty() )
-        	result.setTaskStakeholders(tOrganizational);
-        
+        users = new TUserlist();
+        for (TaskOrgEntity o : taskDto.getTaskStakeholders()) {
+            if (o.getType() == OrgEntityType.USER)
+                users.getUser().add(o.getName());
+        }
+        if (!users.getUser().isEmpty())
+            tOrganizational.withUsers(users);
+        if (!users.getUser().isEmpty())
+            result.setTaskStakeholders(tOrganizational);
+
         tOrganizational = new TOrganizationalEntity();
-        users=new 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);
-   
-             
+        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
+     *
      * @param taskDto
      * @return
      */
-	private List<TComment> convertComments(List<Comment> comments) {
+    private List<TComment> convertComments(List<Comment> comments) {
         List<TComment> result = new ArrayList<TComment>();
-        for(Comment comment : comments){
-         	result.add(convertComment(comment));
+        for (Comment comment : comments) {
+            result.add(convertComment(comment));
         }
-	    return result;
+        return result;
     }
 
-	/**
-	 * 
-	 * @param comment
-	 * @return
-	 */
-	private TComment convertComment(Comment comment) {
-	    TComment tComment=new TComment();
-	    tComment.withText(comment.getContent()).withAddedAt(comment.getDate())
-	    	.withAddedBy(comment.getUserName());
-	    return tComment;
+    /**
+     * @param comment
+     * @return
+     */
+    private TComment convertComment(Comment comment) {
+        TComment tComment = new TComment();
+        tComment.withText(comment.getContent()).withAddedAt(comment.getDate())
+                .withAddedBy(comment.getUserName());
+        return tComment;
     }
 
     /**
      * IoC setter.
-     * 
+     *
      * @param hiseEngine
      */
     public void setHiseEngine(HISEEngineImpl hiseEngine) {

Modified: incubator/hise/trunk/hise-wsdl/src/main/resources/ws-humantask-api-wsdl.xsd
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-wsdl/src/main/resources/ws-humantask-api-wsdl.xsd?rev=983989&r1=983988&r2=983989&view=diff
==============================================================================
--- incubator/hise/trunk/hise-wsdl/src/main/resources/ws-humantask-api-wsdl.xsd (original)
+++ incubator/hise/trunk/hise-wsdl/src/main/resources/ws-humantask-api-wsdl.xsd Tue Aug 10
13:25:26 2010
@@ -362,7 +362,7 @@ Business Machines Corporation, Oracle In
 <xsd:element name="getRendering">
   <xsd:complexType>
     <xsd:sequence>
-      <xsd:element name="identifier" type="xsd:anyType" />
+      <xsd:element name="identifier" type="xsd:anyURI" />
       <xsd:element name="renderingType" type="xsd:QName" />
                            
     </xsd:sequence>



Mime
View raw message