A process analyst needs to have expertise on BPMN 2.0 models. They should also be able to understand the business process and business rules, collaborate with other business users, and simulate and document the process. It is also expected that a process analyst can model and edit the process on runtime using BPM Composer if there are changes in the business requirements. Oracle BPM allows process analysts to monitor the process, or even assign a given task to any user in the workflow system. BPM's out of the box integration capabilities allows analysts to view or check-in documents from or into the content repository related to his process.
A process developer needs to have expertise on BPMN 2.0 models from a technical point of view and the ability to write complex business logic in Java or PL/SQL. If required, he needs to have expertise in implementing the process model itself, by integrating with the necessary applicants or legacy systems by using BPM or SOA.
This recipe continues from the previous process model and implements the eligible customers business logic.
Before we begin, the following requirement needs to be fulfilled:
Download the source code from the previous recipe.
Use Oracle SQL Developer to develop and test a stored procedure to compute the EMI amount. We can use the SQL scripts provided in the code files of this recipe to create the database user and execute the procedure.
Ensure that SOA Suite is running.
Let us understand how a home loan EMI is calculated. Home loan EMI's are calculated based on the following formula:
EMI = (L*I)* {(1+I)^N / [(1+I)^N]-1}
Where:
L = Requested loan amount
I = Interest rate (rate per annum divided by 12)
^ = To the power of
N = Repayment duration in months
So, assuming a loan of 100,000 INR at 11 percent per annum that is repayable in 15 years, which is 180 months, the EMI using the formula will be:
EMI = (100000*0.00916)* {(1+0.00916)^180 / [(1+0.00916)^180]-1}
EMI ~ 916 * (5.161846 / 4.161846)
EMI ~ 1,136 INR
We need to create a PL/SQL procedure that can calculate fixed and variable EMIs, and also generate a unique request ID for every eligibility request. We will be passing the interest rate (I) to the PL/SQL procedure from the BPM business rules.
Writing a business logic in PL/SQL and integrating it with the process is done as follows:
Log in to Oracle Database as the
SYS
user.Create the
JAMESBANKDB
user and grant all the required create table, create trigger, and create sequence privileges to this user.Log in as
JAMESBANKDB
.Create the procedure to calculate EMIs and write the data in the database table.
Compile and Run the
Insert Eligibility
procedure. This procedure will insert the eligibility data into a table, calculate the EMI amount for fixed and variable rate of interest, and also return a unique ID for the eligibility request.Launch JDeveloper and open the James Bank application developed in the previous recipe.
Open
composite.xml
in the Design view.In the External References area on right side in the Design view, insert a Database Adapter service.
Set up the necessary database connection parameters:
Connection Name:
jamesbankdb
Username:
jamesbankdb
Password:
welcome1
JDBC Port:
1521
Service Name:
orcl
Test the connection and proceed if it is successful.
In the Adapter Configuration Wizard, select the Call a Stored Procedure or Function operation type.
From the configuration wizard, select the
EMI Calculator
stored procedure.Open the
LoanEligibility
process in the Design view, and change theEligibleCustomers
activity into a service task, and make it active (earlier it was marked as draft).Select the Database Adapter service that we have created in the service list.
Now click on Data Associations and ensure that the necessary input and output parameters are passed.
Save the process and deploy on SOA Suite.
Generate a web service-based Application Development Framework (ADF) data control by using the deployed WSDL URL, and drag-and-drop it on the JSPX page.
Right-click and Run the JSPX page to test the web service from the browser by giving necessary input parameters, and then clicking on the Check Eligibility button, as shown in the next screenshot.
We have build a PL/SQL procedure to calculate EMIs, store the necessary input data into the database table, and generate a request ID for every eligible application request. In the James Bank's loan application business rules, we are dynamically passing the fixed and variable interest rate (I). We have also built a business logic that defines Platinum, Gold, Silver, Bronze, and NE customers. We then deployed our BPM process. The process can be tested from Enterprise Manager or a simple ADF web service-based data control.
The role clarification process analyst was responsible for creating the dynamic business logic in the BPM process, including business rules, whereas the process developer was responsible for creating the PL/SQL stored procedure for the static business logic. The process developer was also responsible for creating and deploying the ADF application, and implementing some of the process logic as planned by the process analyst.
The output of this recipe is ready to run the home loan EMI calculator application that works on a particular business logic. We also learnt how the business logic in the BPM rules engine communicates through a service invocation with the business logic stored in stored procedures or any other legacy systems.
In the browser UI, enter input values and check for the web service return values, as shown in the following screenshot:
Log in to Enterprise Manager and view the process flow. The major change that we see in the process flow is the business service invocation at the PL/SQL database layer by the BPM process.
Our business logic is now ready to be used in the main Home Loan Process.
It would also be interesting to know that BPM supports integration with EJB-written business logic. So if we are not planning to implement PL/SQL-based business logic, we can write the same logic by using EJBs, and invoke it as a BPM service activity. Alternatively, we can also use a combination of BPMN expression language to compute the EMI, and use a simple Database Adapter to write the data into a database table and generate the request ID.