Package org.haystack

Examples of org.haystack.HFilter$Path


      throw new RuntimeException("Failed to add routes for " + routeControllerClass + ".", t);
    }

    for (Method routeMethod : routeControllerClass.getDeclaredMethods()) {
      String routeMethodName = routeMethod.getName();
      Path pathAnnotation = routeMethod.getAnnotation(Path.class);
      Paths pathsAnnotation = routeMethod.getAnnotation(Paths.class);
      if (pathAnnotation != null || pathsAnnotation != null) {
        String actionName;
        if (routeMethodName.endsWith("Action")) {
          actionName = routeMethodName.substring(0, routeMethodName.length() - "Action".length());
        }
        else {
          actionName = routeMethodName;
        }

        ERXRoute.Method method = null;
        // Search annotations for @PUT, @GET, etc.
        for (Annotation annotation : routeMethod.getAnnotations()) {
          HttpMethod httpMethod = annotation.annotationType().getAnnotation(HttpMethod.class);
          if (httpMethod != null) {
            if (method == null) {
              method = httpMethod.value();
            }
            else {
              throw new IllegalArgumentException(routeControllerClass.getSimpleName() + "." + routeMethod.getName() + " is annotated as more than one http method.");
            }
          }
        }

        // Finally default declared REST actions to @GET
        if (method == null) {
          method = ERXRoute.Method.Get;
        }

        if (pathAnnotation != null) {
          addRoute(new ERXRoute(entityName, pathAnnotation.value(), method, routeControllerClass, actionName));
          declaredRoutesFound = true;
        }
        if (pathsAnnotation != null) {
          for (Path path : pathsAnnotation.value()) {
            addRoute(new ERXRoute(entityName, path.value(), method, routeControllerClass, actionName));
View Full Code Here


        verifyParse("(a) and (b)", HFilter.has("a").and(HFilter.has("b")));
        verifyParse("( a )  and  ( b ) ", HFilter.has("a").and(HFilter.has("b")));
        verifyParse("(a or b) or (c == 3)", HFilter.has("a").or(HFilter.has("b")).or(HFilter.eq("c", n(3))));

        // combo
        HFilter isA = HFilter.has("a");
        HFilter isB = HFilter.has("b");
        HFilter isC = HFilter.has("c");
        HFilter isD = HFilter.has("d");
        verifyParse("a and b or c", (isA.and(isB)).or(isC));
        verifyParse("a or b and c", isA.or(isB.and(isC)));
        verifyParse("a and b or c and d", (isA.and(isB)).or(isC.and(isD)));
        verifyParse("(a and (b or c)) and d", isA.and(isB.or(isC)).and(isD));
        verifyParse("(a or (b and c)) or d", isA.or(isB.and(isC)).or(isD));
View Full Code Here

        verifyParse("(a and (b or c)) and d", isA.and(isB.or(isC)).and(isD));
        verifyParse("(a or (b and c)) or d", isA.or(isB.and(isC)).or(isD));
    }

    void verifyParse(String s, HFilter expected) {
        HFilter actual = HFilter.make(s);
        verifyEq(actual, expected);
    }
View Full Code Here

            public HDict find(String id) {
                return map.get(id);
            }
        };

        HFilter q = HFilter.make(query);

        String actual = "";
        for (int c = 'a'; c <= 'c'; ++c) {
            String id = "" + (char) c;
            if (q.include(db.find(id), db))
                actual += actual.length() > 0 ? "," + id : id;
        }
        verifyEq(expected, actual);
    }
View Full Code Here

    /**
     * Default implementation scans all records using "iterator"
     */
    @Override
    protected HGrid onReadAll(String filter, int limit) {
        HFilter f = HFilter.make(filter);
        List<HDict> acc = new ArrayList<HDict>();
        for (Iterator<HDict> it = iterator(); it.hasNext();) {
            HDict rec = it.next();
            if (f.include(rec, filterPather)) {
                acc.add(rec);
                if (acc.size() >= limit)
                    break;
            }
        }
View Full Code Here

        skipSpace();

        if (cur == -1)
            return HFilter.all();

        HFilter q = readFilterOr();
        skipSpace();
        if (cur >= 0)
            throw errChar("Expected end of stream");
        return q;
    }
View Full Code Here

            throw errChar("Expected end of stream");
        return q;
    }

    private HFilter readFilterOr() {
        HFilter q = readFilterAnd();
        skipSpace();
        if (cur != 'o')
            return q;
        if (!readId().equals("or"))
            throw err("Expecting 'or' keyword");
        skipSpace();
        return q.or(readFilterOr());
    }
View Full Code Here

        skipSpace();
        return q.or(readFilterOr());
    }

    private HFilter readFilterAnd() {
        HFilter q = readFilterAtomic();
        skipSpace();
        if (cur != 'a')
            return q;
        if (!readId().equals("and"))
            throw err("Expecting 'and' keyword");
        skipSpace();
        return q.and(readFilterAnd());
    }
View Full Code Here

    }

    private HFilter readFilterParens() {
        consume();
        skipSpace();
        HFilter q = readFilterOr();
        if (cur != ')')
            throw err("Expecting ')'");
        consume();
        return q;
    }
View Full Code Here

      throw new ParserException("Reached end of xml document unexpectedly");
   }

   private Icon parseIcon(XMLStreamReader reader) throws XMLStreamException, ParserException
   {
      Path largeIcon = null;
      Path smallIcon = null;

      //getting attributes
      String id = reader.getAttributeValue(null, Icon.Attribute.ID.getLocalName());
      String lang = reader.getAttributeValue(null, Icon.Attribute.ID.getLocalName());
View Full Code Here

TOP

Related Classes of org.haystack.HFilter$Path

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.