use of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl in project Activiti by Activiti.
the class SecureJavascriptTaskActivityBehavior method execute.
@Override
public void execute(ActivityExecution execution) throws Exception {
ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) execution.getEngineServices().getProcessEngineConfiguration();
if (Context.getProcessEngineConfiguration().isEnableProcessDefinitionInfoCache()) {
ObjectNode taskElementProperties = Context.getBpmnOverrideElementProperties(scriptTaskId, execution.getProcessDefinitionId());
if (taskElementProperties != null && taskElementProperties.has(DynamicBpmnConstants.SCRIPT_TASK_SCRIPT)) {
String overrideScript = taskElementProperties.get(DynamicBpmnConstants.SCRIPT_TASK_SCRIPT).asText();
if (StringUtils.isNotEmpty(overrideScript) && overrideScript.equals(script) == false) {
script = overrideScript;
}
}
}
boolean noErrors = true;
try {
Object result = SecureJavascriptUtil.evaluateScript(execution, script, config.getBeans());
if (resultVariable != null) {
execution.setVariable(resultVariable, result);
}
} catch (ActivitiException e) {
LOGGER.warn("Exception while executing " + execution.getActivity().getId() + " : " + e.getMessage());
noErrors = false;
Throwable rootCause = ExceptionUtils.getRootCause(e);
if (rootCause instanceof BpmnError) {
ErrorPropagation.propagateError((BpmnError) rootCause, execution);
} else {
throw e;
}
}
if (noErrors) {
leave(execution);
}
}
Aggregations