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++); } } } }
public static void main(String[] args) throws Exception { OlapConnection conn = getConnection(url); CellSet cs = getResultSet(mdx, conn); List<Position> coordinates = new ArrayList<Position>(); List<OlapCell> results = new ArrayList<OlapCell>(); explore(cs.getAxes(), coordinates, cs, results); Gson gson = new Gson(); System.out.println(gson.toJson(results)); }