Variable history isnt completely worked out yet, should be in one of the next releases.
Thank you jbrrez, I will be looking forward for this feature.
I think I need access to history variables too. Here is my need :
_ I create a process instance that does some stuff, and in particular creates a business object I will need to retrieve (an entity stored somewhere)
_ after the workflow is over, I would like to retrieve what it has created. So my idea was that my workflow would set a variable with the id of my business object, and after the workflow is finished I will search the history and get my variable.
it is easy when my workflow is not ended :
String businessId = (String) executionService.getVariable(processId, "businessId");
but when it is ended there is nothing in the API like I could do:
String businessId = (String) historyService.getVariable(processId, "businessId");
and I have not found any other way
so my question is : does the jBPM team intend to do something like that, so that the variable of history processes can be retrieved via the API ?
or maybe I overlooked something that already exists?
I searched the JIRA, but did not fully understand what was intended, especially with this one :
the description : "expose the history that is in the database through the api" sounds nice, but then it seems to specialize on tasks, plus it seems a bit dead
Is it possible to get the name of the task that was finished from the history? To be able to get the name of the finished task one have to first find the task in the HIST_TASK table, and then look it up in HIST_ACTINST (activity_name) table too?
E.g. is there any plans to simplify the programming model against the history tables to traverse relations? E.g. from a HistoryTask instance to its related HIST_ACTINST row?
Guys (Girls?)... The history functionality, including the api are not fully matured yet. That is what the jira issues are about. Keep a close eye on check-ins related to those, try them out as early ass possible and comment then. Helping out is also appreciated (if you take a look at the source, you'll see the code it is not that difficult to understand)
of course I intend to have a look at the code, if I get time (hahaha ;-) (and even more time to set up a jbpm dev environment, write tests and everything). It is too frustrating otherwise, and probably not very complicated, as you say
but there is something else I do not really get : if jbpm 4 has been released without the full history functionality, I suppose it should not be considered that important by BPM experts, then I suppose I misunderstood or mis-conceived something, as a BPM-newbie, since I feel I really need it. Well, hopefully with experience I will get wisdom too ;-)
suppose it should not be considered that important by BPM experts,
Hmmm... Personally I think it is very important for comlpex usage like 'round tripping'. For simple usage it is not. (like holiday requests etc ;-))
Why it is in the state it is, I'm not sure. I'll ask one of the core devs to respond.
hey, do not let managers read that holiday requests may be unimportant !! ;-)))
> I'll ask one of the core devs to respond.
thanks! I promise I will really give at least a serious look into the code this week
hahaha... that is not what I said... I said historical information (not your remaining days) e.g. how long it took to request a holiday etc is unimportant...
Feedback from the dev team:
The timeperiod for the 4.2 release (due november 1st) is to short to address these. JBPM-2568 was created as a reminder to assess the open issues for the 4.3 release.
Is there any workaround for getting ended processes variables until a newer version is released?
I don't know if this help you. Please correct me if I'm wrong, thank you.
1. I put a <state> instead of <end> as last node
2. Call ExecutionService.getVariable and store the variable somewhere when it hits the last state
3. Call ExecutionService.endProcessInstance(processInstanceId, Execution.STATE_ENDED) to end the process instance after you've got the variable.
Well, that's a workaround, but I think jBPM should provide a straight way to retrieve history variables. If it doesn't, I'd probably not use actual end states in order to access every variable the same way. One of the strenghts of using BPM is modelling business logic separately from implementation issues, I don't want to mess my diagrams with workarounds...
Thanks anyway, Lai