Package org.olap4j.mdx

Examples of org.olap4j.mdx.ParseTreeWriter


        public SelectNode validateSelect(
            SelectNode selectNode)
            throws OlapException
        {
            StringWriter sw = new StringWriter();
            selectNode.unparse(new ParseTreeWriter(sw));
            String mdx = sw.toString();
            final XmlaOlap4jConnection olap4jConnection =
                (XmlaOlap4jConnection) connection;
            return selectNode;
        }
View Full Code Here


   * @param node Parse tree
   * @return MDX string
   */
  public static String toString(@NotNull ParseTreeNode node) {
    StringWriter sw = new StringWriter();
    ParseTreeWriter parseTreeWriter = new ParseTreeWriter(sw);
    node.unparse(parseTreeWriter);
    return sw.toString();
  }
View Full Code Here

          }
          if (where) {
            mdx += ") ON COLUMNS from " + cube;
            SelectNode sn = new DefaultMdxParserImpl().parseSelect(q.getMdx());
            final Writer writer = new StringWriter();
            sn.getFilterAxis().unparse(new ParseTreeWriter(new PrintWriter(writer)));
            if (StringUtils.isNotBlank(writer.toString())) {
              mdx += "\r\nWHERE " + writer.toString();
            }
            System.out.println("Executing... :" + mdx);
            olapQueryService.executeMdx(queryName, mdx);
View Full Code Here

      String select = null;
      StringBuilder buf = new StringBuilder();
      if (sn.getWithList() != null && sn.getWithList().size() > 0) {
        buf.append("WITH \n");
        StringWriter sw = new StringWriter();
        ParseTreeWriter ptw = new ParseTreeWriter(sw);
        final PrintWriter pw = ptw.getPrintWriter();
        for (ParseTreeNode with : sn.getWithList()) {
          with.unparse(ptw);
          pw.println();
        }
        buf.append(sw.toString());
      }

      buf.append("SELECT (");
      for (int i = 0; i < cellPosition.size(); i++) {
        List<Member> members = cs.getAxes().get(i).getPositions().get(cellPosition.get(i)).getMembers();
        for (int k = 0; k < members.size(); k++) {
          Member m = members.get(k);
          if (k > 0 || i > 0) {
            buf.append(", ");
          }
          buf.append(m.getUniqueName());
        }
      }
      buf.append(") ON COLUMNS \r\n");
      buf.append("FROM [").append(cube.getName()).append("]\r\n");


      final Writer writer = new StringWriter();
      sn.getFilterAxis().unparse(new ParseTreeWriter(new PrintWriter(writer)));
      if (StringUtils.isNotBlank(writer.toString())) {
        buf.append("WHERE ").append(writer.toString());
      }
      select = buf.toString();
      if (maxrows > 0) {
View Full Code Here

  public String getMdx() {
    final Writer writer = new StringWriter();
    if (SaikuProperties.OLAPCONVERTQUERY) {
      try {
        SelectNode s = QueryConverter.convert(query);
        s.unparse(new ParseTreeWriter(new PrintWriter(writer)));
      } catch (SaikuIncompatibleException se) {
        LOG.debug("Cannot convert to new query model mdx, falling back to old version", se);
        this.query.getSelect().unparse(new ParseTreeWriter(new PrintWriter(writer)));
      } catch (Exception e) {
        throw new SaikuServiceException("Cannot convert to new query model", e);
      }
    } else {
      this.query.getSelect().unparse(new ParseTreeWriter(new PrintWriter(writer)));
    }
    return writer.toString();
  }
View Full Code Here

TOP

Related Classes of org.olap4j.mdx.ParseTreeWriter

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.