Sun Java System Portal Server 7.2 Developer's Guide

Checking out a Task

Add the following code to your test class, to check out a task.


private com.sun.saw.vo.OutputVO checkoutTasks
(String userId,java.util.List taskIdList,Workflow workflowImpl)
throws com.sun.saw.WorkflowException {

   com.sun.saw.vo.CheckoutTaskVO checkoutTaskVO = new com.sun.saw.vo.CheckoutTaskVO();
   checkoutTaskVO.setTaskIdList(taskIdList);
   checkoutTaskVO.setUserId(userId);

   com.sun.saw.vo.OutputVO outputVO = null;
   outputVO = workflowImpl.checkoutTasks(checkoutTaskVO);

   return outputVO;
  }

//Call the above method from the main(). For example

public static void main(String args) {
TestClient client = new TestClient();
List taskIdList = new ArrayList();
taskIdList.add("4ce71ee0:11420e51eca:-6388");
Workflow workflowImpl = this.getWorkflowImpl();
try {
client.checkoutTasks("CPina", taskIdList,workflowImpl);
} catch (com.sun.saw.WorkflowException e) {
e.printStackTrace();
}
}

private com.sun.saw.Workflow getWorkflowImpl() throws com.sun.saw.WorkflowException{

// This assumes that the property file is there in classpath.

com.sun.saw.Workflow workflow = null;
com.sun.saw.WorkflowFactory workflowFactory = WorkflowFactory.getInstance();
workflow = workflowFactory.getWorkflowInstance();
return workflow;
}

The above code does the following functions: