Package org.jbpm.pvm.internal.script

Examples of org.jbpm.pvm.internal.script.ScriptManager


      }
    }
  }

  private String evaluateExpression(String expression, Execution execution) {
    ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
    Object value = scriptManager.evaluateExpression(expression, template.getLanguage());
    if (!(value instanceof String)) {
      throw new JbpmException("expected expression '"
          + expression
          + "' to return string, but was: "
          + value);
View Full Code Here


    // loop over all variable definitions
    if (hasVariableOutDefinitions()) {
      for (VariableOutDefinitionImpl variableOutDefinition: variableOutDefinitions) {
        String variableName = variableOutDefinition.getName();
        if (variableName!=null) {
          ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
         
          // TODO update evaluateExpression so that scopeInstance can be passed in directly
          String expression = variableOutDefinition.getExpression();
          String language = variableOutDefinition.getLanguage();

          Object value = scriptManager.evaluateExpression(expression, language);
          outerExecution.setVariable(variableName, value);
        }
      }
    }
  }
View Full Code Here

      object = wireContext.create(factoryDescriptor, false);
      if (object==null) {
        throw new WireException("created factory object is null, can't invoke method '"+methodName+"' on it");
      }
    } else if (expr!=null) {
      ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
      object = scriptManager.evaluateExpression(expr, lang);
    }

    if (methodName!=null) {
      // method invocation on object or static method invocation in case object is null
      if (object!=null) {
View Full Code Here

  public Object getInitValue(ExecutionImpl execution) {
    if (initDescriptor!=null) {
      return WireContext.create(initDescriptor);
    }
    if (initExpression!=null) {
      ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
      return scriptManager.evaluateExpression(initExpression, initLanguage);
    }
    return null;
  }
View Full Code Here

    timerSession.schedule(this);
  }

  public void setDueDateDescription(String dueDateDescription) {

    ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
    dueDateDescription = (String) scriptManager.evaluateExpression(dueDateDescription, null);
   
    Duration duration = new Duration(dueDateDescription);
    Date now = Clock.getCurrentTime();
   
    if ( duration.isBusinessTime()
View Full Code Here

  public boolean evaluate(OpenExecution execution) {
    return (Boolean) evaluateExpression(execution);
  }

  public Object evaluateExpression(OpenExecution execution) {
    ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
    return scriptManager.evaluateExpression(expr, lang);
  }
View Full Code Here

* @author Tom Baeyens
*/
public abstract class EnvironmentDefaults {

  public static ScriptManager getScriptManager() {
    ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class, false);
    if (scriptManager!=null) {
      return scriptManager;
    }
    return ScriptManager.getDefaultScriptManager();
  }
View Full Code Here

      }
    }
  }

  protected String resolveAssignmentExpression(String expression, String expressionLanguage) {
    ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
    Object result = scriptManager.evaluateExpression(expression, expressionLanguage);
    if ( (result ==null)
         || (result instanceof String)
       ) {
      return (String) result;
    }
View Full Code Here

 
  public void execute(ExecutionImpl execution) {
    Activity activity = execution.getActivity();
    String transitionName = null;

    ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
    Object result = scriptManager.evaluateExpression(expr, lang);
    if ( (result!=null)
         && (! (result instanceof String))
       ) {
      throw new JbpmException("expression '"+expr+"' in decision '"+activity.getName()+"' returned "+result.getClass().getName()+" instead of a transitionName (String): "+result);
    }
View Full Code Here

  protected String script;
  protected String language;
  protected String variableName;

  public void perform(OpenExecution execution) {
    ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
    Object returnValue = scriptManager.evaluateScript(script, language);
   
    if (variableName!=null) {
      execution.setVariable(variableName, returnValue);
    }
  }
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.script.ScriptManager

Copyright © 2018 www.massapicom. 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.