/** sets all entries individually, variableValues maps variable ids to values */ public void setVariableValues(DataContainer variableValues) { Map<String, TypedValue> data = variableValues!=null ? variableValues.getData() : null; if (data!=null) { for (String variableId: data.keySet()) { TypedValue value = data.get(variableId); setVariableValue(variableId, value.getValue()); } } }
public void setVariableValue(String variableId, Object value) { if (variableInstances!=null) { VariableInstanceImpl variableInstance = getVariableInstanceLocal(variableId); if (variableInstance!=null) { setVariableValue(variableInstance, value); return; } } if (parent!=null) { parent.setVariableValue(variableId, value); return; } DataTypeService dataTypeService = configuration.get(DataTypeService.class); Class<?> valueClass = value!=null ? value.getClass() : null; DataTypeImpl dataType = dataTypeService.getDataTypeByValue(valueClass); if (dataType==null) { throw new RuntimeException("Couldn't determine data type dynamically for value "+value); } VariableInstanceImpl variableInstance = createVariableInstanceLocal(variableId, dataType); setVariableValue(variableInstance, value); }
public void setVariableValue(WorkflowInstanceId workflowInstanceId, String activityInstanceId, String variableId, Object value) { WorkflowInstanceImpl workflowInstance = lockWorkflowInstanceWithRetry(workflowInstanceId); ScopeInstanceImpl scopeInstance = getScopeInstance(workflowInstance, activityInstanceId); if (scopeInstance==null) { workflowInstanceStore.unlockWorkflowInstance(workflowInstance); throw new RuntimeException("Workflow instance "+workflowInstanceId+" didn't contain active activityInstanceId "+activityInstanceId); } scopeInstance.setVariableValue(variableId, value); workflowInstanceStore.flushAndUnlock(workflowInstance); }
public void setVariableValues(WorkflowInstanceId workflowInstanceId, String activityInstanceId, VariableValues variableValues) { if (workflowInstanceId==null || variableValues==null) { return; } WorkflowInstanceImpl workflowInstance = lockWorkflowInstanceWithRetry(workflowInstanceId); ScopeInstanceImpl scopeInstance = getScopeInstance(workflowInstance, activityInstanceId); if (scopeInstance==null) { workflowInstanceStore.unlockWorkflowInstance(workflowInstance); throw new RuntimeException("Workflow instance "+workflowInstanceId+" didn't contain active activityInstanceId "+activityInstanceId); } Map<String, TypedValue> values = variableValues!=null ? variableValues.getValues() : null; if (values!=null) { for (String variableId : values.keySet()) { TypedValue typedValue = values.get(variableId); Object value = typedValue.getValue(); scopeInstance.setVariableValue(variableId, value); } } workflowInstanceStore.flushAndUnlock(workflowInstance); }