Search in sources :

Example 1 with MondrianCube

use of org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCube in project pentaho-platform by pentaho.

the class UserConsoleResource method getMondrianCatalogs.

/**
 * Return the list of mondrian cubes in the platform
 *
 * @return list of cubes
 */
@GET
@Path("/cubes")
@Facet(name = "Unsupported")
@Produces({ APPLICATION_JSON, APPLICATION_XML })
public List<Cube> getMondrianCatalogs() {
    ArrayList<Cube> cubes = new ArrayList<Cube>();
    IMondrianCatalogService catalogService = PentahoSystem.get(IMondrianCatalogService.class, "IMondrianCatalogService", UserConsoleService.getPentahoSession());
    List<MondrianCatalog> catalogs = catalogService.listCatalogs(UserConsoleService.getPentahoSession(), true);
    for (MondrianCatalog cat : catalogs) {
        for (MondrianCube cube : cat.getSchema().getCubes()) {
            cubes.add(new Cube(cat.getName(), cube.getName(), cube.getId()));
        }
    }
    return cubes;
}
Also used : MondrianCatalog(org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalog) MondrianCube(org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCube) ArrayList(java.util.ArrayList) MondrianCube(org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCube) IMondrianCatalogService(org.pentaho.platform.plugin.action.mondrian.catalog.IMondrianCatalogService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) Facet(org.codehaus.enunciate.Facet)

Aggregations

ArrayList (java.util.ArrayList)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Facet (org.codehaus.enunciate.Facet)1 IMondrianCatalogService (org.pentaho.platform.plugin.action.mondrian.catalog.IMondrianCatalogService)1 MondrianCatalog (org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalog)1 MondrianCube (org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCube)1