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 ProcessInstanceAuditHelper

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


public class ProcessInstanceAuditHelper
extends java.lang.Object

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

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

String instanceid="21004";
String componentDN = "default/MyBPMProject!1.0*soa_35304fdc-807b-49c8-b8e5-70b6accfbede/MyProcess";

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 Image ...");
OutputStream processImageOutputStream =
ProcessInstanceAuditHelper.getProcessImage(bpmContext, bpmServiceClient, componentDN);
System.out.println("OK");

System.out.print("-> Getting Audit Instance Image ...");
OutputStream auditImageOutputStream =
ProcessInstanceAuditHelper.getAuditImage(bpmContext, bpmServiceClient, instanceId);
System.out.println("OK");

System.out.print("-> Getting Audit Instance XML ...");
String auditInstanceXML =
ProcessInstanceAuditHelper.getAuditXml(bpmContext, bpmServiceClient, instanceId);
System.out.println("OK");

System.out.print("-> Getting Audit Trail tree...");
AuditTrail auditTrail =
ProcessInstanceAuditHelper.getAuditTrail(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();
}
}
}


Constructor Summary
ProcessInstanceAuditHelper()
           

 

Method Summary
 java.io.OutputStream getAuditImage(IBPMContext bpmContext, IBPMServiceClient bpmServiceClient, java.lang.String processInstance)
          Returns the audit trail image of the given instance.
 oracle.bpm.services.util.AuditTrail getAuditTrail(IBPMContext bpmContext, IBPMServiceClient bpmServiceClient, java.lang.String processInstance)
          Returns the Audit Trail object for the given instance.
 java.lang.String getAuditXml(IBPMContext bpmContext, IBPMServiceClient bpmServiceClient, java.lang.String processInstance)
          Returns an XML representation of the Audit Trail for the given instance.
 java.io.OutputStream getProcessImage(IBPMContext bpmContext, IBPMServiceClient bpmServiceClient, java.lang.String process)
          Returns the image of the given process.

 

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

 

Constructor Detail

ProcessInstanceAuditHelper

public ProcessInstanceAuditHelper()

Method Detail

getProcessImage

public java.io.OutputStream getProcessImage(IBPMContext bpmContext,
                                            IBPMServiceClient bpmServiceClient,
                                            java.lang.String process)
                                     throws java.lang.Exception
Returns the image of the given process.
Parameters:
bpmContext - Authenticated context.
bpmServiceClient - BPM Service Client to obtain the necessary services.
process - Process Id (Composite DN).
Returns:
The OuputStream of the generated image.
Throws:
java.lang.Exception - if the operation fails. ex. String host = "host.domain.com";
String port = "7001";
String ejbHost = "t3://" + host + ":" + port;

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

String componentDN = "default/MyBPMProject!1.0*soa_35304fdc-807b-49c8-b8e5-70b6accfbede/MyProcess";

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 =
BPMServiceClientFactory.getInstance(properties, null, null);
System.out.println("OK");

System.out.print("-> Authenticating user [" + user + "] ...");
IBPMContext 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 Image ...");
OutputStream processImageOutputStream =
ProcessInstanceAuditHelper.getProcessImage(bpmContext, bpmServiceClient, componentDN);
System.out.println("OK");

getAuditImage

public java.io.OutputStream getAuditImage(IBPMContext bpmContext,
                                          IBPMServiceClient bpmServiceClient,
                                          java.lang.String processInstance)
                                   throws java.lang.Exception
Returns the audit trail image of the given instance.
Parameters:
bpmContext - Authenticated context.
bpmServiceClient - BPM Service Client to obtain the necessary services.
processInstance - Process Instance Id.
Returns:
The OuputStream of the generated image.
Throws:
java.lang.Exception - if the operation fails. ex. String host = "host.domain.com";
String port = "7001";
String ejbHost = "t3://" + host + ":" + port;

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

String instanceid="21004";

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 =
BPMServiceClientFactory.getInstance(properties, null, null);
System.out.println("OK");

System.out.print("-> Authenticating user [" + user + "] ...");
IBPMContext 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 Audit Instance Image ...");
OutputStream auditImageOutputStream =
ProcessInstanceAuditHelper.getAuditImage(bpmContext, bpmServiceClient, instanceId);
System.out.println("OK");

getAuditXml

public java.lang.String getAuditXml(IBPMContext bpmContext,
                                    IBPMServiceClient bpmServiceClient,
                                    java.lang.String processInstance)
                             throws java.lang.Exception
Returns an XML representation of the Audit Trail for the given instance.
Parameters:
bpmContext - Authenticated context.
bpmServiceClient - BPM Service Client to obtain the necessary services.
processInstance - Process Instance Id to obtain its audit trail.
Returns:
XML representation of the Audit Trail.
Throws:
java.lang.Exception - if the operation fails. ex. String host = "host.domain.com";
String port = "7001";
String ejbHost = "t3://" + host + ":" + port;

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

String instanceid="21004";

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 =
BPMServiceClientFactory.getInstance(properties, null, null);
System.out.println("OK");

System.out.print("-> Authenticating user [" + user + "] ...");
IBPMContext 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 Audit Instance XML ...");
String auditInstanceXML =
ProcessInstanceAuditHelper.getAuditXml(bpmContext, bpmServiceClient, instanceId);
System.out.println("OK");

getAuditTrail

public oracle.bpm.services.util.AuditTrail getAuditTrail(IBPMContext bpmContext,
                                                         IBPMServiceClient bpmServiceClient,
                                                         java.lang.String processInstance)
                                                  throws java.lang.Exception
Returns the Audit Trail object for the given instance.
Parameters:
bpmContext - Authenticated context.
bpmServiceClient - BPM Service Client to obtain the necessary services.
processInstance - Process Instance ID to obtain its Audit Trail.
Returns:
the Audit Trail object for the given instance.
Throws:
java.lang.Exception - if the operation fails. ex. String host = "host.domain.com";
String port = "7001";
String ejbHost = "t3://" + host + ":" + port;

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

String instanceid="21004";

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 =
BPMServiceClientFactory.getInstance(properties, null, null);
System.out.println("OK");

System.out.print("-> Authenticating user [" + user + "] ...");
IBPMContext 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 Audit Trail tree...");
AuditTrail auditTrail =
ProcessInstanceAuditHelper.getAuditTrail(bpmContext, bpmServiceClient, instanceId);
System.out.println("OK");

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.