[jboss-user] [jBPM Development] - variable declaration and history support

Alejandro Guizar do-not-reply at jboss.com
Wed Jun 9 06:23:17 EDT 2010


Alejandro Guizar [http://community.jboss.org/people/alex.guizar%40jboss.com] created the discussion

"variable declaration and history support"

To view the discussion, visit: http://community.jboss.org/message/547022#547022

--------------------------------------------------------------
A previous discussion touched the subject of  https://jira.jboss.org/browse/JBPM-2506 JBPM-2506. While the proposed code looks great I noticed a particularity I wanted to discuss. ExecutionService has gained the following methods:
/** creates or overwrites a variable value on the referenced execution and marks the variable to be stored in history*/
void setVariable(String executionId, String name, Object value, boolean historyEnabled);
  
/** creates or overwrites the variable values on the referenced execution and marks the variables to be stored in history*/
void setVariables(String executionId, Map<String, ?> variables, boolean historyEnabled);

These methods eventually reach a new overload for ScopeInstanceImpl.setVariable()
public void setVariable(String key, Object value, boolean historyEnabled) {
  // ...
  if (variable!=null) {
    log.debug("updating variable '"+key+"' in '"+this+"' to value '"+value+"'");
    variable.setValue(value, this);
  } else if (getParentVariableScope()==null) {
    createVariable(key, value, null, historyEnabled);
  } else {
    getParentVariableScope().setVariable(key,value, historyEnabled);
  }
}

Notice that, if the variable already exists, historyEnabled is ignored. On the other hand, ExecutionService does not expose the createVariable methods of ScopeInstanceImpl. Method createVariable is sometimes useful since setVariable always tries to create the variable in the parent scope.
My proposal is to make the following additions to ExecutionService instead. This way we prevent historyEnabled from being ignored and expose useful new functionality.
/** creates a variable value on the referenced execution. optionally marks the variable to be stored in history*/
void createVariable(String executionId, String name, Object value, boolean historyEnabled);
  
/** creates variable values on the referenced execution. optionally marks the variables to be stored in history*/
void createVariables(String executionId, Map<String, ?> variables, boolean historyEnabled);


--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/547022#547022]

Start a new discussion in jBPM Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2035]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100609/9a9c6fdf/attachment.html 


More information about the jboss-user mailing list