Exemplo n.º 1
0
  public static void main1(String[] args) throws ClassNotFoundException, SQLException {
    OlapConnection conn = getConnection(url);
    CellSet cs = getResultSet(mdx, conn);
    // CellSetAxis c;

    int count = 0;
    if (cs.getAxes().size() > 1) {
      for (Position row : cs.getAxes().get(1)) {
        for (Position column : cs.getAxes().get(0)) {
          for (Member member : row.getMembers()) {
            System.out.println("rows:" + member.getUniqueName());
          }
          for (Member member : column.getMembers()) {
            System.out.println("columns:" + member.getUniqueName());
          }
          final Cell cell = cs.getCell(column, row);

          System.out.println("values:" + cell.getValue());

          Position[] positions = new Position[2];
          positions[0] = column;
          positions[1] = row;

          OlapCell oalpCell = new OlapCell(positions, cell.getValue());

          System.out.println("****" + oalpCell.toString());
          System.out.println(count++);
        }
      }
    }
  }
Exemplo n.º 2
0
  // coordinates.size should be 0 at very first
  public static void explore(
      List<CellSetAxis> axes, List<Position> coordinates, CellSet cs, List<OlapCell> cellList) {
    int level = coordinates.size();
    // System.out.println(level + "  " + axes.size());
    if (level < axes.size()) {
      for (Position p : axes.get(level).getPositions()) {
        coordinates.add(p);
        explore(axes, coordinates, cs, cellList);
      }

      if (level > 0) {
        coordinates.remove(level - 1);
      }

    } else {
      Position[] positions = new Position[coordinates.size()];
      positions = coordinates.toArray(positions);
      Cell cell = cs.getCell(positions);
      OlapCell olapCell = new OlapCell(positions, cell.getValue());
      cellList.add(olapCell);
      // System.out.println((++count) + " " + olapCell.toString());
      coordinates.remove(level - 1);
    }
  }