Pages

Helpful Links

Thursday, December 8, 2011

Oracle BPM: Working with Exceptions

Like every project and application exceptions are really important. They make small mistakes in the project almost negligible, good exception handling tries to hide the bugs in the project. In Oracle BPM exception handling is covered and multiple ways are given to handle the exception that occur outside the normal flow. 4 types of exception are covered:
  1. System Exceptions
  2. Business Exceptions
  3. Code level Exception Handling
  4. Process level exception Handling
1. System level exception for hardware and software problems or unavailability. It is covered by BPM itself as it contains in component catalog -> java -> Lang -> Exception. An error or reason is given to end user.

2. Business Exceptions are generated by business rules. They are generated if some business rule is not met, for example the code below
if creditlimit > givenlimit then
   limitException as OverLimitException = OverlimitException()
   limitException.value  = creditlimit
   throw limitException 
end 
3.  Code level exceptions are handled at code level like
do
  // regular code 

on Exception
  // exception handling code

on exit
  // clean-up code (always executed)

end 
4. When an exception is not handled at code level it becomes a process level exception. It can be handled in flow like the flow given below.
 First add two interactive activities one for instance expiration and one for business exception:
Exception Handling
 Take note from the image given above. First a new instance variable called exception Holder is added of type:Any. Secondly, a business Exception is added under the currently used module of the name Exception by Right clicking on the module-> New-> Business Exception.


Right Click on any role and click Exception to then give the name of the activities you want the type of Exceptions to be handled. The business Exception from the flow above is a business exception that is thrown from Fill Product detail activity using the following code in method.

throw Product.Exception;

The exception is then catched by the Process Exception and the following properties are being entered inside the connector.

Exception Handling
 Now we reach the Exception Handling stage where inside the exception handling stage we can ask the end user how he/she wants to handle the exception. This stage can be handled using the presentation and methods. I have used the method that asks users how they want to handle the exception using the method. The choices are they want to abort(delete) the instance or they want to send the exception back to the activity where the exception occurs. The third choice is to hold the instance in the exception handling stage.


Exception Handling choices


Note: We don't always need to ask the end users for exception handling. Almost all of the exception handling can be done without user interaction. For Example in the case of Instance Expiration from the process deadline missed, this process exception can be sent back to the activity where the exception was generated by removing or extending the deadline.


 

No comments:

Post a Comment