Search in sources :

Example 1 with ScriptInvocation

use of org.camunda.bpm.engine.impl.delegate.ScriptInvocation in project camunda-bpm-platform by camunda.

the class ScriptExecutionListener method notify.

public void notify(DelegateExecution execution) throws Exception {
    ScriptInvocation invocation = new ScriptInvocation(script, execution);
    Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(invocation);
}
Also used : ScriptInvocation(org.camunda.bpm.engine.impl.delegate.ScriptInvocation)

Example 2 with ScriptInvocation

use of org.camunda.bpm.engine.impl.delegate.ScriptInvocation in project camunda-bpm-platform by camunda.

the class ScriptCaseExecutionListener method notify.

public void notify(DelegateCaseExecution caseExecution) throws Exception {
    ScriptInvocation invocation = new ScriptInvocation(script, caseExecution);
    Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(invocation);
}
Also used : ScriptInvocation(org.camunda.bpm.engine.impl.delegate.ScriptInvocation)

Example 3 with ScriptInvocation

use of org.camunda.bpm.engine.impl.delegate.ScriptInvocation in project camunda-bpm-platform by camunda.

the class ScriptCondition method evaluate.

@Override
public boolean evaluate(VariableScope scope, DelegateExecution execution) {
    ScriptInvocation invocation = new ScriptInvocation(script, scope, execution);
    try {
        Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(invocation);
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new ProcessEngineException(e);
    }
    Object result = invocation.getInvocationResult();
    ensureNotNull("condition script returns null", "result", result);
    ensureInstanceOf("condition script returns non-Boolean", "result", result, Boolean.class);
    return (Boolean) result;
}
Also used : ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) ScriptEvaluationException(org.camunda.bpm.engine.ScriptEvaluationException) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) ScriptInvocation(org.camunda.bpm.engine.impl.delegate.ScriptInvocation)

Example 4 with ScriptInvocation

use of org.camunda.bpm.engine.impl.delegate.ScriptInvocation in project camunda-bpm-platform by camunda.

the class JuelFormEngine method executeScript.

protected Object executeScript(String scriptSrc, VariableScope scope) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    ScriptFactory scriptFactory = processEngineConfiguration.getScriptFactory();
    ExecutableScript script = scriptFactory.createScriptFromSource(ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE, scriptSrc);
    ScriptInvocation invocation = new ScriptInvocation(script, scope);
    try {
        processEngineConfiguration.getDelegateInterceptor().handleInvocation(invocation);
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new ProcessEngineException(e);
    }
    return invocation.getInvocationResult();
}
Also used : ExecutableScript(org.camunda.bpm.engine.impl.scripting.ExecutableScript) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ScriptFactory(org.camunda.bpm.engine.impl.scripting.ScriptFactory) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) ScriptInvocation(org.camunda.bpm.engine.impl.delegate.ScriptInvocation)

Example 5 with ScriptInvocation

use of org.camunda.bpm.engine.impl.delegate.ScriptInvocation in project camunda-bpm-platform by camunda.

the class ScriptCaseVariableListener method notify.

public void notify(DelegateCaseVariableInstance variableInstance) throws Exception {
    DelegateCaseVariableInstanceImpl variableInstanceImpl = (DelegateCaseVariableInstanceImpl) variableInstance;
    ScriptInvocation invocation = new ScriptInvocation(script, variableInstanceImpl.getScopeExecution());
    Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(invocation);
}
Also used : ScriptInvocation(org.camunda.bpm.engine.impl.delegate.ScriptInvocation)

Aggregations

ScriptInvocation (org.camunda.bpm.engine.impl.delegate.ScriptInvocation)5 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ScriptEvaluationException (org.camunda.bpm.engine.ScriptEvaluationException)1 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)1 ScriptFactory (org.camunda.bpm.engine.impl.scripting.ScriptFactory)1