Understand the code behind Business Data Model, Business Variables and Process Variables

1
0
-1

Hello!
I'm fairly new to Bonita so please show some mercy on me for asking such trivial questions.

I have followed the official Getting Started guide. Yet, it doesn't cover more sophisticated diagramming like using gateways and providing conditions.

I tried to build a process with gateways on my own, but that resulted in a question related to what is the code behind the data used within a process.

1) According to the documentation, a business data model is a simple Java class. Fine. Let's say we have named it: RequestApproval.

This is the specification for all our data that will be used in the process. Here we declare all the variables that will be used later, say: status, refusalReason, userNote.

Then we select a pool (which actually represents the corresponding process) and specify a business variable. Again, the documentation says that this is no more than an instance of the class declared as a business data model. Our business variable is called requestApproval to comply with the documentation guidelines.

But we also have process variables, which, according to a discussion I read recently, are used when the variable is not supposed to be used outside the process.

Do I understand it correctly that the only real difference is in terms of accessibility?

A business variable is public whereas a process variable is private?

2) Another difficulty I encountered is related to how I should reference variables in gateway conditions, for example?
For example. there's a user task named Review Request which sets the status to either "approved" or "rejected" and connects to a XOR gateway. How should I write the conditions?
reviewRequestInput.status == "approved" or reviewRequest.status == "approved" ?

Initially I thought that the latter form is the correct one similarly to using attributes of an object.
Yet, Bonita automatically creates reviewRequestInput including the variables provided. Specifying the condition in the former way doesn't work.

I realize that the issue here is my lack of understanding. Could anyone please break it down for me or at least point to an exhaustive source of information?

1 answer

1
0
-1

As it might help other community users, I'm posting here the answer I sent you by email:

I'll try to clarify the difference between business variables and process variables by highlting what I think are the main differences:

  • life cycle: a business variable live until a running process instance explicitly perform a delete operation (multiple processes can work on a shared business variable). A process variable will be archived as soon as the process instance is finished (only the process instance have access to the business variable it creates).
  • storage: business data are stored in a dedicated database, each business data is stored in one table with column for each attribute. Process variables are stored in the Engine database (with all information related to process definition, execution...). Process variables that use a Java class as type will be stored serialized.

Basically in most situation I would recommend to use business variables. You might need to use process variables for example to pass information from one connector to the next one when you have multiple connectors configured on a single task.

reviewRequestInput refers to the contract input whereas reviewRequest is a business variable. Contract inputs declared the expected information to start a process instance or execute a task. Such information are usually provide by user through the web user interface (Bonita forms). You usually then use the contract inputs to initialize or update a business variable. You can do that using the process variable default value for process contract inputs or operations for task contract inputs.

I hope it clarify a little bit how to manage data with Bonita.

Notifications