Package de.innovationgate.wgpublisher.expressions

Examples of de.innovationgate.wgpublisher.expressions.ExpressionEngine


        throw new TMLScriptException("Error calling hdbmodel process '" + _moduleName + "'.", e);
      }
  }

    private void execute(String scriptCode, TMLContext context) throws Throwable {
        ExpressionEngine engine = ExpressionEngineFactory.getEngine(ExpressionEngineFactory.ENGINE_TMLSCRIPT)
        ExpressionResult result = engine.evaluateExpression(scriptCode.toString(), context, RhinoExpressionEngine.TYPE_SCRIPT, null);
        if (result.isError()) {
            if (result.getException().getCause() != null) {
                throw result.getException().getCause();
            } else {
                throw result.getException();
View Full Code Here


       
        Object defaultvalue = this.getDefault();
        if (defaultvalue == null) {
          String expression = getDefaultexpression();
      if (expression != null) {
        ExpressionEngine engine = ExpressionEngineFactory.getEngine(getDefaultExpressionLanguage());
        if (engine == null) {
          this.addWarning("Unknown expression language: " + getDefaultExpressionLanguage(), true);
        }
       
       
        Map objects = new HashMap();
        objects.put(RhinoExpressionEngine.PARAM_SCRIPTNAME, "DefaultExpression on " + getTagDescription());
        ExpressionResult result = engine.evaluateExpression(expression, this.getTMLContext(), ExpressionEngine.TYPE_EXPRESSION, objects);
        if (result.isError()) {
            addExpressionWarning(expression,result);
        }
        else {
          defaultvalue = result.getResult();
View Full Code Here

  public int compare(Object arg0, Object arg1) {
   
    if ((arg0 instanceof WGContent) && (arg1 instanceof WGContent)) {
       
      TMLContext context0 = tag.getTMLContextForDocument((WGContent) arg0);
      ExpressionEngine engine0 = this.getEngine(context0.content());
      ExpressionResult result0 = engine0.evaluateExpression(this.expression, context0, ExpressionEngine.TYPE_EXPRESSION, null);
      if (result0.isError()) {
        this.tag.addWarning("Error in sort expression evaluation: " + result0.getException().getMessage() + " (Expression: [" + result0.getException().getExpression() + "])");
        return -1;
      }
     
      TMLContext context1 = tag.getTMLContextForDocument((WGContent) arg1);
      ExpressionEngine engine1 = this.getEngine(context1.content());
      ExpressionResult result1 = engine1.evaluateExpression(this.expression, context1, ExpressionEngine.TYPE_EXPRESSION, null);
      if (result1.isError()) {
        this.tag.addWarning("Error in sort expression evaluation: " + result1.getException().getMessage() + " (Expression: [" + result1.getException().getExpression() + "])");
        return 1;
      }
            return super.compare(result0.getResult(), result1.getResult());
View Full Code Here

            }
        }
       

            // evaluate
            ExpressionEngine engine = ExpressionEngineFactory.getEngine(ExpressionEngineFactory.ENGINE_TMLSCRIPT);
        ExpressionResult result = engine.evaluateExpression(tmlAction.getCode(), actionContext, ExpressionEngine.TYPE_SCRIPT, additionalObjects);
        if (result.isError()) {
            WGExpressionException exc = result.getException();
               
                if (iswebenvironment()) {
                    addwarning(WGUtils.encodeHTML(exc.getMessage() + (exc.getExpression() != null ? "\nExpression line: " + exc.getExpression() : "\nExpression:\n" + tmlAction.getCode())), false);
View Full Code Here

  private Object getMappedMetaValue(String name) {

    String expression = getMetaMappingExpression(name);

    if (expression != null) {
      ExpressionEngine engine =
        ExpressionEngineFactory.getEngine(
          this.content().getDatabase().getAttribute(WGACore.DBATTRIB_EXPRESSION_DEFAULT).toString());
      ExpressionResult result = engine.evaluateExpression(expression, this, ExpressionEngine.TYPE_EXPRESSION, null);
      return result.getResult();
    }
    else {
      return null;
    }
View Full Code Here

  private Object getMappedItemValue(String name) {
 
    String expression = getItemMappingExpression(name);

    if (expression != null) {
      ExpressionEngine engine =
        ExpressionEngineFactory.getEngine(this.content().getDatabase().getAttribute(WGACore.DBATTRIB_EXPRESSION_DEFAULT).toString());
      ExpressionResult result = engine.evaluateExpression(expression, this, ExpressionEngine.TYPE_EXPRESSION, null);
      return result.getResult();
    }
    else {
      return null;
    }
View Full Code Here

        return _designContext;
    }
 
   
    public ExpressionResult evaluateExpression(String expression, Map additionalObjects) {
      ExpressionEngine engine = ExpressionEngineFactory.getEngine(ExpressionEngineFactory.ENGINE_TMLSCRIPT);
      return engine.evaluateExpression(expression, this, ExpressionEngine.TYPE_EXPRESSION, additionalObjects);
    }
View Full Code Here

    public ExpressionResult evaluateExpression(String expression) {
      return evaluateExpression(expression, null);
    }
   
    public ExpressionResult evaluateScript(String script, Map additionalObjects) {
      ExpressionEngine engine = ExpressionEngineFactory.getEngine(ExpressionEngineFactory.ENGINE_TMLSCRIPT);
      return engine.evaluateExpression(script, this, ExpressionEngine.TYPE_SCRIPT, additionalObjects);
    }
View Full Code Here

  public String getName() {
    return _moduleName;
  }
   
    private void execute(String scriptCode, WGHierarchicalDatabaseEvent event) throws Throwable {
        ExpressionEngine engine = ExpressionEngineFactory.getEngine(ExpressionEngineFactory.ENGINE_TMLSCRIPT);
       
        Map params = new HashMap();
        params.put(RhinoExpressionEngine.PARAM_SCRIPTNAME, "HDBModel event module '" + event.getDb().getWrappedDB().getDbReference() + "/" + _moduleName  + "', event " + event.getType());
       
        ExpressionResult result = engine.evaluateExpression(scriptCode.toString(), retrieveContext(event), RhinoExpressionEngine.TYPE_SCRIPT, params);
        if (result.isError()) {
            if (result.getException().getCause() != null) {
                throw result.getException().getCause();
            }
            else {
View Full Code Here

TOP

Related Classes of de.innovationgate.wgpublisher.expressions.ExpressionEngine

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.