|
Oracle Fusion Middleware Java API Reference for Oracle BPM Suite 11g Release 1 (11.1.1.6.0) E25378-04 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.bpm.services.tools.ProcessInstanceTaskHelper
public class ProcessInstanceTaskHelper
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 |
---|
public static final java.lang.String WORKLIST_SERVER_SCHEME
public static final java.lang.String WORKLIST_SERVER_NAME
public static final java.lang.String WORKLIST_SERVER_PORT
public static final java.lang.String WORKLIST_CONTEXT_PATH
Constructor Detail |
---|
public ProcessInstanceTaskHelper()
Method Detail |
---|
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
bpmContext
- Authenticated contextbpmServiceClientFactory
- Service client factory to obtain all necessary services.processInstance
- Process Instance Id.worklistParameters
- Worklist parameters to generate the URL.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);
public static Task getProcessInstanceTask(IBPMContext bpmContext, BPMServiceClientFactory bpmServiceClientFactory, java.lang.String processInstance) throws java.lang.Exception
bpmContext
- Authenticated context.bpmServiceClientFactory
- Service client factory to obtain all necessary services.processInstance
- Process Instance Id.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);
|
Oracle Fusion Middleware Java API Reference for Oracle BPM Suite 11g Release 1 (11.1.1.6.0) E25378-04 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |