You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hise-commits@incubator.apache.org by rr...@apache.org on 2010/08/11 10:23:45 UTC
svn commit: r984361 [2/4] - in /incubator/hise/trunk: hise-bundle/
hise-bundle/src/main/resources/META-INF/spring/
hise-services/src/main/java/org/apache/hise/dao/
hise-services/src/main/java/org/apache/hise/engine/jaxws/
hise-services/src/main/java/or...
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=984361&r1=984360&r2=984361&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 Wed Aug 11 10:23:44 2010
@@ -1,7 +1,7 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional informationx
+ * 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
@@ -23,14 +23,14 @@ import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
-import java.util.HashMap;
+import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
-import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.jws.WebService;
import javax.xml.datatype.Duration;
@@ -44,7 +44,6 @@ 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.TaskHistoryMessage;
import org.apache.hise.dao.Task.Status;
import org.apache.hise.dao.TaskOrgEntity;
import org.apache.hise.dao.TaskOrgEntity.OrgEntityType;
@@ -78,6 +77,80 @@ import org.apache.hise.lang.xsd.htda.TSt
import org.apache.hise.lang.xsd.htda.TTask;
import org.apache.hise.lang.xsd.htda.TTaskAbstract;
import org.apache.hise.lang.xsd.htda.TTaskQueryResultSet;
+import org.apache.hise.lang.xsd.htdt.ActivateDocument;
+import org.apache.hise.lang.xsd.htdt.ActivateResponseDocument;
+import org.apache.hise.lang.xsd.htdt.AddAttachmentDocument;
+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;
@@ -86,11 +159,17 @@ import org.apache.hise.runtime.Task;
import org.apache.hise.runtime.TaskEvaluator;
import org.apache.hise.utils.DOMUtils;
import org.apache.hise.utils.XQueryEvaluator;
+import org.apache.ws.commons.schema.utils.DOMUtil;
+import org.apache.xmlbeans.GDate;
+import org.apache.xmlbeans.GDuration;
+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.w3c.dom.NodeList;
+import org.apache.xmlbeans.XmlString;
/**
* Implementation of WS-HT API. Operations are executed by end users, i.e.
@@ -101,14 +180,13 @@ 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;
@@ -118,7 +196,7 @@ public class TaskOperationsImpl implemen
/**
* Sets up {@link WebServiceContext} used to lookup authenticated user
* performing operations.
- *
+ *
* @throws Exception
*/
public void init() throws Exception {
@@ -133,12 +211,18 @@ public class TaskOperationsImpl implemen
/**
* {@inheritDoc}
- *
- * @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 {
+ 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>();
@@ -148,10 +232,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);
@@ -170,11 +254,16 @@ public class TaskOperationsImpl implemen
result.add(t);
}
- return result;
-
+ 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));
@@ -183,7 +272,7 @@ public class TaskOperationsImpl implemen
}
private TDeadlinesInfo convertToDeadlinesInfo(org.apache.hise.dao.Task t) throws IllegalArgumentFault {
- TDeadlinesInfo result = new TDeadlinesInfo();
+ 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) {
@@ -191,17 +280,30 @@ public class TaskOperationsImpl implemen
StringTokenizer st = new StringTokenizer(details, ";", true);
String name = new String();
String type = new String();
- if (st.countTokens() < 2)
+ 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 (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);
}
- 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)));
}
@@ -209,107 +311,192 @@ public class TaskOperationsImpl implemen
return result;
- }
+ }
/**
* {@inheritDoc}
*/
- public Object getInput(String identifier, String part) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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());
- return t.getInput(part);
+
+ 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 Object getOutput(String identifier, String part) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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());
- return t.getOutput(part);
+
+ 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 void stop(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ public StopResponseDocument stop(StopDocument stop) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+// public void stop(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ String identifier = stop.getStop().getIdentifier();
+
Task t = Task.load(hiseEngine, Long.parseLong(identifier));
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 void suspend(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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 void suspendUntil(String identifier, TTime time) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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();
+
Task t = Task.load(hiseEngine, Long.parseLong(identifier));
TaskChecker.checkHumanRolePermission(HumanOperationName.SUSPEND_UNTIL, getUserString(), t);
TaskChecker.checkStatePermission(HumanOperationName.SUSPEND_UNTIL, t);
t.setCurrentUser(getUserString());
- Date when = time.getPointOfTime();
- if (when == null) {
- Duration when2 = time.getTimePeriod();
- when = Calendar.getInstance().getTime();
- when2.addTo(when);
+ 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);
+ 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 void remove(String identifier) throws IllegalAccessFault, IllegalArgumentFault {
+ public RemoveResponseDocument remove(RemoveDocument remove) throws IllegalArgumentFault, IllegalAccessFault {
+// public void remove(String identifier) throws IllegalAccessFault, IllegalArgumentFault {
+ String identifier = remove.getRemove().getIdentifier();
+
Task t = Task.load(hiseEngine, Long.parseLong(identifier));
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 void resume(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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 org.apache.hise.lang.xsd.htda.TTask getTaskInfo(String identifier) throws IllegalArgumentFault {
- return convertTask(hiseEngine.getHiseDao().find(org.apache.hise.dao.Task.class, Long.parseLong(identifier)).getId());
+ 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();
+
+ GetTaskInfoResponseDocument responseDocument = GetTaskInfoResponseDocument.Factory.newInstance();
+ GetTaskInfoResponseDocument.GetTaskInfoResponse response = GetTaskInfoResponseDocument.GetTaskInfoResponse.Factory.newInstance();
+ response.setTask(convertTask(hiseEngine.getHiseDao().find(org.apache.hise.dao.Task.class, Long.parseLong(identifier)).getId()));
+ responseDocument.setGetTaskInfoResponse(response);
+ return responseDocument;
}
- public void claim(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+ 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) {
@@ -317,198 +504,324 @@ public class TaskOperationsImpl implemen
} 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 void fail(String identifier, String faultName, Object faultData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault,
- IllegalOperationFault {
+ 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 void forward(String identifier, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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 String getTaskDescription(String identifier, String contentType) throws IllegalArgumentFault {
+ 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());
- return t.getTaskEvaluator().evalPresentationDescription();
+
+ GetTaskDescriptionResponseDocument responseDocument = GetTaskDescriptionResponseDocument.Factory.newInstance();
+ GetTaskDescriptionResponseDocument.GetTaskDescriptionResponse response = GetTaskDescriptionResponseDocument.GetTaskDescriptionResponse.Factory.newInstance();
+ response.setDescription(t.getTaskEvaluator().evalPresentationDescription());
+ responseDocument.setGetTaskDescriptionResponse(response);
+ return responseDocument;
}
- public void release(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+ public ReleaseResponseDocument release(ReleaseDocument release) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+// public void release(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+ String identifier = release.getRelease().getIdentifier();
Task t = Task.load(hiseEngine, Long.parseLong(identifier));
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 void start(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+ 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 void complete(String identifier, Object taskData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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 void setOutput(String identifier, String part, Object taskData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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).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);
- }
+ t.setOutput(((Node) taskData.getDomNode()).getFirstChild());
- /**
- * 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 {
+ 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());
- return result;
+
+ 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 TTaskQueryResultSet query(String selectClause, String whereClause, String orderByClause, Integer maxTasks, Integer taskIndexOffset)
- throws IllegalArgumentFault, IllegalStateFault {
+ 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 void activate(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
- Task task = Task.load(hiseEngine, new Long(identifier));
+ 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);
+ task.setStatus(Status.READY);
} catch (HiseIllegalStateException e) {
- throw new IllegalStateFault("Illegal State Fault");
+ 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 void addAttachment(String identifier, String attachmentName, String accessType, Object attachment) throws IllegalAccessFault, IllegalStateFault,
- IllegalArgumentFault {
+ 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();
+ 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.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 void delegate(String identifier, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, RecipientNotAllowed,
- IllegalArgumentFault {
+ 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();
- }
- }
+ 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();
-
- 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
@@ -516,248 +829,407 @@ public class TaskOperationsImpl implemen
// operation.
+ DeleteAttachmentsResponseDocument responseDocument = DeleteAttachmentsResponseDocument.Factory.newInstance();
+ DeleteAttachmentsResponseDocument.DeleteAttachmentsResponse response = DeleteAttachmentsResponseDocument.DeleteAttachmentsResponse.Factory.newInstance();
+ responseDocument.setDeleteAttachmentsResponse(response);
+
+ return responseDocument;
+
+
}
- public void deleteFault(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
- Task task = Task.load(hiseEngine, new Long(identifier));
+ 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 void deleteOutput(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
- Task task = Task.load(hiseEngine, new Long(identifier));
+ 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 List<TAttachmentInfo> getAttachmentInfos(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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 = new TAttachmentInfo();
- info.withName(a.getName()).withAttachedAt(a.getAttachedAt()).withAccessType(a.getAccessType())
- .withAttachedBy(a.getuserName());
-
- result.add(info);
- }
- return result;
+ 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 List<TAttachment> getAttachments(String identifier, String attachmentName) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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 = 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;
+ 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 identifier task identifier
* @param renderingType rendering type
* @return any type
* @since 0.3.0
*/
- 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;
+ 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;
- return convertRendering(rendering, task);
+ 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 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();
- }
+ private Element convertRendering(TRendering rendering, Task task) {
+ Node cont = rendering.getDomNode();
+ TaskEvaluator evaluator=task.getTaskEvaluator();
+ List<Node> rend = evaluator.buildQueryEvaluator().evaluateExpression("/*/expression", cont);
+// NodeList content = rendering.getDomNode().getChildNodes();
+// if(content.item(i) instanceof org.w3c.dom.Element){
+// NodeList nodes=((org.w3c.dom.Element)content.item(0)).getChildNodes();
+// if(nodes.getLength()==0) return null;
+// TaskEvaluator evaluator=task.getTaskEvaluator();
+// String expression=nodes.item(0).getTextContent();
+ if(!rend.isEmpty()) {
+ String expression = DOMUtil.getChildText(rend.get(0));
+ 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);
+ 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.getRendering()) {
- result.add(r.getType());
+ for(TRendering r: tr.getRenderingList()){
+ result.add(r.getType());
}
}
- return result;
+ 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 void nominate(String identifier, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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.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.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();
- 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
+ SetFaultResponseDocument responseDocument = SetFaultResponseDocument.Factory.newInstance();
+ SetFaultResponseDocument.SetFaultResponse response = SetFaultResponseDocument.SetFaultResponse.Factory.newInstance();
+ responseDocument.setSetFaultResponse(response);
+
+ return responseDocument;
}
- public void setGenericHumanRole(String identifier, String genericHumanRole, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault,
- IllegalStateFault, IllegalArgumentFault {
- Task task = Task.load(hiseEngine, new Long(identifier));
- TaskChecker.checkHumanRolePermission(HumanOperationName.SET_GENERIC_HUMAN_ROLE, getUserString(), task);
+ 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.getUser())
- orgEntityName.add(e);
- }
- if (tGroup != null) {
- for (String e : tGroup.getGroup())
- orgEntityName.add(e);
+ if(tUsers != null){
+ for(String e: tUsers.getUserList())
+ 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));
+ 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 void setPriority(String identifier, BigInteger priority) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+ 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 void skip(String identifier) throws
- IllegalAccessFault, IllegalStateFault, IllegalArgumentFault,
- IllegalOperationFault {
+ 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");
- }
+ 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 void getFault(String identifier, Holder<String> faultName, Holder<Object> faultData) throws IllegalArgumentFault, IllegalStateFault,
- IllegalOperationFault, IllegalAccessFault {
- Task task = Task.load(hiseEngine, new Long(identifier));
- TaskChecker.checkHumanRolePermission(HumanOperationName.GET_FAULT, getUserString(), task);
+ 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 List<TTaskAbstract> getMyTaskAbstracts(String taskType, String genericHumanRole, String workQueue, List<TStatus> status, String whereClause,
- String createdOnClause, Integer maxTasks) throws IllegalArgumentFault, IllegalStateFault {
+ 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();
@@ -778,28 +1250,41 @@ 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);
}
- return result;
+ 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);
+ 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()));
+ 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();
@@ -811,122 +1296,132 @@ 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) {
Task task = Task.load(hiseEngine, id);
org.apache.hise.dao.Task taskDto = task.getTaskDto();
- 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()));
+ 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 = 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);
-
-
- 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);
-
- tOrganizational = new TOrganizationalEntity();
- users = new TUserlist();
+// 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.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.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) {
+ 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=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