Showing posts with label BPEL. Show all posts
Showing posts with label BPEL. Show all posts

Saturday, September 26, 2009

Human Tasks in Oracle Fusion 11g

With today post I'm closing series of posts, where I was describing how you can orchestrate and connect various services with Oracle Fusion/SOA 11g. Before reading this post, I would recommend to look through my previous related writings:
  1. Web Service Interface for ADF BC Application Module in Oracle Fusion 11g
  2. Service-Enabled Entity Objects in Oracle Fusion 11g
  3. Business Events and ADF Business Components in Oracle Fusion 11g
  4. Business Rules in Oracle Fusion 11g
In those posts I was describing a set of sample applications and modeling SOA solution. This solution is based on three modules:
  1. ADF BC application (A) with custom methods exposed through Web Service
  2. ADF BC application (B) subscribed to application (A) services. Application (B) implements Business Events triggering and ADF Faces Rich Client UI
  3. SOA Composite application (C) to orchestrate business flow based on data from Business Event. Application (C) integrates Business Rule, Human Task and Web Services
Today I will describe Human Task functionality in Oracle Fusion/SOA 11g. Download sample application - SalaryManagement3.zip. This application extends SOA Composite sample developed in my previous posts - ApprovalHumanTaskFlow composite is added:


In BPEL flow, we can see there is a Switch activity added right after Business Rule from previous post:


Switch activity checks Business Rule output and if approval is required Switch scope is executed to trigger Human Task:


Before triggering Human Task, Switch scope invokes EmployeeWorkload method (through Web Service from application (A)), this method provides additional input to Human Task:


Invoke Activity for EmployeeWorkload method:


This method is invoked through Web Service implemented in SalaryControlService (A) application, it is declared in SOA Composite:


Human Task accepts three parameters - Employee Id, Salary Change value and Employee Workload value based on previous assignment history. Manager should approve or reject Salary Change based on provided information:


Human Task wizard in JDeveloper 11g - I have specified Title, Parameters and Approver in Assignment Policy:


There is one more Switch activity and it is designed to route process according output from Human Task. If manager will reject raised request, original salary value will be set back in database. If request will be approved, no action will be taken, because salary value already is updated in database by ADF BC:


Thats it, Human Task is defined and its output is processed. Now its time to check how it works on runtime. Let's use application (B) and for Employee Id = 101 update original Salary value 16000:


To 15000. Salary change is 1000 and this will not violate Business Rule, where it is declared maximum change without manager approval is 5000:


Human Task will not be initiated in this case - process instance will be successfully executed without Human Task intervention:


Let's update now to 23000, it will be 8000 change and Business Rule should trigger Human Task invocation:


You can see Human Task is in running state:


We need to approve or reject raised Human Task in order to complete BPEL process. We can do this through sample Oracle BPM Worklist application provided by Oracle together with Oracle SOA Suite 11g:


When I login into BPM Worklist, I can see there is a Salary Change task assigned to my user:


I can approve or reject it:


In this particular case I have rejected Salary Change and BPEL process became completed:


You can notice in the log, that right after Human Task there was SalaryControlService reference executed, this means Salary Change was rejected and Web Service method was invoked to store original salary value.

Thursday, September 10, 2009

Business Rules in Oracle Fusion 11g

Today I'm writing my fourth post in Oracle SOA series and will cover Business Rules functionality. I recommend to check my previous post - Business Events and ADF Business Components in Oracle Fusion 11g, sample application I'm describing today is extended version of application from my previous post. What Business Rule means? Simply speaking, its a container that encapsulates specific functionality logic. In Oracle SOA Suite 11g, Business Rule accepts inputs and returns outputs. This means we can understand Business Rule as a black box in general process flow. This black box can be reused and updated at any point of time, without affecting other components in the flow.

You can download and deploy sample application with implemented Business Rule - SalaryManagement2.zip. As I already have mentioned, this sample is extended sample from my previous post. In my previous post I have declared Business Event on ADF BC Entity Object and developed SOA Composite in Oracle SOA Suite 11g with Mediator subscribed that Business Event.

I have updated my previous SalaryManagement application with addition of one more Scope component to BPEL flow - Scope_CheckSalaryChangeRange:


This scope contains Assign activity and Business Rule component:


Ok, let's start from the beginning - what type of Business Rule I want to implement. I want to implement a check to compare the difference between original and updated salary values. I'm getting those values through Business Event raised by ADF Business Components. My Business Rule will compare the difference between salaries with predefined constant value. If the difference will be too big, Business Rule will return true in order to invoke Human Task for approval. Human Task will be implemented in my next post.

First thing I did, I have declared local variable lSalaryChangeApprove in Scope_CheckSalaryChangeRange scope. This variable will be used as input and output parameter for Business Rule:


As a next step, I have created already mentioned Assign activity and initialized there lSalaryChangeApprove variable with false value:


Initializaton is done through a wizard, you can see on the right side there is a local variable:


When initialization and preparation part was done, I have declared Business Rule RequiresSalaryChangeRule in composite.xml by choosing Business Rule Service Component from Resource Palette:


Business Rule is based on XSD schema with two elements - salaryChange and approvalRequired. First is the difference between original and new salaries, second is Business Rule outcome:


I just defined Business Rule in SOA composite, will implement it a little bit later. Now I'm back to BPEL editor, where I will drag and drop Business Rule activity inside BPEL flow. Business Rule definition wizard is opened, where I can choose just few seconds ago defined Business Rule available in Dictionary:


I will define two inputs - first will be the difference in salary and second will get local variable lSalaryChangeApprove value:


First variable value is calculated by subtracting original salary value from new and applying mathematical abs function:


Second variable initialization from scope local value:


Input variables are declared, now let's move to output:


For output, I'm assigning back result of Business Rule to local scope variable:


When inputs/outputs are defined, just press Ok button and Business Rule will be included into BPEL flow:


The last step - actual Business Rule logic implementation. Open newly created Business Rule wizard and at first define global variable - MAX_SALARY_CHANGE. This global variable will contain constant value for salary difference comparison - limit for automatic salary change approval:


If changed salary will not satisfy predefined limit, manual approval process will be required - approvalRequired variable will be assigned with true:


Business Rule is defined, now you can deploy SOA Composite to Oracle SOA Suite 11g. In order to test this Business Rule, I'm using Oracle ADF front-end application from my previous post. Let's open some record, with current salary equal to 7000:


And update it to 15000, in order to violate our salary change Business Rule:


During salary change, ADF BC is raising Business Event. Through Event Delivery Network this event is delivered to subscribed Mediator, from where in BPEL flow Business Rule is triggered and received data is processed to generate output. Full trace log:


If you open to see detail trace for Business Rule, you will find it says that manual approval for this change will be required. And its correct, because difference between salary values is 8000:


Again, if I change salary value from 15000 to 12000:


Its logical that manual approval for salary change will not be required in this case:


In my next post I will describe how to implement Human Task for manual approval.

Spanish Summary:

Este post Andrejus nos explica lo que es un Business Rule (Regla de Negocio) y como lo podemos desarrollar con Jdeveloper. Este post es parte de la coleccion de temas SOA que andrejus ha escrito y que recomienda leerlos antes de revisar este post.

Saturday, August 22, 2009

Business Events and ADF Business Components in Oracle Fusion 11g

I continue a series of posts, where I'm describing Oracle SOA Suite 11g and JDeveloper 11g functionality. Before reading this post, you might be interested to read my previous posts - Web Service Interface for ADF BC Application Module in Oracle Fusion 11g and Service-Enabled Entity Objects in Oracle Fusion 11g. My today post sample application is based on mentioned blog posts.

Business Events and Event Delivery Network (EDN), its something that makes Oracle SOA Suite 11g really strong integration platform. While discussing with customers, usually everyone is seriously concerned about loosely coupled integration, no one wants to integrate IT systems with strongly coupled services. Thats logical, because there are different systems and those systems constantly changing. Oracle SOA Suite 11g allows to implement loosely coupled integrations with Business Events. You can understand Business Event as a signal, that was sent by radio transmitter. Transmitter knows nothing about receivers, its receivers business to subscribe to particular event. Oracle SOA Suite 11g brings Event Delivery Network (EDN), space where Business Events can be raised and received across SOA infrastructure. Business Events in SOA Suite 11g can be raised not only from ADF Business Components, but from BPEL process for example as well.

Today I will use both applications from my previous posts mentioned above. I will add Business Event to application described in Service-Enabled Entity Objects in Oracle Fusion 11g post, you can download updated sample - SalaryUpdateRemote2.zip. Additionally for today post I have implemented SOA Composite where I'm subscribing to Business Event raised from ADF Business Components - SalaryManagement.zip. You can find more info about Business Events and EDN in Oracle SOA 11g Developer Guide Section 44 Using Business Events and Event Delivery Network, also check Edwin Biemond post - Events in ADF BC and handled by the SOA Suite Mediator.

Good news - we can declare Business Events on Service-Enabled Entity Objects, it works same as declared on normal Entity Object. Here is declaration:


In Business Event definition I have specified to track Salary attribute value changes. Along with changed Salary attribute value, I want to add to the payload EmployeeId attribute value. Event is published and will be raised during Update action based on Salary attribute change.

Thats all about Business Event definition in ADF Business Components, now I will develop SOA Composite where I will subscribe to Business Event. Implemented SOA Composite:


SOA Composite contains two Components (Mediator and BPEL process) and one External Reference (File Adapter):


Mediator subscribes to Business Event, and forwards it to BPEL process, where Business Event data is written to file system. In this post I'm focusing on Business Events from ADF Business Components, in my next post I will focus on BPEL process implementation. Mediator receives Business Event, BPEL process will manage it, this means Business Event schema transformation should be defined:


Schema transformation can be done automatically in JDeveloper 11g:


Basic BPEL process for today post, received Business Event data is stored in file system using File Adapter:


File adopter is defined with the same WSDL as BPEL process, means it will know Business Event input data format and will store information in C:/tmp folder:


I have deployed both applications (ADF application and SOA Composite) to Oracle SOA Suite 11g WebLogic server and opened ADF Application screen:


Data is retrieved through Service-Enabled Entity Object from Web Service. I will change Salary value and press Save button to update Salary attribute value:


Business Event was raised from ADF Business Components, subscribed Mediator from SOA Composite received it and forwarded to BPEL process where data was written to file system:


You can see that we received Employee Id and changed Salary attribute values.

Let's see process flow in Oracle Enterprise Manage Web console for Oracle SOA Suite 11g. We can see there log for all SOA Composite - SalaryUpdateComposite instances:


If I click on latest instance, I will get its trace log:


You can click on SalaryManagementProcess and open visual process flow:


And finally if you click on InvokeSalaryChangeLog BPEL Invoke activity, as well you will see there data from Business Event:


Spanish Summary:

Este post muestra una carateristica de integración entre Jdeveloper 11g and SOA Suite. En esta oportunidad se muestra el uso de los Business Events, para intercambiar y almacenar información de los salarios de los empleado usando SOA y los ADF Entity Objects.