Java Code Examples for org.activiti.engine.impl.scripting.ScriptingEngines#evaluate()
The following examples show how to use
org.activiti.engine.impl.scripting.ScriptingEngines#evaluate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScriptExecutionListener.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void notify(DelegateExecution execution) { if (script == null) { throw new IllegalArgumentException("The field 'script' should be set on the ExecutionListener"); } if (language == null) { throw new IllegalArgumentException("The field 'language' should be set on the ExecutionListener"); } ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); Object result = scriptingEngines.evaluate(script.getExpressionText(), language.getExpressionText(), execution); if (resultVariable != null) { execution.setVariable(resultVariable.getExpressionText(), result); } }
Example 2
Source File: ScriptTaskListener.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void notify(DelegateTask delegateTask) { if (script == null) { throw new IllegalArgumentException("The field 'script' should be set on the TaskListener"); } if (language == null) { throw new IllegalArgumentException("The field 'language' should be set on the TaskListener"); } ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); Object result = scriptingEngines.evaluate(script.getExpressionText(), language.getExpressionText(), delegateTask, autoStoreVariables); if (resultVariable != null) { delegateTask.setVariable(resultVariable.getExpressionText(), result); } }
Example 3
Source File: JuelFormEngine.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public Object renderStartForm(StartFormData startForm) { if (startForm.getFormKey() == null) { return null; } String formTemplateString = getFormTemplateString(startForm, startForm.getFormKey()); ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); return scriptingEngines.evaluate(formTemplateString, ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE, null); }
Example 4
Source File: JuelFormEngine.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public Object renderTaskForm(TaskFormData taskForm) { if (taskForm.getFormKey() == null) { return null; } String formTemplateString = getFormTemplateString(taskForm, taskForm.getFormKey()); ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); TaskEntity task = (TaskEntity) taskForm.getTask(); return scriptingEngines.evaluate(formTemplateString, ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE, task.getExecution()); }
Example 5
Source File: ScriptExecutionListener.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override public void notify(DelegateExecution execution) { validateParameters(); ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); Object result = scriptingEngines.evaluate(script.getExpressionText(), language.getExpressionText(), execution); if (resultVariable != null) { execution.setVariable(resultVariable.getExpressionText(), result); } }
Example 6
Source File: ScriptTaskListener.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void notify(DelegateTask delegateTask) { validateParameters(); ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); Object result = scriptingEngines.evaluate(script.getExpressionText(), language.getExpressionText(), delegateTask, autoStoreVariables); if (resultVariable != null) { delegateTask.setVariable(resultVariable.getExpressionText(), result); } }
Example 7
Source File: ScriptTaskActivityBehavior.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void execute(DelegateExecution execution) { ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); 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 = scriptingEngines.evaluate(script, language, execution, storeScriptVariables); if (resultVariable != null) { execution.setVariable(resultVariable, result); } } catch (ActivitiException e) { LOGGER.warn("Exception while executing " + execution.getCurrentFlowElement().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); } }
Example 8
Source File: ScriptEventHandler.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override public void handle(SimulationEvent event) { ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); VariableScope execution = SimulationRunContext.getExecution(); try { scriptingEngines.evaluate((String) event.getProperty(this.scriptPropertyName), language, execution, false); } catch (ActivitiException e) { log.warn("Exception while executing simulation event " + event + " scriptPropertyName :" + this.scriptPropertyName + "\n script: " + event.getProperty(this.scriptPropertyName) + "\n exception is:" + e.getMessage()); throw e; } }
Example 9
Source File: DefaultFlowable5CompatibilityHandler.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public Object getScriptingEngineValue(String payloadExpressionValue, String languageValue, DelegateExecution execution) { try { final ProcessEngineConfigurationImpl processEngineConfig = (ProcessEngineConfigurationImpl) getProcessEngine().getProcessEngineConfiguration(); ScriptingEngines scriptingEngines = processEngineConfig.getScriptingEngines(); return scriptingEngines.evaluate(payloadExpressionValue, languageValue, execution); } catch (org.activiti.engine.ActivitiException e) { handleActivitiException(e); return null; } }
Example 10
Source File: JuelFormEngine.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public Object renderStartForm(StartFormData startForm) { if (startForm.getFormKey() == null) { return null; } String formTemplateString = getFormTemplateString(startForm, startForm.getFormKey()); ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); return scriptingEngines.evaluate(formTemplateString, ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE, null); }
Example 11
Source File: JuelFormEngine.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public Object renderTaskForm(TaskFormData taskForm) { if (taskForm.getFormKey() == null) { return null; } String formTemplateString = getFormTemplateString(taskForm, taskForm.getFormKey()); ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); TaskEntity task = (TaskEntity) taskForm.getTask(); return scriptingEngines.evaluate(formTemplateString, ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE, task.getExecution()); }
Example 12
Source File: ScriptTaskActivityBehavior.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public void execute(DelegateExecution execution) { ActivityExecution activityExecution = (ActivityExecution) execution; ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); 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)) { script = overrideScript; } } } boolean noErrors = true; try { Object result = scriptingEngines.evaluate(script, language, execution, storeScriptVariables); if (resultVariable != null) { execution.setVariable(resultVariable, result); } } catch (ActivitiException e) { LOGGER.warn("Exception while executing {} : {}", activityExecution.getActivity().getId(), e.getMessage()); noErrors = false; Throwable rootCause = ExceptionUtils.getRootCause(e); if (rootCause instanceof BpmnError) { ErrorPropagation.propagateError((BpmnError) rootCause, activityExecution); } else { throw e; } } if (noErrors) { leave(activityExecution); } }