About Me

About Me
Working with SOA technologies , implementing solution using IBM BPM , IBM Integration Designer,IBM WODM and IBM DataPower

About me

View Mahesh Dondeti's profile on LinkedIn

upcoming posts on IBM Bluemix,Devops,Worklight,Node js.

Tuesday 18 February 2014

Shared Business Objects Usage in IBM BPMv8.0



Hello friends I would like to share scenario on usage of Shared Business Objects Usage in IBM BPMv8.0

About Shared Business Object:-



Shared Business object values should be accessible to other instances at run time. Shared business objects only apply to a complex structure type. The data within a shared business object is shared between business processes and tasks.

     A shared business object uses database resources. The data within a shared object is persisted to the database when:

  • The shared object is created
  • The business process or task is persisted to the database
  • The JavaScript method save() is performed on the shared business object




Declaring Shared Business Object:-




Example Scenario:-


 This Scenario display a employee details on simple coach .One employee variable is shared Bo type and another one is unshared Bo type.
 pic3


Variable declaration in BPD and Human Service:-
 



Running the Sample:-

 Employee HS output:-



This is first coach which is displaying the default values and click on ok button.Then flow will create a token on Employee1 (Usertask )  and Employee1(Usertask ) as I used parallel gateway it will wait until two tasks done.

Edit Employee1 HS output:-
 Change the values in Enter Last name field in Employee share and Employee Noshare  fields(i.e D to Dondeti)
 
 




Click on Ok button then flow waits  at Edit Employee2 HS out put. Run the service.





If you observe the above coach the value which I changed in EditEmployee1HS is affected to Employee Share BO because it was shared business object type.

How to initialize and Retrieve a shared Business Object Using Javascript:-

Ability to explicitly load shared Business Object if required using theunique key associated with it
• Loading a shared Business Object
            tw.local.empShare= newtw.object.EMPLOYEESHARE(uniqueKey)
• Getting the unique key:
            tw.local.empShare.metadata("key")
Example:-
// Create shared object
var empShare = new tw.object.EMPLOYEESHARE();
empShare.lastName = "Dondeti";
sharedObject.save();

// Create key for shared object
tw.local.empShareKey = empShare.metadata("key");
log.info("empShareKey: " + tw.local. empShareKey);

// Retrieve shared object by key
var empShare2 = new tw.object.EMPLOYEESHARE (tw.local.empShareKey);
log.info("empShare2. lastName: " + empShare2. lastName);

Thanks for reading .I hope this post helps you. So far this is my best effort to explain. Please correct me if I do anything wrong.

Please share your valuable suggestions and feedback to my mail id"mdondetisbit@gmail.com" to improve myself.

Please post any issues/query’s related to BPM,WODM and DATAPOWER  to "mdondetisbit@gmail.com