Skip navigation links

Oracle Fusion Middleware
Java API Reference for Oracle BPM Suite
11g Release 1 (11.1.1.6.3)
E25378-06


oracle.bpm.services.tools
Class ProcessInstanceTaskHelper

java.lang.Object
  extended by oracle.bpm.services.tools.ProcessInstanceTaskHelper


public class ProcessInstanceTaskHelper
extends java.lang.Object

This class is a helper to operate with the Human Task associated to a ProcessInstance.
Samples:
String host = "host.domain.com";
String port = "7001";
String ejbHost = "t3://" + host + ":" + port;

String user = "weblogic";
char[] password = "weblogic1".toCharArray();

String instanceid="21004";

BPMServiceClientFactory bpmServiceClientFactory = null;
IBPMContext bpmContext = null;
try {

Map<IWorkflowServiceClientConstants.CONNECTION_PROPERTY, String> properties =
new HashMap<IWorkflowServiceClientConstants.CONNECTION_PROPERTY, String>();

properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.CLIENT_TYPE,
WorkflowServiceClientFactory.REMOTE_CLIENT);
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, ejbHost);
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");

System.out.print("-> Creating BPM Service Client Factory ...");
bpmServiceClientFactory = BPMServiceClientFactory.getInstance(properties, null, null);
System.out.println("OK");

System.out.print("-> Authenticating user [" + user + "] ...");
bpmContext =
bpmServiceClientFactory.getBPMUserAuthenticationService().authenticate(user, password, null);
System.out.println("OK");

System.out.print("-> Getting BPM Service Client");
IBPMServiceClient bpmServiceClient = bpmServiceClientFactory.getBPMServiceClient();
System.out.println("OK");

System.out.print("-> Getting Process Instance Human Task ...");
Task task = ProcessInstanceTaskHelper.getProcessInstanceTask(bpmContext, bpmServiceClient, instanceId);
System.out.println("OK");
}
catch (Exception exception) {
System.out.println("FAIL");
exception.printStackTrace();
}
finally {
if (bpmServiceClientFactory != null && bpmContext != null) {
try {
System.out.print("-> Destroying BPM Context [" + bpmContext.getUser() + "] ...");
bpmServiceClientFactory.getBPMUserAuthenticationService().destroyBPMContext(bpmContext);
System.out.println("OK");
}
catch (Exception exception) {
System.out.println("FAIL");
exception.printStackTrace();
}
}
}


Field Summary
static java.lang.String WORKLIST_CONTEXT_PATH
           
static java.lang.String WORKLIST_SERVER_NAME
           
static java.lang.String WORKLIST_SERVER_PORT
           
static java.lang.String WORKLIST_SERVER_SCHEME
           

 

Constructor Summary
ProcessInstanceTaskHelper()
           

 

Method Summary
static java.lang.String buildTaskURL(IBPMContext bpmContext, BPMServiceClientFactory bpmServiceClientFactory, java.lang.String processInstance, java.util.Map<java.lang.String,java.lang.String> worklistParameters)
          Returns the URL of the task for the given process instance.
static Task getProcessInstanceTask(IBPMContext bpmContext, BPMServiceClientFactory bpmServiceClientFactory, java.lang.String processInstance)
          Returns the Task associated to the given process instance.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

WORKLIST_SERVER_SCHEME

public static final java.lang.String WORKLIST_SERVER_SCHEME
See Also:
Constant Field Values

WORKLIST_SERVER_NAME

public static final java.lang.String WORKLIST_SERVER_NAME
See Also:
Constant Field Values

WORKLIST_SERVER_PORT

public static final java.lang.String WORKLIST_SERVER_PORT
See Also:
Constant Field Values

WORKLIST_CONTEXT_PATH

public static final java.lang.String WORKLIST_CONTEXT_PATH
See Also:
Constant Field Values

Constructor Detail

ProcessInstanceTaskHelper

public ProcessInstanceTaskHelper()

Method Detail

buildTaskURL

public static java.lang.String buildTaskURL(IBPMContext bpmContext,
                                            BPMServiceClientFactory bpmServiceClientFactory,
                                            java.lang.String processInstance,
                                            java.util.Map<java.lang.String,java.lang.String> worklistParameters)
                                     throws java.lang.Exception
Returns the URL of the task for the given process instance.
Parameters:
bpmContext - Authenticated context
bpmServiceClientFactory - Service client factory to obtain all necessary services.
processInstance - Process Instance Id.
worklistParameters - Worklist parameters to generate the URL.
Returns:
The URL of the task for the given process instance.
Throws:
java.lang.Exception - If the operation fails. Ex. String url = null;

String host = "host.oracle.com";
String port = "8001";
String ejbHost = "t3://" + host + ":" + port;

String user = "weblogic";
char[] password = "weblogic1".toCharArray();

String processInstance = "20003";

BPMServiceClientFactory bpmServiceClientFactory = null;
IBPMContext bpmContext = null;

Map<IWorkflowServiceClientConstants.CONNECTION_PROPERTY, String> properties =
new HashMap<IWorkflowServiceClientConstants.CONNECTION_PROPERTY, String>();

properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.CLIENT_TYPE,
WorkflowServiceClientFactory.REMOTE_CLIENT);
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, ejbHost);
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");

bpmServiceClientFactory = BPMServiceClientFactory.getInstance(properties, null, null);

bpmContext =
bpmServiceClientFactory.getBPMUserAuthenticationService().authenticate(user, password, null);

Map<String, String> parameters = new TreeMap<String, String>();
parameters.put(ProcessInstanceTaskHelper.WORKLIST_SERVER_SCHEME, "http");
parameters.put(ProcessInstanceTaskHelper.WORKLIST_SERVER_NAME, host);
parameters.put(ProcessInstanceTaskHelper.WORKLIST_SERVER_PORT, port);
parameters.put(ProcessInstanceTaskHelper.WORKLIST_CONTEXT_PATH, "/workflow/Project/faces/adf.task-flow");

url = ProcessInstanceTaskHelper.buildTaskUrl(bpmContext,
bpmServiceClientFactory,
processInstance,
parameters);

getProcessInstanceTask

public static Task getProcessInstanceTask(IBPMContext bpmContext,
                                          BPMServiceClientFactory bpmServiceClientFactory,
                                          java.lang.String processInstance)
                                   throws java.lang.Exception
Returns the Task associated to the given process instance.
Parameters:
bpmContext - Authenticated context.
bpmServiceClientFactory - Service client factory to obtain all necessary services.
processInstance - Process Instance Id.
Returns:
The Task associated to the given instance.
Throws:
java.lang.Exception - If the operation fails. Ex. String host = "host.oracle.com";
String port = "8001";
String ejbHost = "t3://" + host + ":" + port;

String user = "weblogic";
char[] password = "weblogic1".toCharArray();

String processInstance = "20003";

BPMServiceClientFactory bpmServiceClientFactory = null;
IBPMContext bpmContext = null;

Map<IWorkflowServiceClientConstants.CONNECTION_PROPERTY, String> properties =
new HashMap<IWorkflowServiceClientConstants.CONNECTION_PROPERTY, String>();

properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.CLIENT_TYPE,
WorkflowServiceClientFactory.REMOTE_CLIENT);
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, ejbHost);
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");

bpmServiceClientFactory = BPMServiceClientFactory.getInstance(properties, null, null);

bpmContext =
bpmServiceClientFactory.getBPMUserAuthenticationService().authenticate(user, password, null);

Task task = ProcessInstanceTaskHelper.getProcessInstanceTask(bpmContext,
bpmServiceClientFactory,
processInstance);

Skip navigation links

Oracle Fusion Middleware
Java API Reference for Oracle BPM Suite
11g Release 1 (11.1.1.6.3)
E25378-06


Copyright © 2009, 2011, Oracle and/or its affiliates. All rights reserved.