[jboss-user] [JBoss jBPM] - Ending a Task.
jgreiner
do-not-reply at jboss.com
Tue Aug 14 10:25:47 EDT 2007
When I am ending a taskinstance do I have to manually clear the actor, and the group assignments? What is happening is my tasks hang around in the group assignments even though I ended the task. I just wanted to verify, seems like ending the task should make sure that task does not come up any longer when you grab the tasks by group assignments.
So what I plan on doing is clearing the group assignments manually, but wanted to check with the group and see if I am ending the task incorrectly or if there is a better way of doing it.
Here is an example of the code I am using below.
| try
| {
| JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
| jbpmContext = jbpmConfiguration.createJbpmContext();
|
| pid = 23456;
|
| ProcessInstance pi = jbpmContext.getProcessInstance(pid);
|
| Collection tis = pi.getTaskMgmtInstance().getTaskInstances();
| Iterator li = tis.iterator();
| while (li.hasNext())
| {
| TaskInstance ti = (TaskInstance)li.next();
| if (ti.getEnd() == null && ti.getName().equals("taskname"))
| {
| if (transitionPath.equals(ProcessTransitions.WORK_QUEUE))
| {
| ti.setActorId(null);
| ti.end(ProcessTransitions.WORK_QUEUE);
| }
| else
| {
| ti.setActorId(null);
| ti.end(ProcessTransitions.END_PROCESS);
| }
| // Save the Task Instance
| jbpmContext.save(ti);
| break; // Do not need to contiue found our guy
| }
| }
| }
| }
| catch (Throwable ex)
| {
| logger.error("Error occured: " + ex);
| throw new EJBException("Error Occured: " + ex);
| }
| finally
| {
| if (jbpmContext != null)
| jbpmContext.close();
| }
|
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074046#4074046
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074046
More information about the jboss-user
mailing list