--- src-orig/org/jbpm/context/exe/VariableInstance.java Thu Oct 15 18:02:00 2009 +++ src/org/jbpm/context/exe/VariableInstance.java Tue Jul 27 12:44:43 2010 @@ -29,6 +29,7 @@ import org.jbpm.context.exe.variableinstance.NullInstance; import org.jbpm.context.exe.variableinstance.UnpersistableInstance; import org.jbpm.context.log.VariableCreateLog; +import org.jbpm.graph.def.ProcessDefinition; import org.jbpm.graph.exe.ProcessInstance; import org.jbpm.graph.exe.Token; @@ -50,6 +51,8 @@ protected Object valueCache = null; protected boolean isValueCached = false; + protected ProcessDefinition processDefinition = null; + // constructors ///////////////////////////////////////////////////////////// public VariableInstance() {} @@ -68,6 +71,9 @@ variableInstance.name = name; variableInstance.processInstance = (token != null ? token .getProcessInstance() : null); + variableInstance.processDefinition = variableInstance.processInstance != null ? variableInstance.processInstance + .getProcessDefinition() : null; + if(token != null) { token.addLog(new VariableCreateLog(variableInstance)); } @@ -152,13 +158,15 @@ } Object value = getObject(); if((value != null) && (converter != null)) { - if(converter instanceof SerializableToByteArrayConverter && processInstance != null) { - SerializableToByteArrayConverter s2bConverter = (SerializableToByteArrayConverter) converter; - value = s2bConverter.revert(value, processInstance.getProcessDefinition()); - } - else { - value = converter.revert(value); - } + final ProcessDefinition procDef = processInstance != null ? processInstance + .getProcessDefinition() : processDefinition; + if (converter instanceof SerializableToByteArrayConverter + && procDef != null) { + SerializableToByteArrayConverter s2bConverter = (SerializableToByteArrayConverter) converter; + value = s2bConverter.revert(value, procDef); + } else { + value = converter.revert(value); + } valueCache = value; isValueCached = true; } @@ -173,7 +181,8 @@ // utility methods ///////////////////////////////////////////////////////// - public String toString() { + @Override + public String toString() { return "${" + name + "}"; } @@ -190,6 +199,10 @@ public Token getToken() { return token; } + + public ProcessDefinition getProcessDefinition() { + return processDefinition; + } public void setTokenVariableMap(TokenVariableMap tokenVariableMap) { this.tokenVariableMap = tokenVariableMap; --- src-orig/org/jbpm/context/exe/VariableInstance.hbm.xml Thu Oct 15 18:02:10 2009 +++ src/org/jbpm/context/exe/VariableInstance.hbm.xml Tue Jul 27 12:24:37 2010 @@ -40,6 +40,9 @@ column="PROCESSINSTANCE_" foreign-key="FK_VARINST_PRCINST" index="IDX_VARINST_PRCINS" /> - + +