Package com.gentics.api.lib.expressionparser

Examples of com.gentics.api.lib.expressionparser.EvaluableExpression


   */
  private static String evaluateString(final String expressionString, final Resolvable resolvable) {
    String result = null;
    ExpressionParser expressionParser = ExpressionParser.getInstance();
    try {
      EvaluableExpression expression = (EvaluableExpression) expressionParser.parse(expressionString);
      ExpressionQueryRequest expressionQueryRequest = new ExpressionQueryRequest(
          new PropertyResolver(resolvable), new HashMap<Object, Object>(0));
      result = (String) expression.evaluate(expressionQueryRequest, ExpressionEvaluator.OBJECTTYPE_STRING);
    } catch (ExpressionParserException e) {
      LOGGER.error("Error while evaluating the expression (" + expressionString + ") with the base resolvable ("
          + resolvable + ")", e);
    } catch (ParserException e) {
      LOGGER.error("Error parsing the expression (" + expressionString + ").", e);
View Full Code Here


    if (attributesConfig != null) {
      for (Object attributeNameObject : attributesConfig.getProperties().keySet()) {
        String attributeName = (String) attributeNameObject;
        String attributeValue = (String) attributesConfig.get(attributeName);
        try {
          EvaluableExpression attributeExpression = (EvaluableExpression) ExpressionParserHelper
              .parse(attributeValue);
          attributeDefinition.put(attributeName, attributeExpression);
        } catch (ParserException e) {
          logger.error("Cannot parse the attribute " + configName + "." + configurationKey + "."
              + attributeName + " into an expression. (" + attributeValue + ")", e);
View Full Code Here

   */
  private int processAttributes(final StringBuffer html, final ExpressionQueryRequest expressionQueryRequest,
      final HashMap<String, EvaluableExpression> attributesDefintion, final AttributeCallback attributeCallback) {
    int changes = 0;
    for (String attributeName : attributesDefintion.keySet()) {
      EvaluableExpression expression = attributesDefintion.get(attributeName);
      try {
        String result = (String) expression.evaluate(
          expressionQueryRequest,
          ExpressionEvaluator.OBJECTTYPE_STRING);
        if (result != null && !result.equals("")) {
          attributeCallback.invokeCallback(html, attributeName.toLowerCase(), result);
          changes++;
        }

      } catch (ExpressionParserException e) {
        logger.error("Cannot evaluate expression (" + expression.getExpressionString() + ")as String.", e);
      }
    }
    return changes;
  }
View Full Code Here

TOP

Related Classes of com.gentics.api.lib.expressionparser.EvaluableExpression

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.