How to capture the Task programmatically through Managed Bean (Adf – Soa Suite – Human Task)
This is another useful code that lets you to capture the task with full attributes from your Java Class (Managed Bean).
import oracle.bpel.services.workflow.WorkflowException; import oracle.bpel.services.workflow.client.IWorkflowServiceClient; import oracle.bpel.services.workflow.datacontrol.WorkflowService; import oracle.bpel.services.workflow.query.ITaskQueryService; import oracle.bpel.services.workflow.task.model.TaskImpl; import oracle.bpel.services.workflow.verification.IWorkflowContext; public TaskImpl getCurrentTaskFromWorkflow() throws WorkflowException { TaskImpl task = null; Map parameters=AdfFacesContext.getCurrentInstance().getPageFlowScope(); IWorkflowServiceClient wfSvcClient = WorkflowService.getWorkflowServiceClient(); ITaskQueryService queryService = wfSvcClient.getTaskQueryService(); String contextId = (String)parameters.get("bpmWorklistContext"); IWorkflowContext context = queryService.getWorkflowContext(contextId); String taskId = (String)parameters.get("bpmWorklistTaskId"); String strTaskVersion = (String)parameters.get("bpmWorklistTaskVersion"); if(taskId != null){ int taskVersion = 0; if(strTaskVersion != null && !strTaskVersion.trim().equals("")){ try{ taskVersion = Integer.parseInt(strTaskVersion); } catch(NumberFormatException exc){ taskVersion = 1; } } if(taskVersion == 0){ task = (TaskImpl)queryService.getTaskDetailsById(context, taskId); }else{ task = (TaskImpl)queryService.getTaskVersionDetails(context, taskId, taskVersion); } } return task; }