Examples of ExecutableScript


Examples of org.camunda.bpm.engine.impl.scripting.ExecutableScript

    } else if (delegateExpression != null) {
      Expression delegateExp = expressionManager.createExpression(delegateExpression);
      caseExecutionListener = new DelegateExpressionCaseExecutionListener(delegateExp, fieldDeclarations);

    } else if (scriptElement != null) {
      ExecutableScript executableScript = initializeScript(element, activity, context, scriptElement);
      if (executableScript != null) {
        caseExecutionListener = new ScriptCaseExecutionListener(executableScript);
      }
    }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.scripting.ExecutableScript

      taskListener = new ExpressionTaskListener(expressionManager.createExpression(expression));
    } else if (delegateExpression != null) {
      taskListener = new DelegateExpressionTaskListener(expressionManager.createExpression(delegateExpression), parseFieldDeclarations(taskListenerElement));
    }
    else if (scriptElement != null) {
      ExecutableScript executableScript = parseCamundaScript(scriptElement);
      if (executableScript != null) {
        taskListener = new ScriptTaskListener(executableScript);
      }
    } else {
      addError("Element 'class', 'expression', 'delegateExpression' or 'script' is mandatory on taskListener", taskListenerElement);
View Full Code Here

Examples of org.camunda.bpm.engine.impl.scripting.ExecutableScript

      Condition condition = null;
      if (language == null) {
        condition = new UelExpressionCondition(expressionManager.createExpression(expression));
      }
      else {
        ExecutableScript script = parseScriptDefinition(language, resource, expression);
        if (script != null) {
          condition = new ScriptCondition(script);
        }
      }
      seqFlow.setProperty(PROPERTYNAME_CONDITION_TEXT, expression);
View Full Code Here

Examples of org.camunda.bpm.engine.impl.scripting.ExecutableScript

    } else if (expression != null) {
      executionListener = new ExpressionExecutionListener(expressionManager.createExpression(expression));
    } else if (delegateExpression != null) {
      executionListener = new DelegateExpressionExecutionListener(expressionManager.createExpression(delegateExpression), parseFieldDeclarations(executionListenerElement));
    } else if (scriptElement != null) {
      ExecutableScript executableScript = parseCamundaScript(scriptElement);
      if (executableScript != null) {
        executionListener = new ScriptExecutionListener(executableScript);
      }
    } else {
      addError("Element 'class', 'expression', 'delegateExpression' or 'script' is mandatory on executionListener", executionListenerElement);
View Full Code Here

Examples of org.camunda.bpm.engine.impl.scripting.ExecutableScript

      return new MapValueProvider(providerMap);
    }

    // SCRIPT
    if("script".equals(parameterElement.getTagName())) {
      ExecutableScript executableScript = parseCamundaScript(parameterElement);
      if (executableScript != null) {
        return new ScriptValueProvider(executableScript);
      }
      else {
        return new NullValueProvider();
View Full Code Here

Examples of org.camunda.bpm.engine.impl.scripting.ExecutableScript

  protected Object executeScript(String scriptSrc, VariableScope<?> scope) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    ScriptingEnvironment scriptingEnvironment = processEngineConfiguration.getScriptingEnvironment();
    ScriptFactory scriptFactory = processEngineConfiguration.getScriptFactory();
    ExecutableScript script = scriptFactory.createScript(scriptSrc, ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE);
    return scriptingEnvironment.execute(script, scope);
  }
View Full Code Here

Examples of org.elasticsearch.script.ExecutableScript

                        long y = ThreadLocalRandom.current().nextInt();
                        long addition = x + y;
                        Map<String, Object> vars = new HashMap<String, Object>();
                        vars.put("x", x);
                        vars.put("y", y);
                        ExecutableScript script = se.executable(compiled, vars);
                        for (int i = 0; i < 100000; i++) {
                            long result = ((Number) script.run()).longValue();
                            assertThat(result, equalTo(addition));
                        }
                    } catch (Throwable t) {
                        failed.set(true);
                        logger.error("failed", t);
View Full Code Here

Examples of org.elasticsearch.script.ExecutableScript

                    try {
                        barrier.await();
                        long x = ThreadLocalRandom.current().nextInt();
                        Map<String, Object> vars = new HashMap<String, Object>();
                        vars.put("x", x);
                        ExecutableScript script = se.executable(compiled, vars);
                        for (int i = 0; i < 100000; i++) {
                            long y = ThreadLocalRandom.current().nextInt();
                            long addition = x + y;
                            script.setNextVar("y", y);
                            long result = ((Number) script.run()).longValue();
                            assertThat(result, equalTo(addition));
                        }
                    } catch (Throwable t) {
                        failed.set(true);
                        logger.error("failed", t);
View Full Code Here

Examples of org.elasticsearch.script.ExecutableScript

            se.execute(compiled, vars);
        }
        System.out.println("Execute Took: " + stopWatch.stop().lastTaskTime());

        stopWatch = new StopWatch().start();
        ExecutableScript executableScript = se.executable(compiled, vars);
        for (long i = 0; i < ITER; i++) {
            executableScript.run();
        }
        System.out.println("Executable Took: " + stopWatch.stop().lastTaskTime());
    }
View Full Code Here

Examples of org.elasticsearch.script.ExecutableScript

        Map<String, Object> ctx = new HashMap<String, Object>();
        Map<String, Object> doc = new HashMap<String, Object>();
        ctx.put("doc", doc);

        Object complied = se.compile("ctx.doc.field1 = ['value1', 'value2']");
        ExecutableScript script = se.executable(complied, new HashMap<String, Object>());
        script.setNextVar("ctx", ctx);
        script.run();

        Map<String, Object> unwrap = (Map<String, Object>) script.unwrap(ctx);

        assertThat(((Map) unwrap.get("doc")).get("field1"), instanceOf(List.class));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.