Business Objects and Lombardi Coaches

We’re working with IBM BPM 7.5 these days, or rather making it work, and a little idiosyncrasy of the product had us head-scratching for a few hours.

You may or may not know that the Lombardi part of the product uses variables to represent business process data. You would usually define variables local to the business process definition (BPD) and use data mappings to select what data will be used as inputs and outputs to the various activities within the process.

You can define your own data types (business objects) for these variables. So as way of example we defined an Individual, with string attributes for first and last names. Nothing fancy.

Then added a private variable to the BPD named individual of type Individual. Note how we did not specify a default value for the variable.

Suppose you now create a very simple BPD to use a UI Coach to populate the individual name and a simple javascript service to write the names to the log:

The log activity has a simple system script service to write the individual’s attributes to the system log:

When you run this, the first activity will let you populate the individual variable values:

What happens next is not that predictable. One would assume that the UI form took the user supplied values for fname and lname and used them to initialise and populate the individual.

Not quite.

Once the Coach task completed the process moved on to the log activity and failed. Crashed and burned.

The BPD instance has failed and the error is in the Log activity:

The details of the error are self explanatory, the individual variable is undefined:

It turns out that complex type variables need to be explicitly initialised, particularly when Coaches are involved!

http://publib.boulder.ibm.com/infocenter/wle/v7r1/topic/wle/modeling/topic/init_complex_vars.html

So, the IBM documented approach is to use a script activity to intitialise them:

But we also found out in our tests that giiving the variable default values also solves the problem, even if the values are empty strings:

So, hope this tip comes useful to someone else and you can look fwd to more posts on BPM 7.5

I’m sure we’re not going to be short of material for quite some time…

ttfn

About these ads

About Gabriel Telerman
Occupation: IBM SOA-BPM Consultant. Profession: Guitar Hero

12 Responses to Business Objects and Lombardi Coaches

  1. Fintan says:

    It is recommended to NOT use defaults at all – 2 reasons .. 1) when the underlying object changes the default assignment doesn’t so you will get errors in debug 2) When calling this service from another service / BPD in the data mapping the “use defaults” can sometimes be checked and not spotted, so at runtime the service uses the defaults rather than the actual parameters passed in by the calling service – easy one to miss

  2. Gabriel Telerman says:

    Thanks Fintan.

    1) We tested for this. If we just check the ‘Has Default’ box and supply no values, the tooling provides empty strings for String attributes and 0 for Integers. Adding attributes to the BO automatically adds default values to the variable (the default assignment does change).
    We haven’t tested for data types other than String and Integer.

    2) Nice tip. Much appreciated.

  3. Fintan says:

    Hi Gaby,

    In fact I always create “Constructor” services and use these to initialise data objects – let’s say I have a Customer object that has various attributes and a contained object Address. I create 2 constructor objects “Create Customer” and “Create Address” – in each case there is only an output variable of the type of the object. In the Address object constructor service it has a simple script to create a new instance of the Address. It is down to individual tastes whether to init the atomic attributes to default values (empty strings, false for a boolean, etc). In the Customer constructor service I init the Customer but do not init the Address contained within it. In a service / BPD that is to use the Customer object I first call the Customer constructor which will set my service / BPD private variable to the newly constructed Customer. Next I call the Address constructor and have the output variable mapped to the Customer.address of my private variable. I now have a fully initialised Customer structure to work with. If I later change that object then I know there is one and only one place where I have to change the initialisation code.

    • Gabriel Telerman says:

      Good advice Fintan!
      Any reason why you don’t allocate a new Address() while you are ‘constructing’ the Customer?

      • Fintan says:

        Just decided that I wanted to avoid bloat of unnecessary contained objects .. made the decision that each constructor is responsible only for the top level object (plus creating an empty list for any list attributes) – that way the consumer can decide how much of an object structure to initialise by calling a chain of constructors (or they can also create their own “super constructor” that calls all the necessary constructors.

  4. Gabriel Telerman says:

    OK – thanks again Fintan. I’m liking the pattern of defining business objects and associated ‘BO Factory Services’ in a toolkit. Amazing how all roads lead to core OO principles!

  5. Vignesh says:

    Very surprised to read your post. I know this initialization won’t happen in 7.2 but in version 7.5 of the product, I see this happen automatically.

    I dug in further to observe what I did different that made it to work. There was nothing special. May be I am using 7.5.1 and you are using 7.5.0?!

    Checking out Help -> IBM Business Process Manager in PD gives me the following:

    Version: IBM Business Process Manager 7.5.1
    Build Id: Apollo-Release-13-5be6e25e6f1ee1605c078879acaa53037022c933
    Build Date: 11/09/2011 06:13:38 PM

    How about yours?

  6. youtube.com says:

    Hi there, I believe your blog may be having internet browser compatibility problems.

    When I look at your blog in Safari, it looks fine but when opening in Internet Explorer, it’s got some overlapping issues.
    I simply wanted to give you a quick heads up! Besides that, great website!

  7. Gabriel Telerman says:

    Not a problem! Where’s your blog?

  8. Gaby, that was spam :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 162 other followers

%d bloggers like this: