6 Replies Latest reply on Jun 15, 2006 9:16 PM by siv ram

    Simple class to close open tasks

    Shannon Sumner Newbie

      Hello all,

      I would like to create a simple class to cloase all open tasks for a user and signal the start of the next task in the process. Here's my code:

      package org.jbpm.servlet;
      import javax.servlet.http.*;
      import org.jbpm.JbpmContext;
      import org.jbpm.JbpmConfiguration;
      import org.jbpm.taskmgmt.exe.TaskInstance;
      import java.util.*;
      import java.io.*;
      public class WorkflowServlet extends HttpServlet
       private static final long serialVersionUID = 1L;
       public void doGet(HttpServletRequest request, HttpServletResponse response)
       JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
       JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
       List tasks = jbpmContext.getTaskList("cookie monster");
       PrintWriter out = response.getWriter();
       out.println("Total tasks: " + tasks.size() + "<br />");
       for (Iterator it = tasks.iterator(); it.hasNext(); )
       TaskInstance taskInstance = (TaskInstance)it.next();
       out.println(taskInstance.getName() + "<br />");
       catch (Exception e)

      The code looks like it works - but when I log into the webapp - the tasks are still open. Can anyone give me an idea of where to go from here?