Ejemplo n.º 1
0
  public byte[] exportDrillthroughCsv(String queryName, int maxrows) {
    OlapStatement stmt = null;
    try {
      final OlapConnection con =
          olapDiscoverService.getNativeConnection(
              getQuery(queryName).getCube().getConnectionName());
      stmt = con.createStatement();
      String mdx = getMDXQuery(queryName);
      if (maxrows > 0) {
        mdx = "DRILLTHROUGH MAXROWS " + maxrows + " " + mdx;
      } else {
        mdx = "DRILLTHROUGH " + mdx;
      }

      ResultSet rs = stmt.executeQuery(mdx);
      return CsvExporter.exportCsv(rs);
    } catch (SQLException e) {
      throw new SaikuServiceException("Error DRILLTHROUGH: " + queryName, e);
    } finally {
      try {
        if (stmt != null) stmt.close();
      } catch (Exception e) {
      }
    }
  }
Ejemplo n.º 2
0
 public byte[] exportResultSetCsv(
     ResultSet rs,
     String delimiter,
     String enclosing,
     boolean printHeader,
     List<KeyValue<String, String>> additionalColumns) {
   return CsvExporter.exportCsv(rs, delimiter, enclosing, printHeader, additionalColumns);
 }
Ejemplo n.º 3
0
  public byte[] getExport(String queryName, String type, ICellSetFormatter formatter) {
    if (type != null) {
      IQuery query = getIQuery(queryName);
      CellSet rs = query.getCellset();
      List<SaikuDimensionSelection> filters = new ArrayList<SaikuDimensionSelection>();

      if (query.getType().equals(QueryType.QM)) {
        filters = getAxisSelection(queryName, "FILTER");
      }
      if (type.toLowerCase().equals("xls")) {
        return ExcelExporter.exportExcel(rs, formatter, filters);
      }
      if (type.toLowerCase().equals("csv")) {
        return CsvExporter.exportCsv(rs, ",", "\"", formatter);
      }
    }
    return new byte[0];
  }
Ejemplo n.º 4
0
 public byte[] exportResultSetCsv(ResultSet rs) {
   return CsvExporter.exportCsv(rs);
 }