Thursday, December 22, 2011

Invoking BPM processes via Java

Simple scenario -



Client will do a sync invoke the expressOrderProcess and get back an acknowledgement.

Steps -

1. Define conversation/interface for ProcessExpressOrder and Acknowledge
This will generate the wsdl and the required artifacts therein.




2. Create an EJB Service Interface based on the WSDL



3. Deploy and check that you can see the EJB in the JNDI tree




4. Create the Java client



Full doc at

https://docs.google.com/open?id=0B7YrnfO7h717ZDhmYjk0ODMtZTg5NS00NGRjLWFiOWEtYTM5NDhhNDMwNGU0

Wednesday, December 21, 2011

BPM 11g Feature Pack - Collaboration Diagrams

Collaboration diagrams allows us to see the flow of messages between participants.
The participants are represented by pools and swimlanes. Each pool is essentially a
standalone process.

Here is a simple example with 2 pools -





Now all you need to do is click on the Collaboration Diagram tab...



BPM 11g Feature Pack - Activity Guides

A great feature available OOTB with feature pack.

Here is my sample BPM process -



Here is the activity guide UI -



Full lab doc at -

https://docs.google.com/open?id=0B7YrnfO7h717NTc5NDMwZTMtOTNiZS00NjJiLTkxYTEtZDc1YjlhNTI1OGIz

JDev Project -

https://docs.google.com/open?id=0B7YrnfO7h717YjJkZTc2YTYtNTg3MS00OTQ1LTllN2QtZmU1YzQ0OTMwMDJh

Monday, December 19, 2011

SOA/BPM APIs - Manipulating Composites and purging instances

With the release of the BPM 11g Feature Pack, I've started revisiting the whole API space. There are many blog entries out there dealing with this area - however it is usually only one particular use case that's covered e.g. how to purge instances etc.

However, there are exceptions - Rommel Pino's series of posts on the API are well worth reading, as well as anything from Mark Nelson http://redstack.wordpress.com/author/markxnelson/


Over the next couple of posts I want to look at the different API levels -

- composite / composite instance
- component/ component instance --> BPM process
- human task

My starting point is the following simple BPM process.





My XSD-



My test input -




Notice I have created a composite sensor on the FileAdapter (Read)

Composite API


I going to go thru the composite API - querying composites and their components.
I will also show a couple of approaches to purging instances.

1. Purge all instances of a composite based on instance state e.g. STALE.
This we can do at composite level.

2. Purge all instances of a composite based on instance state e.g. STALE. but doing
individual auditing for each instance. This we can do at composite instance level.

3. Purge a composite instance based on a sensor value. e.g. purge instance for orderID = 3.

The following code - will query all composites and list their components -

****************************************************************************

public void getAllComposites() throws Exception {
System.out.println("getAllComposites()");
Locator locator = null;
int purgedInstanceCount = 0;

try {
locator = this.getLocator();
CompositeFilter compositeFilter = new CompositeFilter();
CompositeInstanceFilter instanceFilter = new CompositeInstanceFilter();

//Get all composites from the domain based on the filter given
List composites =
locator.getComposites(compositeFilter);

System.out.println("*** Found " + composites.size() + " Composites.");

//Iterate through the composites.
Iterator compositeIter = composites.iterator();
while (compositeIter.hasNext()) {
Composite composite = (Composite)compositeIter.next();
System.out.println("Composite DN = " +composite.getCompositeDN());
System.out.println("Composite State = " + composite.getState());
System.out.println("Composite Instance count = " + composite.getInstanceCount());
List components = composite.getComponents();

// List Components

Iterator componentsIter = components.iterator();
while (componentsIter.hasNext()) {
Component component = (Component)componentsIter.next();
System.out.println("*** Component DN = " +component.getDN());
System.out.println("*** Component Name = " + component.getName());
System.out.println("*** Component Type = " + component.getImplementationType());
System.out.println("*** Component Total Instances = " + component.getNumberOfInstances());
System.out.println("*** Component Active Instances = " + component.getNumberOfActiveInstances());

}
//
}

} catch (Exception e) {
e.printStackTrace();
}
}
********************************************************************

My test output is as follows -



The following code will query the composite instances and output their composite sensor values -

*******************************************************************

public void getInstances(String compositeName) throws Exception {
System.out.println("getInstances() for composite " + compositeName);
Locator locator = null;

try {
locator = this.getLocator();
CompositeFilter compositeFilter = new CompositeFilter();
CompositeInstanceFilter instanceFilter = new CompositeInstanceFilter();

instanceFilter.setCompositeDN(compositeName);

//Get composite from the domain based on the filter given
List compositeInstances =
locator.getCompositeInstances(instanceFilter);

System.out.println("*** Found " + compositeInstances.size() + " Composite Instances.");

//Iterate through the composites.
Iterator compositeIter = compositeInstances.iterator();
while (compositeIter.hasNext()) {
CompositeInstance compositeInstance = (CompositeInstance)compositeIter.next();
System.out.println("Composite Instance DN = " +compositeInstance.getCompositeDN());
System.out.println("Composite Instance State = " + compositeInstance.getState());
System.out.println("Looking for Composite Sensors...");

List l_sensorData = compositeInstance.getSensorData();
for (int i =0; i < l_sensorData.size(); i++){
SensorData sensorData = l_sensorData.get(i);
System.out.println("*** Sensor name " + sensorData.getSensor().getName());
System.out.println("*** Sensor value " + sensorData.getData().toString());
}
}

}
catch (Exception e){
e.printStackTrace();
}
}

************************************************************************

My test output -



------------------------------------------------------------------------

Let's now do something with the instances e.g.
purge Stale instances.



Instance state can have the following values -






Here I have a couple of stale instances -








I use the following method -

***************************************************************************+

public void deleteCompositeInstances(String compositeName, int state) throws Exception {
System.out.println("deleteCompositeInstances() for composite " + compositeName + " with state " + state );
Locator locator = null;
String orderID = null;
try {
locator = this.getLocator();
CompositeInstanceFilter instanceFilter = new CompositeInstanceFilter();

instanceFilter.setCompositeDN(compositeName);
instanceFilter.setState(state);

//Get composite from the domain based on the filter given
List compositeInstances =
locator.getCompositeInstances(instanceFilter);

System.out.println("*** Found " + compositeInstances.size() + " stale composite instances.");

//Iterate through the composites.
Iterator compositeIter = compositeInstances.iterator();
while (compositeIter.hasNext()) {
CompositeInstance compositeInstance = (CompositeInstance)compositeIter.next();

List l_sensorData = compositeInstance.getSensorData();
for (int i =0; i < l_sensorData.size(); i++){
SensorData sensorData = l_sensorData.get(i);
orderID = sensorData.getData().toString();
}
System.out.println("About to delete instance for orderID = " + orderID);
compositeInstance.delete();

}

}
catch (Exception e){
e.printStackTrace();
}
}


***************************************************************************






We can also purge at the composite, as opposed to the compositeInstance level

************************************************************************

public void deleteCompositeInstancesNoAudit(String compositeName, int state) throws Exception {
System.out.println("deleteCompositeInstancesNoAudit() for composite " + compositeName + " with state " + state );
Locator locator = null;
try {
locator = this.getLocator();
CompositeFilter compositeFilter = new CompositeFilter();
compositeFilter.setCompositeDN(compositeName);

CompositeInstanceFilter instanceFilter = new CompositeInstanceFilter();
instanceFilter.setState(state);

//Get composite from the domain based on the filter given
List l_composites =
locator.getComposites(compositeFilter);

//Iterate through the composites.
Iterator compositeIter = l_composites.iterator();
while (compositeIter.hasNext()) {
Composite composite = (Composite)compositeIter.next();
System.out.println("About to purge "+ composite.getInstances(instanceFilter).size() + " instances... ");
composite.purgeInstances(instanceFilter);

}

}
catch (Exception e){
e.printStackTrace();
}
}


******************************************************************************

The composite sensor can be used in em to find instances based on orderID.



We can also purge instances based on the composite sensor value.
My composite sensor is called compSensor_orderID -

Here is the code -

**********************************************************************
public void deleteCompositeInstance4OrderId(String compositeName, String orderID) throws Exception {
System.out.println("deleteCompositeInstance4OrderId() for composite " + compositeName + " with orderID " + orderID );
Locator locator = null;

try {
locator = this.getLocator();
CompositeInstanceFilter instanceFilter = new CompositeInstanceFilter();

instanceFilter.setCompositeDN(compositeName);

List l_sensorFilter = new ArrayList ();
SensorFilter sensorFilter = new SensorFilter("compSensor_orderID",Sensor.SensorDataType.STRING,Operator.EQUALS,orderID);
l_sensorFilter.add(sensorFilter);

instanceFilter.setSensorFilter(l_sensorFilter);

//Get composite from the domain based on the filter given
List compositeInstances =
locator.getCompositeInstances(instanceFilter);

System.out.println("*** Found " + compositeInstances.size() + " composite instance(s) for orderID " + orderID);

//Iterate through the composites.
Iterator compositeIter = compositeInstances.iterator();
while (compositeIter.hasNext()) {
CompositeInstance compositeInstance = (CompositeInstance)compositeIter.next();

System.out.println("About to delete instance for orderID = " + orderID);
compositeInstance.delete();

}

}
catch (Exception e){
e.printStackTrace();
}
}

**********************************************************************

Wednesday, December 14, 2011

BPM 11g Feature Pack - Update Task

Nice feature -



In this scenario I have an order process that includes an event sub-process that listens for order modifications. Once a modification is received, the payload is updated and the original User Task is withdrawn/resubmitted.



Full lab doc at
https://docs.google.com/open?id=0B7YrnfO7h717ZjdlY2Q1YzctYjhiYi00ZTQ2LWIxZmEtODY5YTI3ZTdmZmE3

JDev app at

https://docs.google.com/open?id=0B7YrnfO7h717MzhjNzcyYjQtOWM1OS00MDA5LTk5N2MtYjhhOGRlY2VjNTEz

BPM 11g Feature Pack - Parametric Roles

In this simple example, I create a parametric role for Sales based on area and custStatus.

Here is the XSD -



My sales force is jcooper, mtwain, cdickens and wfaulk.
Responsibilities are as follows -




The broad steps are as follows -

1. Create 2 org units in BPM workspace - EMEA SALES and APAC SALES
2. Add users appropriately
3. Create Extended user properties for area and status
4. Map the properties to the users e.g. jcooper property area will be set to EMEA.
5. Create a parametric role that leverages the properties.

6. Create your BPM app
7. Add a User Task - Set participant list to parametric roles and configure
8. Deploy and test

Full description at -

https://docs.google.com/open?id=0B7YrnfO7h717M2U1MTlmMmEtZjI3Mi00ZTNhLWFhNTQtYzkyZjc5OGI5Y2I4

Monday, December 5, 2011

Oracle Enterprise Gateway (OEG) - changing the default Alert subject

Merci beaucoup Isabelle for the pointer!

Here is an example email output from a lab I created.



Now you notice that the subject defaults to Alert from Vordel. You will probably want to change this. To do this we need to add a new Subject to the default Alert configuration.

Start esexplorer.






Point to your OEG configuration file



Select the Default Alert Configuration – then the SysAlert you already created.
Right-click --> Create a Subject



Set to a value of your choice




Start your email server e.g. James
Start the gateway
Test

Thursday, November 24, 2011

BPM 11g feature pack - Notification Task

Nice feature -

In this simple scenario I receive an order containing, among other data, the customer's email address.
First thing I do is send an email confirming receipt of the order.

As usual I'm using JAMES as my email server -

Step 1 - Create some users on JAMES



Step 2- Configure the EMAIL properties on the SOA Server

Set Workflow Notification Properties:





Set usermessaging-email-driver properties















Step 3 Create a simple BPM App



I use the File Adapter to read in the orders.




My XSD / input XML is as follows -




Step 4. Deploy and Test

Sunday, November 20, 2011

Oracle Weblogic 12c launch

December 1st -


Hear, with your fellow IT managers, architects, and developers, how the new release of Oracle WebLogic Server is:

Designed to help you seamlessly move into the public or private cloud with an open, standards-based platform
Built to drive higher value for your current infrastructure and significantly reduce development time and cost
Optimized to run your solutions for Java Platform, Enterprise Edition (Java EE); Oracle Fusion Middleware; and Oracle Fusion Applications
Enhanced with transformational platforms and technologies such as Java EE 6, Oracle’s Active GridLink for RAC, Oracle Traffic Director, and Oracle Virtual Assembly Builder

Simply register at -
https://event.on24.com/eventRegistration/EventLobbyServlet?target=registration.jsp&eventid=375727&sessionid=1&key=108E7A597FD93F05D40355E5A6A5F60C&partnerref=Oracle_Internal_Email_Lists&sourcepage=register

Friday, November 18, 2011

Oracle SOA Suite HealthCare Integration

Officially released last month and well worth looking into for integration projects in the health care space. So if your customer is looking at HL7 over MLLP - then look no further.

http://www.oracle.com/technetwork/middleware/healthcare/overview/index.html

Saturday, October 29, 2011

BPM 11g Feature Pack - Correlation

Simple example to show feature pack correlation at work -

Scenario: we have 2 BPM processes one for processing orders and one for cancelling orders

1.MyOrderProcess - does the order approvals etc. Orders arrive via the FileAdapter
(ReadOrder – / inOrders directory).

2. MyCancelOrderProcess – processes order cancellations and informs the OrderProcess. Order cancellations arrive via the FileAdapter (CancelOrder - /inCancellations directory).

When a cancellation message arrives, OrderProcess is informed – order processing is terminated and an audit message is written to a file (AuditOrder/audit directory)

So we need correlation between the 2 - we do this essentially the same way as we do in BPEL.

We create the same correlation keys/properties in both processes - based on the orderID.

















Full lab doc at

https://docs.google.com/open?id=0B7YrnfO7h717YWIxYjFlMDEtMDQzZi00ZTJiLThmYmEtMDg2NjE2Mjc3NzI4

App at -

https://docs.google.com/open?id=0B7YrnfO7h717MTJiMWZhM2QtYzFlOS00MjRmLTkyZGUtNTYzODM2MzYxMzIy