Search in sources :

Example 1 with ScriptingEngines

use of org.activiti.engine.impl.scripting.ScriptingEngines in project Activiti by Activiti.

the class ScriptExecutionListener method notify.

@Override
public void notify(DelegateExecution execution) throws Exception {
    validateParameters();
    ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
    Object result = scriptingEngines.evaluate(script.getExpressionText(), language.getValue(execution).toString(), execution);
    if (resultVariable != null) {
        execution.setVariable(resultVariable.getExpressionText(), result);
    }
}
Also used : ScriptingEngines(org.activiti.engine.impl.scripting.ScriptingEngines)

Example 2 with ScriptingEngines

use of org.activiti.engine.impl.scripting.ScriptingEngines in project Activiti by Activiti.

the class ScriptTaskListener method notify.

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);
    }
}
Also used : ScriptingEngines(org.activiti.engine.impl.scripting.ScriptingEngines)

Example 3 with ScriptingEngines

use of org.activiti.engine.impl.scripting.ScriptingEngines in project Activiti by Activiti.

the class ScriptEventHandler method handle.

@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;
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) ScriptingEngines(org.activiti.engine.impl.scripting.ScriptingEngines) VariableScope(org.activiti.engine.delegate.VariableScope)

Example 4 with ScriptingEngines

use of org.activiti.engine.impl.scripting.ScriptingEngines in project Activiti by Activiti.

the class ProcessEngineConfigurationImpl method initScriptingEngines.

protected void initScriptingEngines() {
    if (resolverFactories == null) {
        resolverFactories = new ArrayList<ResolverFactory>();
        resolverFactories.add(new VariableScopeResolverFactory());
        resolverFactories.add(new BeansResolverFactory());
    }
    if (scriptingEngines == null) {
        scriptingEngines = new ScriptingEngines(new ScriptBindingsFactory(resolverFactories));
    }
}
Also used : ScriptingEngines(org.activiti.engine.impl.scripting.ScriptingEngines) BeansResolverFactory(org.activiti.engine.impl.scripting.BeansResolverFactory) ScriptBindingsFactory(org.activiti.engine.impl.scripting.ScriptBindingsFactory) BeansResolverFactory(org.activiti.engine.impl.scripting.BeansResolverFactory) ResolverFactory(org.activiti.engine.impl.scripting.ResolverFactory) VariableScopeResolverFactory(org.activiti.engine.impl.scripting.VariableScopeResolverFactory) VariableScopeResolverFactory(org.activiti.engine.impl.scripting.VariableScopeResolverFactory)

Example 5 with ScriptingEngines

use of org.activiti.engine.impl.scripting.ScriptingEngines in project Activiti by Activiti.

the class JuelFormEngine method renderStartForm.

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);
}
Also used : ScriptingEngines(org.activiti.engine.impl.scripting.ScriptingEngines)

Aggregations

ScriptingEngines (org.activiti.engine.impl.scripting.ScriptingEngines)8 ActivitiException (org.activiti.engine.ActivitiException)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 BpmnError (org.activiti.engine.delegate.BpmnError)1 VariableScope (org.activiti.engine.delegate.VariableScope)1 TaskEntity (org.activiti.engine.impl.persistence.entity.TaskEntity)1 BeansResolverFactory (org.activiti.engine.impl.scripting.BeansResolverFactory)1 ResolverFactory (org.activiti.engine.impl.scripting.ResolverFactory)1 ScriptBindingsFactory (org.activiti.engine.impl.scripting.ScriptBindingsFactory)1 VariableScopeResolverFactory (org.activiti.engine.impl.scripting.VariableScopeResolverFactory)1 HttpResponse (org.apache.http.HttpResponse)1 AuthScope (org.apache.http.auth.AuthScope)1 UsernamePasswordCredentials (org.apache.http.auth.UsernamePasswordCredentials)1 CredentialsProvider (org.apache.http.client.CredentialsProvider)1 HttpClient (org.apache.http.client.HttpClient)1 HttpPost (org.apache.http.client.methods.HttpPost)1