Thursday 10 November 2011

Business Rules and Exclusive Gateway

02-Business Rules and Exclusive Gateway

Setting Up Business Rules

Lets set up a simple Business Rule , Student applications having less than 70 % marks will be rejected , and application having greater than equal to 70% will be accepted , and later on Accepted Applications will be reviewed and Approved by the Admin.
Drag and Drop “Business Rule” from the activity next to User Task Initiator

Click on the + Sign to create new Business Rule or finder icon to use existing Business Rules
Select Use Association and Use Transformation,

Data Association helps sending XSD Reservation Business Rule Schema into and out of Business Rules, This can be done using drag n drop of Admission Data Objects into input and output locations

We would need transformation because from the input payload entered during task initiation we would need to pass percentage marks, reservation category, etc into Business Rule based on which we would evaluate business rule and decide on the Business Rule output
So create new transformation and map the variables from Student Form DO to Admission Rule Data input


Now open the ReservationBusinessRule.rules file and set the 2 rules under 1 ruleset
RuleSet1
General Merit Rule , if percentage is greater than or equal to 70% then , the application form is accepted by setting Business Rule Output Status to “accepted”
Rules for Rejection, if percentage is less than 70% then, the application form is rejected by setting Business Rule Output Status to “rejected”

Exclusive Gateway – Decision Box

Lets use Exclusive Gateway to make a decision , that only accepted applications are sent for approval by the admin , and the process flow would end if the status of application is rejected by the business rule

You can use conditional statement to determine using xpath expression
AdmissionRuleDataOutputDO.ruleOutStatus == “accepted”

Setting up User Task – Human Approver

Drag n Drop User Task , In the Data Tab add the payroll input

From the AdminApprovalTask.task, Select Create Form, then Auto Generate Task form , this created an UI , that would be used by the approver to see the input payload data as sent by the task creator , in our case the student is task initiator and Admin Officer is Approver
So the final process looks like below

BPM Process Workspace

http://soabpm-vm:8001/bpm/workspace
Login as Student jcooper, fill in the form data as shown below

Since the student has above 70% rules engine executes and accepts the application , log out and login to workspace as Admin Officer jstein
you can see the payload data entered by jcooper , and jstein can Approve or Reject the application

Once Approved the process ends, However later on we update this process to invoke some other services such as DB Adapter to write student record into DB or Rejected applications into file

Setting Up Process Escalations or Expiry

Sometimes the approver might not approve and the task might keep waiting in his task list there by impacting other related process , so to over come that we can have escalations when the approver has not responded with in certain time limit it can be routed to his manager for his action , Also its possible to expire the task after certain time limit ( days or hours / min )
For our case if the Admin Officer jstein does not take action with in 1 min then the task is routed to his manager wfaulk :-) sounds simple inst it ?

No comments:

Post a Comment

xslt padding with characters call template for left pad and right pad

  Could a call-template be written that took two parameters ?   a string, and a   number) return the string with empty spaces appended t...