public Object transformOutput(final ActionContext actionContext, final GraphObject source)
      throws FrameworkException {

    if (outputFunction == null) {
      return source.getProperty(sourceProperty);
    }

    // output transformation requested
    actionContext.setConstant("input", source);
    return Scripting.evaluate(actionContext, null, "${" + outputFunction + "}");
  }
  public void transformInput(final ActionContext actionContext, final Map<String, Object> source)
      throws FrameworkException {

    // move / rename input value
    Object inputValue = source.remove(targetName);
    if (inputValue != null) {

      if (inputFunction != null) {

        // input transformation requested
        actionContext.setConstant("input", inputValue);
        inputValue = Scripting.evaluate(actionContext, null, "${" + inputFunction + "}");
      }

      source.put(sourceName, inputValue);
    }
  }
Beispiel #3
0
  public static Object execute(
      final SecurityContext securityContext,
      final GraphObject entity,
      final String source,
      final Map<String, Object> parameters)
      throws FrameworkException {

    final ActionContext context = new ActionContext(securityContext, parameters);
    final Object result = Scripting.evaluate(context, entity, source);

    // check for errors raised by scripting
    if (context.hasError()) {
      throw new FrameworkException(422, "Server-side scripting error", context.getErrorBuffer());
    }

    return result;
  }