Examples of SaikuCube


Examples of org.saiku.olap.dto.SaikuCube

  }

  public SaikuCube getSaikuCube() {
    try {
      Cube c = getCube();
      cube = new SaikuCube(
          cube.getConnection(),
          c.getUniqueName(),
          c.getName(),
          c.getCaption(),
          cube.getCatalog(),
View Full Code Here

Examples of org.saiku.olap.dto.SaikuCube

      String cubeName = queryElement.getAttributeValue(CUBE);

      String connectionName = queryElement.getAttributeValue(CONNECTION);
      String catalogName = queryElement.getAttributeValue(CATALOG);
      String schemaName = queryElement.getAttributeValue(SCHEMA);
      return new SaikuCube(connectionName, cubeName, cubeName, cubeName, catalogName, schemaName);
    }
    throw new Exception("Cant find <QueryModel> nor <MDX> Query");
  }
View Full Code Here

Examples of org.saiku.olap.dto.SaikuCube

      String connectionName = queryElement.getAttributeValue(CONNECTION);
      String catalogName = queryElement.getAttributeValue(CATALOG);
      String schemaName = queryElement.getAttributeValue(SCHEMA);
      Query tmpQuery = createEmptyQuery("tmp-1234", catalogName, schemaName, cubeName);
      Cube cub = tmpQuery.getCube();
      return new SaikuCube(connectionName, cub.getUniqueName(), cub.getName(), cub.getCaption(), catalogName,
          schemaName);
    }
    throw new Exception("Cant find <QueryModel> nor <MDX> Query");
  }
View Full Code Here

Examples of org.saiku.olap.dto.SaikuCube

      try {
        Element qmElement = queryElement.getChild("QueryModel");
        if (qmElement != null) {
          qm = createEmptyQuery(queryName, catalogName, schemaName, cubeName);
          manipulateQuery(qmElement);
          SaikuCube cube =
              new SaikuCube(connectionName, cubeName, qm.getCube().getName(), qm.getCube().getCaption(), catalogName,
                  schemaName);
          IQuery q = new OlapQuery(qm, connection, cube, false);
          setTotals(q, queryElement);
          Properties p = getProperties(queryElement);
          q.setProperties(p);
View Full Code Here

Examples of org.saiku.olap.dto.SaikuCube

      String schemaName = queryElement.getAttributeValue(SCHEMA);
      Properties props = getProperties(queryElement);
      try {
        Element mdxElement = queryElement.getChild("MDX");
        if (mdxElement != null) {
          SaikuCube cube = new SaikuCube(connectionName, cubeName, cubeName, cubeName, catalogName, schemaName);
          IQuery q = new MdxQuery(connection, cube, queryName, mdxElement.getText());
          q.setProperties(props);
          return q;
        } else {
          throw new OlapException("Can't find child <MDX>");
View Full Code Here

Examples of org.saiku.olap.dto.SaikuCube

  }

  public boolean isMdxDrillthrough(@NotNull ThinQuery query) {
    try {
      if (ThinQuery.Type.MDX.equals(query.getType())) {
        SaikuCube cube = query.getCube();
        final OlapConnection con = olapDiscoverService.getNativeConnection(cube.getConnection());
        return SaikuMondrianHelper.isMondrianDrillthrough(con, query.getMdx());
      }
    } catch (Exception e) {
      LOG.warn("Error checking for DRILLTHROUGH: " + query.getName() + " DRILLTHROUGH MDX:" + query.getMdx(), e);
    } catch (Error e) {
View Full Code Here

Examples of org.saiku.olap.dto.SaikuCube

  }

  public ResultSet drillthrough(@NotNull ThinQuery query) {
    OlapStatement stmt = null;
    try {
      SaikuCube cube = query.getCube();
      final OlapConnection con = olapDiscoverService.getNativeConnection(cube.getConnection());
      stmt = con.createStatement();
      ResultSet rs = stmt.executeQuery(query.getMdx());
      return rs;
    } catch (SQLException e) {
      throw new SaikuServiceException("Error DRILLTHROUGH: " + query.getMdx() + " DRILLTHROUGH MDX:" + query.getMdx(),
View Full Code Here

Examples of org.saiku.olap.dto.SaikuCube

    OlapStatement stmt = null;
    try {
      QueryContext queryContext = context.get(queryName);
      ThinQuery query = queryContext.getOlapQuery();
      CellSet cs = queryContext.getOlapResult();
      SaikuCube cube = query.getCube();
      final OlapConnection con = olapDiscoverService.getNativeConnection(cube.getConnection());
      stmt = con.createStatement();

      SelectNode sn = new DefaultMdxParserImpl().parseSelect(query.getMdx());
      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())) {
View Full Code Here

Examples of org.saiku.olap.dto.SaikuCube

  @Nullable
  public ThinQuery convertQuery(@NotNull String xml) throws Exception {
    if (StringUtils.isNotBlank(xml) && xml.trim().startsWith("<?xml")) {
      QueryDeserializer qd = new QueryDeserializer();
      SaikuCube scube = qd.getFakeCube(xml);
      OlapConnection con = olapDiscoverService.getNativeConnection(scube.getConnection());
      IQuery query = qd.unparse(xml, con);

      if (QueryType.QM.equals(query.getType())) {
        OlapQuery qr = (OlapQuery) query;
        Query sQ = QueryConverter.convertQuery(qr.getQuery());
        SaikuCube converted = ObjectUtil.convert(scube.getConnection(), sQ.getCube());
        return Thin.convert(sQ, converted);
      } else {
        SaikuCube converted = ObjectUtil.convert(scube.getConnection(), olapDiscoverService.getNativeCube(scube));
        return new ThinQuery(query.getName(), converted, query.getMdx());
      }
    }
    return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.