Thursday, August 21, 2014

#8 BPM 12c New Features --> Business Parameters

These are used for setting  business specific constants and can be overridden for an Organization Unit.
If there is no override value for Org Unit, the returned value will be the default value.

So how do these work?

Defining a Business Parameter









These are defined on the Organization Tab.

I have created the following org unit - Sales













Note: I associate this org unit with the project at deployment time.
User weblogic works in Sales






















Using in a BPM Process


Now I want to use this constant in my process.







My input order is as follows -





















Note: I have added a method to compute the end price.

I initialise a couple of variables in the Start activity.













I then SetSalesTax






The order is then approved, after which I execute the computePrice Activity.
This is a script task -






















I then add this to the output message in the End activity-






Deploy / Test















Approve the order








View the trace -







5% Sales Tax has been applied.














Change Business Parameter in Composer


The value can be changed by logging in to BPM Workspace and clicking on the
Administration tab.












You will see the Business Parameter (referred to as Constant here), and you can amend it accordingly.

#7 BPM 12c New Features --> Process Instance expiration

Nice feature...

A new pre-defined variable - expiration is now available.

You can use get/set on this.

Here is a simple example -



Here I set expiration to
xp20:add-dayTimeDuration-to-dateTime(xp20:current-dateTime(), 'PT3M')


I do this in the Start activity of my process. I also log the expiration value after output association.








So we should timeout after 3 minutes.

I deploy and test -










The expiration date has been set correctly, I started the test at 11:50.

I wait and meditate...

suitably refreshed, I return to em and see the timeout error.
















Now I change the composite to catch this timeout.
































I deploy / re-test.



















Here is my log message from the error handling sub-process -










Check out Albin's blog for syntax on using dates etc and xp20

#6 BPM 12c New Features for Business Rules --> leveraging Excel

Nice value-add to BPM 12c Business Rules...

I create a new 12c composite.














The in/out to the rules is as follows -
















I create a range in the rules dictionary














I create a decision table and a rule based on the amount, leveraging the range.














Now I can export this to Excel and add more rules, if required.








































Note the 3 tabs in the excel sheet

Here I add a new rule for very low amounts -








I save and re-import.












The new Rule is highlighted



















I click accept changes and the rule is no longer highlighted.











#5 BPM 12c New Features - forced commit after execution

Can be used to avoid re-invoke of activity in case of rollback

Here is a simple example of this new functionality.

To begin, here is my composite - write an order to a file and then the orderNr to the DB.










I deploy the composite and test.

Here is my file -









You can ignore the other contents of this directory.

Here is my row in the DB. The table has only one column - order_nr. This is also the primary key.



















I execute the same test again -

















I get the expected error - due to primary key violation.




































Naturally, I now have 2 output files -





I now delete the row in my orders DB.

I recover the error in em.











Now I have 3 files -






and 1 row in the DB.






















So we all agree, this is not good?

So let's say how 12c can help us here -

I check Force commit after execution on the Write2File activity.













I re-deploy and delete the 3 output files, as well as the DB row.

Re-test with order_nr = 1

Output file is written -


















DB row is written -


















I resubmit the same order -











The fault is thrown.

I now have 2 output files -





I delete the DB row and re-submit the message from em.










No extra output file has been written.















Ergo, recovery started from the WriteDB activity.