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");
  |             try
  |             {
  |                     PrintWriter out = response.getWriter();                 
        
  |                     response.setContentType("text/html");
  |                     out.println("Total tasks: " + tasks.size() + "<br />");
  |                     for (Iterator it = tasks.iterator(); it.hasNext(); ) 
  |                     {
  |                             TaskInstance taskInstance = 
(TaskInstance)it.next();
  |                             out.println(taskInstance.getName() + "<br />");
  |                             taskInstance.end();
  |                             jbpmContext.save(taskInstance);
  |                     }
  |             }
  |             catch (Exception e)
  |             {
  |                     e.printStackTrace();
  |             }
  |     }       
  | }
  | 

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?

Thanks, 

Shannon

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950922#3950922

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950922


_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to