{
// verify
for (Map.Entry<String, Object> entry : variableValues.entrySet())
{
String variableName = entry.getKey();
VariableReader reader = services.getVariableService().getReader(variableName);
if (reader == null) {
throw new VariableNotFoundException("Variable by name '" + variableName + "' has not been declared");
}
if (reader.isConstant()) {
throw new VariableConstantValueException("Variable by name '" + variableName + "' is declared as constant and may not be assigned a new value");
}
}
// set values
for (Map.Entry<String, Object> entry : variableValues.entrySet())
{
String variableName = entry.getKey();
VariableReader reader = services.getVariableService().getReader(variableName);
try
{
services.getVariableService().checkAndWrite(reader.getVariableNumber(), entry.getValue());
}
catch (RuntimeException ex)
{
services.getVariableService().rollback();
throw ex;