public Object put(String name, Object value) { if(autoStoreScriptVariables) { if (!UNSTORED_KEYS.contains(name)) { Object oldValue = variableScope.getVariable(name); variableScope.setVariable(name, value); return oldValue; } } return wrappedBindings.put(name, value); }
public Object put(String name, Object value) { if(autoStoreScriptVariables) { if (!UNSTORED_KEYS.contains(name)) { Object oldValue = variableScope.getVariable(name); variableScope.setVariable(name, value); return oldValue; } } return wrappedBindings.put(name, value); }
public void setValue(ELContext context, Object base, Object property, Object value) { if (base == null) { String variable = (String) property; Object object = context.getContext(VariableScope.class); if (object != null) { VariableScope variableScope = (VariableScope) object; if (variableScope.hasVariable(variable)) { variableScope.setVariable(variable, value); } } } }
public void setValue(ELContext context, Object base, Object property, Object value) { if (base == null) { String variable = (String) property; Object object = context.getContext(VariableScope.class); if (object != null) { VariableScope variableScope = (VariableScope) object; if (variableScope.hasVariable(variable)) { variableScope.setVariable(variable, value); } } } }
public void destroy(VariableScope innerScopeInstance, VariableScope outerScopeInstance) { if (destinationVariableName!=null) { if (innerScopeInstance.hasVariable(sourceVariableName)) { Object value = innerScopeInstance.getVariable(sourceVariableName); outerScopeInstance.setVariable(destinationVariableName, value); } else { throw new ProcessEngineException("Couldn't destroy variable " + sourceVariableName + ", since it does not exist"); } } if (destinationExpression!=null) { Object value = destinationExpression.getValue(innerScopeInstance); outerScopeInstance.setVariable(destinationVariableName, value); } if (link!=null) { if (innerScopeInstance.hasVariable(sourceVariableName)) { Object value = innerScopeInstance.getVariable(sourceVariableName); outerScopeInstance.setVariable(destinationVariableName, value); } else { throw new ProcessEngineException("Couldn't destroy variable " + sourceVariableName + ", since it does not exist"); } } if (linkExpression!=null) { Object value = sourceExpression.getValue(innerScopeInstance); outerScopeInstance.setVariable(destinationVariableName, value); } }
public void destroy(VariableScope innerScopeInstance, VariableScope outerScopeInstance) { if (destinationVariableName!=null) { if (innerScopeInstance.hasVariable(sourceVariableName)) { Object value = innerScopeInstance.getVariable(sourceVariableName); outerScopeInstance.setVariable(destinationVariableName, value); } else { throw new ProcessEngineException("Couldn't destroy variable " + sourceVariableName + ", since it does not exist"); } } if (destinationExpression!=null) { Object value = destinationExpression.getValue(innerScopeInstance); outerScopeInstance.setVariable(destinationVariableName, value); } if (link!=null) { if (innerScopeInstance.hasVariable(sourceVariableName)) { Object value = innerScopeInstance.getVariable(sourceVariableName); outerScopeInstance.setVariable(destinationVariableName, value); } else { throw new ProcessEngineException("Couldn't destroy variable " + sourceVariableName + ", since it does not exist"); } } if (linkExpression!=null) { Object value = sourceExpression.getValue(innerScopeInstance); outerScopeInstance.setVariable(destinationVariableName, value); } }
public void initialize(VariableScope innerScopeInstance, VariableScope outerScopeInstance) { if (sourceVariableName!=null) { if (outerScopeInstance.hasVariable(sourceVariableName)) { Object value = outerScopeInstance.getVariable(sourceVariableName); innerScopeInstance.setVariable(destinationVariableName, value); } else { throw new ProcessEngineException("Couldn't create variable '" + destinationVariableName + "', since the source variable '" + sourceVariableName + "does not exist"); } } if (sourceExpression!=null) { Object value = sourceExpression.getValue(outerScopeInstance); innerScopeInstance.setVariable(destinationVariableName, value); } if (link!=null) { if (outerScopeInstance.hasVariable(sourceVariableName)) { Object value = outerScopeInstance.getVariable(sourceVariableName); innerScopeInstance.setVariable(destinationVariableName, value); } else { throw new ProcessEngineException("Couldn't create variable '" + destinationVariableName + "', since the source variable '" + sourceVariableName + "does not exist"); } } if (linkExpression!=null) { Object value = sourceExpression.getValue(outerScopeInstance); innerScopeInstance.setVariable(destinationVariableName, value); } }
public void initialize(VariableScope innerScopeInstance, VariableScope outerScopeInstance) { if (sourceVariableName!=null) { if (outerScopeInstance.hasVariable(sourceVariableName)) { Object value = outerScopeInstance.getVariable(sourceVariableName); innerScopeInstance.setVariable(destinationVariableName, value); } else { throw new ProcessEngineException("Couldn't create variable '" + destinationVariableName + "', since the source variable '" + sourceVariableName + "does not exist"); } } if (sourceExpression!=null) { Object value = sourceExpression.getValue(outerScopeInstance); innerScopeInstance.setVariable(destinationVariableName, value); } if (link!=null) { if (outerScopeInstance.hasVariable(sourceVariableName)) { Object value = outerScopeInstance.getVariable(sourceVariableName); innerScopeInstance.setVariable(destinationVariableName, value); } else { throw new ProcessEngineException("Couldn't create variable '" + destinationVariableName + "', since the source variable '" + sourceVariableName + "does not exist"); } } if (linkExpression!=null) { Object value = sourceExpression.getValue(outerScopeInstance); innerScopeInstance.setVariable(destinationVariableName, value); } }
@Before public void setUp() { this.variableScope = new TestVariableScope(); variableScope.setVariable(VAR_NAME, VAR_VALUE_STRING); }
variableScope.setVariable(variableName, modelValue); } else if (variableExpression != null) { variableExpression.setValue(modelValue, variableScope); } else { variableScope.setVariable(id, modelValue);
variableScope.setVariable(variableName, modelValue); } else if (variableExpression != null) { variableExpression.setValue(modelValue, variableScope); } else { variableScope.setVariable(id, modelValue);
variableScope.setVariable(id, modelValue);
variableScope.setVariable(id, modelValue);
protected void setVariables(final VariableScope variableScope, final Map<String, Object> variables) { if (variables == null || variables.isEmpty()) { return; } for (final Entry<String, Object> variable : variables.entrySet()) { variableScope.setVariable(variable.getKey(), variable.getValue()); } }
public void submitFormVariables(VariableMap properties, VariableScope variableScope) { boolean userOperationLogEnabled = Context.getCommandContext().isUserOperationLogEnabled(); Context.getCommandContext().enableUserOperationLog(); VariableMap propertiesCopy = new VariableMapImpl(properties); // support legacy form properties for (FormPropertyHandler formPropertyHandler: formPropertyHandlers) { // submitFormProperty will remove all the keys which it takes care of formPropertyHandler.submitFormProperty(variableScope, propertiesCopy); } // support form data: for (FormFieldHandler formFieldHandler : formFieldHandlers) { if (!formFieldHandler.isBusinessKey()) { formFieldHandler.handleSubmit(variableScope, propertiesCopy, properties); } } // any variables passed in which are not handled by form-fields or form // properties are added to the process as variables for (String propertyId: propertiesCopy.keySet()) { variableScope.setVariable(propertyId, propertiesCopy.getValueTyped(propertyId)); } fireFormPropertyHistoryEvents(properties, variableScope); Context.getCommandContext().setLogUserOperationEnabled(userOperationLogEnabled); }
public void submitFormVariables(VariableMap properties, VariableScope variableScope) { boolean userOperationLogEnabled = Context.getCommandContext().isUserOperationLogEnabled(); Context.getCommandContext().enableUserOperationLog(); VariableMap propertiesCopy = new VariableMapImpl(properties); // support legacy form properties for (FormPropertyHandler formPropertyHandler: formPropertyHandlers) { // submitFormProperty will remove all the keys which it takes care of formPropertyHandler.submitFormProperty(variableScope, propertiesCopy); } // support form data: for (FormFieldHandler formFieldHandler : formFieldHandlers) { if (!formFieldHandler.isBusinessKey()) { formFieldHandler.handleSubmit(variableScope, propertiesCopy, properties); } } // any variables passed in which are not handled by form-fields or form // properties are added to the process as variables for (String propertyId: propertiesCopy.keySet()) { variableScope.setVariable(propertyId, propertiesCopy.getValueTyped(propertyId)); } fireFormPropertyHistoryEvents(properties, variableScope); Context.getCommandContext().setLogUserOperationEnabled(userOperationLogEnabled); }
public Object put(String name, Object value) { if(autoStoreScriptVariables) { if (!UNSTORED_KEYS.contains(name)) { Object oldValue = variableScope.getVariable(name); variableScope.setVariable(name, value); return oldValue; } } return wrappedBindings.put(name, value); }
public void setValue(ELContext context, Object base, Object property, Object value) { if (base == null) { String variable = (String) property; Object object = context.getContext(VariableScope.class); if (object != null) { VariableScope variableScope = (VariableScope) object; if (variableScope.hasVariable(variable)) { variableScope.setVariable(variable, value); } } } }
public void testRequiredValidator() { RequiredValidator validator = new RequiredValidator(); TestValidatorContext validatorContext = new TestValidatorContext(null); assertTrue(validator.validate("test", validatorContext)); assertTrue(validator.validate(1, validatorContext)); assertTrue(validator.validate(true, validatorContext)); // empty string and 'null' are invalid assertFalse(validator.validate("", validatorContext)); assertFalse(validator.validate(null, validatorContext)); // can submit null if the value already exists validatorContext = new TestValidatorContext(null, "fieldName"); validatorContext.getVariableScope().setVariable("fieldName", "existingValue"); assertTrue(validator.validate(null, validatorContext)); }
@Before public void setUp() { this.variableScope = new TestVariableScope(); variableScope.setVariable(VAR_NAME, VAR_VALUE_STRING); }