[jboss-user] [jBPM Users] - Re: Jbpm 4.2 how to enable variable history
xalperte
do-not-reply at jboss.com
Fri Nov 13 17:06:34 EST 2009
I made a test in order to force the HistoryVariable activation but didn't work.
The test code is that:
| if( execution.getVariable("message") != null ) {
| ((ExecutionImpl) execution).removeVariable("message");
| }
| ((ExecutionImpl) execution).createVariable("message", message, null, true);
|
The problem is inside the createVariable implementation logic where the VariableUpdate event is being fired before the CreateVariable event.
The VariableUpdate event is fired by the Variable object, when you do "setValue" the implementation is firing the VariableUpdate event:
| variable.setKey(key);
| variable.setExecution(getExecution());
| variable.setTask(getTask());
| variable.setHistoryEnabled(isHistoryEnabled);
|
| variable.setValue(value);
|
| long dbid = DbidGenerator.getDbidGenerator().getNextId();
| variable.setDbid(dbid);
|
| if (isHistoryEnabled) {
| HistoryEvent.fire(new VariableCreate(variable));
| }
|
Maybe a solution could be do something similar to that:
| variable.setKey(key);
| variable.setExecution(getExecution());
| variable.setTask(getTask());
| variable.setHistoryEnabled(false);
|
| variable.setValue(value);
|
| long dbid = DbidGenerator.getDbidGenerator().getNextId();
| variable.setDbid(dbid);
|
| if (isHistoryEnabled) {
| HistoryEvent.fire(new VariableCreate(variable));
| }
|
| variable.setHistoryEnabled(isHistoryEnabled);
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265629#4265629
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4265629
More information about the jboss-user
mailing list