[jBPM Users] - Re: Jbpm 4.2 how to enable variable history
by xalperte
Sorry, I use format inside the Code block and it doesn't works....
This is the actual code: (ScopeInstanceImpl.createVariableObject), using isHistoryEnabled=true
| variable.setKey(key);
| variable.setExecution(getExecution());
| variable.setTask(getTask());
| variable.setHistoryEnabled(isHistoryEnabled); <------- true
| variable.setValue(value); <------- Fires the VariableUpdate event
|
| long dbid = DbidGenerator.getDbidGenerator().getNextId();
| variable.setDbid(dbid);
|
| if (isHistoryEnabled) { <------- true
| HistoryEvent.fire(new VariableCreate(variable)); <------- fires VariableCreate event
| }
|
and that the code I thing could work:
| variable.setKey(key);
| variable.setExecution(getExecution());
| variable.setTask(getTask());
| variable.setHistoryEnabled(false); <------- force false
| variable.setValue(value); <------- Now no VariableUpdate event will be fired
|
| long dbid = DbidGenerator.getDbidGenerator().getNextId();
| variable.setDbid(dbid);
|
| if (isHistoryEnabled) { <------- true
| HistoryEvent.fire(new VariableCreate(variable)); <------- fires VariableCreate event
| }
|
| variable.setHistoryEnabled(isHistoryEnabled); <------- true
|
I hope that helps.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265630#4265630
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4265630
16 years, 7 months
[jBPM Users] - Re: Jbpm 4.2 how to enable variable history
by xalperte
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
16 years, 7 months
[jBPM Users] - Re: Jbpm 4.2 how to enable variable history
by xalperte
Well, this is the problem, by default the setVariable implementation (ScopeInstanceImpl.java) is always calling the createVariable method with false for the "isHistoryEnabled" argument, then never creates an HistoryVariable.
The "deletes instances" means exactly that, the jbpm is deleting the execution information from database when the process reaches the end state (all the instance data in the jbpm4_execution, jbpm4_jobs, jbpm4_variable, jbpm4_task tables) . In fact, the "assertProcessInstanceEnded" of the JbpmTestCase class checks if the instance is ended looking if the instance exists or not in the database.
When the executions are deleted the variables associated to them are also deleted losing all the data associated with the process.
I think this must be the correct behaviour for the execution information, but there is a bug is in the Variable History side.
What we can do in order to maintain the process data? It's really a very important issue, without that the jbpm 4.2 can not be used in production environments.
Thanks
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265625#4265625
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4265625
16 years, 7 months
[JBoss Web Services Users] - JAXB - elements unmarshalled to other parent
by ozizka@redhat.com
Hi all,
I have a problem with JAXB unmarshalling. First I marshall to a XML:
| <reservationCalendars>
| <resource name="jawa02">
| <reservations>
| <reservation to="2009-11-23T17:13:20.576+01:00" from="2009-11-13T17:13:20.576+01:00" forUser="ozizka"/>
| </reservations>
| </resource>
| <resource name="jawa01">
| <reservations>
| <reservation to="2009-11-18T17:13:20.576+01:00" from="2009-11-13T17:13:20.576+01:00" forUser="ozizka"/>
| <reservation to="2009-11-23T17:13:20.576+01:00" from="2009-11-19T17:13:20.576+01:00" forUser="oskutka"/>
| </reservations>
| </resource>
| </reservationCalendars>
|
Then I unmarshall it, but JAXB reads this:
| <reservationCalendars>
| <resource name="jawa02">
| <reservations>
| <reservation to="2009-11-23T17:13:20.576+01:00" from="2009-11-13T17:13:20.576+01:00" forUser="ozizka"/>
| <reservation to="2009-11-18T17:13:20.576+01:00" from="2009-11-13T17:13:20.576+01:00" forUser="ozizka"/>
| <reservation to="2009-11-23T17:13:20.576+01:00" from="2009-11-19T17:13:20.576+01:00" forUser="oskutka"/>
| </reservations>
| </resource>
| <resource name="jawa01">
| <reservations/>
| </resource>
| </reservationCalendars>
|
It's most likely an error in my JAXB annotations.
Anyone has ever seen this? Any idea what could cause this? I can post the code if necessary.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265620#4265620
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4265620
16 years, 7 months
[jBPM Users] - takeTask() race condition
by scollyp
I have an app that lets users take a task with the following sequence.
1. taskList = taskService.findGroupTasks(user);
2. Task task = taskList.get(0);
3. taskService.takeTask(task.getId(), user);
I'm finding a race condition if multiple users get the same task at step 2 at the same time. The first user to execute step 3 wins and the second gets the following exception:
Nov 13, 2009 12:42:32 PM org.hibernate.event.def.AbstractFlushingEventListener performExecutions
SEVERE: Could not synchronize database state with session
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.pvm.internal.task.TaskImpl#300945]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1792)
at
...
org.jbpm.pvm.internal.svc.TaskServiceImpl.takeTask(TaskServiceImpl.java:178)
Is there a better way to do this? Or do I just need catch StaleObjectStateException and try again for the second user?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265616#4265616
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4265616
16 years, 7 months