public DefaultProcessInstance getAllVariablesAsDefaultProcessInstance(String instanceId) throws Exception{
ProcessVariableDAO processVariable = createDAOImpl(getAllValue_SQL);
processVariable.setInstId(new Long(instanceId));
processVariable.select();
DefaultProcessInstance defaultProcessInstance = new DefaultProcessInstance();
while (processVariable.next()) {
Serializable value = getDeserializedValue(processVariable);
String scope = processVariable.getTrcTag();
if(scope==null) scope = "";
String key = processVariable.getKeyName();
boolean isProperty = processVariable.getIsProperty().booleanValue();
//if ( value != null ){
if(isProperty){
defaultProcessInstance.setProperty(scope, key, value);
}else if(processVariable.getVarIndex().intValue() > 0)
defaultProcessInstance.add(scope, key, value, processVariable.getVarIndex().intValue());
else
defaultProcessInstance.set(scope, key, value);
//}
}
return defaultProcessInstance;
}