cancel
Showing results for 
Search instead for 
Did you mean: 

how do I persist values with a task

cosmicrider
Champ in-the-making
Champ in-the-making
Here is my assumption of how I see my processes working:
first, the process is persisted in a dB

second, there are situations where I want to persist values with a task, as an example: let's say there is a printer task that can be used in many processes. I want the printer task to have a default printer and a list of other printers. how would this be accomplished?

third, the completion of each task will be persisted, which may have additional values for the next task

Also, there may be times where the overall Process may have values that I want to attach and have persisted to seed the process each time it is loaded and activated.

what is the mechanism (code snippet appreciated) to accomplish the above.

thanks
4 REPLIES 4

tombaeyens
Champ in-the-making
Champ in-the-making
there are lots of ways depending on what you want.  can you explain more precise on what you want?

cosmicrider
Champ in-the-making
Champ in-the-making
Printer example in my original question is one example. I haven't seen any example XML or other mechanism that shows the ability to store an arbitrary set of values that can be persisted to the dB.

Another example - a human task allows a group leader to enter the geolocation of where they meet, along with day and time. This task then becomes part of a "sign-up" process for people who want to join the group. What Aciviti mechanism is there that would allow me to persist the geolocation, dat and time of the meeting with the task that becomes part of the "sign-up" process.

Is there a way within Aciviti that I can persist a domain type object or key/value pair associated to a specific task?

cosmicrider
Champ in-the-making
Champ in-the-making
It would be helpful Tom/others if you could also explain the "lot's of ways" attached to a their scenarios, this way when one of those way's comes up that I haven't thought of I have at least a place to start.

I suspect storing values with the task is a normal condition, because as each task is fired the results would need to be dB persisted in case the system went down. You user guide is a great start, and I see some examples attached with addressing a group name or assignee name within the xml.  Maybe I have missed some example but I haven't seen the case where an active process has tasks with default data persisted or where the outcome of one task with say the Boss denies the vacation request with an explanation and other data is persisted so that when the employee signs in again they have the data available (say the email system is down or the some other condition)

jbarrez
Star Contributor
Star Contributor
The Vacation request example is one that is shipped with the distribution: here, the manager can state the reason why a request was not approved. This reason is stored as a process variable, which is then used for display in the form to the employee.

Activiti can store many kinds of data as a process variable: all primitives, Java serializables, long texts, etc.
Process variables are easiliy used by calling the runtimeService.set/getVariable() methods.

Regarding the printer task: this is something that you would have to write for yourself as a custom activity, implementing the ActivityBehaviour interface. This way you can use it in any process you'd like.