Package com.gentics.api.lib.expressionparser

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


  }

  @Test
  public void testExpressionParserHelperCorrectContentidStringExpression() throws ExpressionParserException,
      ParserException {
    Expression expression = ExpressionParserHelper.parse("object.contentid == \"10001.2\"");
    assertTrue("contentid (10001.2) doesn't match", ExpressionParserHelper.match(expression, resolvable));
  }
View Full Code Here


  }

  @Test
  public void testExpressionParserHelperWrongContentidStringExpression() throws ExpressionParserException,
      ParserException {
    Expression expression = ExpressionParserHelper.parse("object.contentid == \"10001.1\"");
    assertFalse(
      "contentid (10001.1) does match, but it shouldn't",
      ExpressionParserHelper.match(expression, resolvable));
  }
View Full Code Here

        && !this.getContentid().equals("")) {
      this.setRequestFilter("object.contentid=='" + this.getContentid() + "'");
    }

    // TEST IF REQUEST FILTER IS SAVE
    Expression expression = PortalConnectorFactory.createExpression(this.getRequestFilter());
    // IF NO EXCEPTION IS THROWN IN THE ABOVE STATEMENT, FILTER IS
    // CONSIDERED TO BE SAVE

    // ADD APPLICATION RULE IF IT IS SET
    if (config.getApplicationRule() == null || config.getApplicationRule().equals("")) {
View Full Code Here

   * @throws ParserException when the rule cannot be parsed into an
   * {@link Expression}.
   */
  public static boolean match(final String rule, final Resolvable objectToMatch) throws ExpressionParserException,
      ParserException {
    Expression expression = parse(rule);
    return expressionEvaluator.match(expression, objectToMatch);
  }
View Full Code Here

   * doesn't specify when this exception is thrown. Documententation request was
   * sent to Gentics Support @2010-06-07, Ticket number: 37059
   */
  public static DatasourceFilter createDatasourceFilter(final String rule, final Datasource ds)
      throws ParserException, ExpressionParserException {
    Expression expression = parse(rule);
    return ExpressionParserHelper.createDatasourceFilter(expression, ds);
  }
View Full Code Here

  @Override
  public Collection<CRResolvableBean> getObjects(final CRRequest request, final boolean doNavigation) throws CRException {
    String filter = request.getRequestFilter();
    if (filter != null && !filter.equals("")) {
      try {
        Expression expression = ExpressionParserHelper.parse(filter);
        ArrayList<CRResolvableBean> result = new ArrayList<CRResolvableBean>();
        for (CRResolvableBean object : objects) {
          if (ExpressionParserHelper.match(expression, object)) {
            result.add(object);
          }
View Full Code Here

        try {
          //if there is an attribute URL the servlet was called with a beautiful URL so give back a beautiful URL         
          //check if valid local link
          String applicationrule = (String) config.get("applicationrule");
          ds = config.getDatasource();
          Expression expression = null;
          try {
            expression = PortalConnectorFactory.createExpression("object.contentid == '" + contentid
                + "' && " + applicationrule);
          } catch (ParserException exception) {
            log.error("Error while building expression object for " + contentid, exception);
View Full Code Here

          //if there is an attribute URL the servlet was
          //called with a beautiful URL so give back a beautiful URL
          //check if valid local link
          String applicationrule = (String) config.get("applicationrule");
          ds = config.getDatasource();
          Expression expression = null;
          try {
            expression = PortalConnectorFactory.createExpression("object.contentid == '" + contentid
                + "' && " + applicationrule);
          } catch (ParserException exception) {
            log.error("Error while building expression object for " + contentid, exception);
View Full Code Here

  public final Collection<CRResolvableBean> getObjects(final CRRequest request, final boolean doNavigation)
      throws CRException {
    Collection<CRResolvableBean> result = new Vector<CRResolvableBean>();
    String requestFilter = request.getRequestFilter();
    try {
      Expression expressionFromFilter = ExpressionParserHelper.parse(requestFilter);
      for (CRResolvableBean item : new Vector<CRResolvableBean>(monitoredPath.getRegisteredDescendants())) {
        if (ExpressionParserHelper.match(expressionFromFilter, item)) {
          result.add(item);
        }
      }
View Full Code Here

TOP

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

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.