[jboss-user] [JBoss jBPM] - Re: taskform in the start activity - form vars dont get pers

lalitjava do-not-reply at jboss.com
Tue Aug 4 11:19:33 EDT 2009


Looking through the JBPMv4 source, I get the impression that the 'Audit History for variables' feature is something that's not yet built in or supported. That *may* explain why the JBPM4_HIST_VAR table remains empty at all times. I think primarily that's because currently there is no 'variables' declaration section (yet) in jpdl-4.0.xsd , where we could declare whether a particular variable's history should be stored or not ..That seems to be goal for a future release (going by the code..see code snippets below)

So, it does look like if you care about persisting the properties associated with the work units, you cant leverage the HIST_VAR table. If anyone has any other experience (other than creating your own audit table and persisting the variables there for audit trail purposes), I'd be really thankful if you could chime in ..

Code snippets follow:
  I was hoping to find some place in the code where the JBPM4_HIST_VAR table will be updated.

 
In org.jbpm.pvm.internal.model.ScopeInstanceImpl:

 for (VariableDefinitionImpl variableDefinition: variableDefinitions) {
  |         String key = variableDefinition.getName();
  |         Object value = variableDefinition.getInitValue(outerExecution);
  |         String typeName = variableDefinition.getTypeName();
  |         boolean isHistoryEnabled = variableDefinition.isHistoryEnabled();
  |         createVariable(key, value, typeName, isHistoryEnabled);
  |       }
  | 
The createVariable  call seems to be the one that will result through Hibernate into an insert into the JBPM4_HIST_VARs table.

I looked through the code to find where the Variable definitions get initialized- it looks like JPdlParser in org.jbpm.jpdl.internal.xml does it in a method parseVariableDefinitions.

That method looks for the following element definition in the jpdl file:
   for (Element inElement: XmlUtil.elements(element, "variable")) {

But variable is not yet supported in jpdl-4.0.xsd. (the parseVariableDefinitions therefore is never called).

Also if you look at the method itself, the isHistoryEnabled property of the variable is not even set when initializing the VariableDefinitionImpl..


  |  for (Element inElement: XmlUtil.elements(element, "variable")) {
  |       VariableDefinitionImpl variableDefinition = new VariableDefinitionImpl();
  | 
  |       String name = XmlUtil.attribute(inElement, "name", true, parse);
  |       variableDefinition.setName(name);
  |       
  |       int sources = 0;
  |       
  |       String initExpr = XmlUtil.attribute(inElement, "init");
  |       if (initExpr!=null) {
  |         variableDefinition.setInitExpression(initExpr);
  |         sources++;
  |       }
  |       
  |       Element valueElement = XmlUtil.element(inElement);
  |       if (valueElement!=null) {
  |         Descriptor initValueDescriptor = (Descriptor) WireParser.getInstance().parseElement(valueElement, parse);
  |         variableDefinition.setInitDescriptor(initValueDescriptor);
  |         sources++;
  |       }
  | 
  |       if (initRequired && sources==0) {
  |         parse.addProblem("no init specified", inElement);
  |       }
  |       if (sources>1) {
  |         parse.addProblem("init attribute and init element are mutually exclusive on element variable", inElement);
  |       }
  |       
  |       variableDefinitions.add(variableDefinition);
  |     }
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4247906#4247906

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4247906



More information about the jboss-user mailing list