[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Tue Nov 21 23:56:55 EST 2006
User: gavin
Date: 06/11/21 23:56:55
Modified: src/main/org/jboss/seam/core PooledTask.java
Log:
requested by user
Revision Changes Path
1.13 +52 -5 jboss-seam/src/main/org/jboss/seam/core/PooledTask.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PooledTask.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/PooledTask.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- PooledTask.java 19 Nov 2006 18:13:06 -0000 1.12
+++ PooledTask.java 22 Nov 2006 04:56:55 -0000 1.13
@@ -10,7 +10,7 @@
import org.jbpm.taskmgmt.exe.TaskInstance;
/**
- * Support for the task list.
+ * Support for assigning tasks in the pooled task list.
*
* @see TaskInstanceList
* @author Gavin King
@@ -21,6 +21,14 @@
public class PooledTask
{
+ /**
+ * Assign the TaskInstance with the id passed
+ * in the request parameter named "taskId" to
+ * the current actor.
+ *
+ * @see Actor
+ * @return a null outcome only if the task was not found
+ */
@Transactional
public String assignToCurrentActor()
{
@@ -33,14 +41,53 @@
if (taskInstance!=null)
{
taskInstance.setActorId( actor.getId() );
- }
return "taskAssignedToActor";
}
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Assign the TaskInstance with the id passed
+ * in the request parameter named "taskId" to
+ * the given actor id.
+ *
+ * @param actorId the jBPM actor id
+ * @return a null outcome only if the task was not found
+ */
+ @Transactional
+ public String assign(String actorId)
+ {
+ TaskInstance taskInstance = getTaskInstance();
+ if (taskInstance!=null)
+ {
+ taskInstance.setActorId(actorId);
+ return "taskAssigned";
+ }
+ else
+ {
+ return null;
+ }
+ }
- private TaskInstance getTaskInstance()
+ /**
+ * @return the TaskInstance with the id passed
+ * in the request parameter named "taskId".
+ */
+ @Transactional
+ public TaskInstance getTaskInstance()
{
- String taskId = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("taskId");
- return ManagedJbpmContext.instance().getTaskMgmtSession().loadTaskInstance( Long.parseLong(taskId) );
+ String taskId = (String) FacesContext.getCurrentInstance()
+ .getExternalContext()
+ .getRequestParameterMap()
+ .get("taskId");
+ return taskId==null ?
+ null :
+ ManagedJbpmContext.instance()
+ .getTaskMgmtSession()
+ .loadTaskInstance( Long.parseLong(taskId) );
}
}
More information about the jboss-cvs-commits
mailing list