Package com.dotcms.repackage.org.antlr.runtime.tree

Examples of com.dotcms.repackage.org.antlr.runtime.tree.CommonTree


      throw new DotRuntimeException(e.getMessage(), e);
    }
        TokenSource lexer = new CmisSqlLexer(input);
       
        TokenStream tokens = new CommonTokenStream(lexer);
        CommonTree tree;
    try {
      tree = (CommonTree) new CmisSqlParser(tokens).query().getTree();
    } catch (RecognitionException e) {
      Logger.error(SQLQueryFactory.class,e.getMessage(),e);
      throw new DotRuntimeException(e.getMessage(), e);
    }
        CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree);
//    new Bufferedt
        nodes.setTokenStream(tokens);
//        CmisSqlSimpleWalker walker = new CmisSqlSimpleWalker(nodes);
//        CmisSqlSimpleWalker.query_return ret = walker.query(new SQLWalkerDummyData("DUMMY", BaseType.DOCUMENT));
        query = new Query();
        String tableName = tree.getFirstChildWithType(CmisSqlParser.FROM).getChild(0).getChild(0).toString();
//        String tableName = ret.tableName;
        query.setFromClause(tableName);
        int selectType = ((CommonTree)(tree.getChildren().get(0))).getType();
        if(selectType == CmisSqlParser.LIST){
          List<String> attributeList = new ArrayList<String>();
          List<CommonTree> cols = ((CommonTree)(tree.getChildren().get(0))).getChildren();
          for (CommonTree col : cols) {
        attributeList.add((col.getChildren().get(0).toString()));
      }
          query.setSelectAttributes(attributeList);
        }
       
        buildCriteria((CommonTree)tree.getFirstChildWithType(CmisSqlParser.WHERE), query);
       
//        ((CommonTree)ret.getStart()).getChildren()
        if(tableName.equalsIgnoreCase(BuilderType.FILE_ASSET.toString())){
          query.setBuilderType(BuilderType.FILE_ASSET);
        }else if(tableName.equalsIgnoreCase(BuilderType.HTMLPAGE.toString())){
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.antlr.runtime.tree.CommonTree

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.