Implementing Process Task

This post is part of a series on building a custom worklist for BPM/SOA 11g.

In this post we will implement a Controller to take an action on a task, or to ‘process’ the task.  Like the Add Comment Controller in the previous post, this controller is also fairly straightforward and does not have an associated View of its own, we will send the user back to the Task Details View for the task in question.

Here is the code for com.oracle.ateam.ProcessTaskController (with some comments removed – they are available in Subversion):

package com.oracle.ateam;

import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.oracle.ateam.util.MLog;
import com.oracle.ateam.domain.MTaskList;
import com.oracle.xmlns.bpmn.bpmnprocess.createtesttasks.CreateTestTasksPortType;
import com.oracle.xmlns.bpmn.bpmnprocess.createtesttasks.CreateTestTasksService;

public class ProcessTaskController extends SimpleSuccessFailureController {

  @Override
  protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    MLog.log("ProcessTaskController", "Entering handleInternalRequest()");
    String taskNumber = request.getParameter("x_tasknumber");
    String action = request.getParameter("x_action");
    if ((taskNumber == null) || (action == null))
       return (new TaskListController()).handleRequest(request, response);
    MLog.log("ProcessTaskController", "Got request to " + action + " task " + taskNumber);
    MTaskList.processTask(request.getUserPrincipal().getName(), taskNumber, action);
    return (new TaskListController()).handleRequest(request, response);
  }
}

This again follows the same pattern.  We retrieve x_tasknumber and x_action from the request – they were put there by the HTML FORM we created in the Task Display View, then we check we have valid data and call the processTask() method on our MTaskList domain object and forward the user to the Task Details Controller/View.

In the next post, we will implement Controllers and a View to initiate a task (and a process).

About Mark Nelson

Mark Nelson is an Architect (an "IC6") in the Fusion Middleware Central Development Team at Oracle. Mark's job is to make Fusion Middleware easy to use in the cloud and at home, for developers and operations folks, with special focus on continuous delivery, configuration management and provisioning - making it simple to manage the configuration of complex environments and applications built with Oracle Database, Fusion Middleware and Fusion Applications, on-premise and in the cloud. Before joining this team, Mark was a senior member of the A-Team since 2010, and worked in Sales Consulting at Oracle since 2006 and various roles at IBM since 1994.
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s