Monday, November 28, 2011

IWorkflowServiceClient Interface changes in 11gPS4 (get authenticated user from BPM)

A recent upgrade from 11gPS3 (11.1.1.4) to 11gPS4 (11.1.1.5) has revealed some changes in the IWorkflowServiceClient interface (oracle.bpel.services.workflow.query package) which provides you with a programmatic means for retrieving tasks, task details etc.

More specifically, we where using the Workflow Services API to get the authenticated username from BPM and propagate it to our custom ADF application which was embedded inside a Human Task as a region.

String contextStr = ADFWorklistBeanUtil.getWorklistContextId();
IWorkflowServiceClient wfSvcClient = WorkflowService.getWorkflowServiceClient();
ITaskQueryService queryService = wfSvcClient.getTaskQueryService();
IWorkflowContext wfContext = queryService.getWorkflowContext(contextStr);
String userId = wfContext.getUser();


Please note that in 11gPS4, to retrieve the IWorkflowServiceClient object, you need to use the TaskFlowPropsUtil interface and NOT the WorkflowService interface, and pass to the getWorkflowServiceClient method the lookup client object which can be retrieved using the ADFWorklistBeanUtil interface.

String contextStr = ADFWorklistBeanUtil.getWorklistContextId();
String lookupClient = ADFWorklistBeanUtil.getLookupClient();
IWorkflowServiceClient wfSvcClient = TaskFlowPropsUtil.getWorkflowServiceClient(lookupClient);
ITaskQueryService queryService = wfSvcClient.getTaskQueryService();
IWorkflowContext wfContext = queryService.getWorkflowContext(contextStr);
String userId = wfContext.getUser();

No comments:

Post a Comment