Package org.saiku.olap.query2

Examples of org.saiku.olap.query2.ThinHierarchy


      @PathParam("queryname") String queryName,
      @FormParam("json") String jsonFormParam,
      @FormParam("file") String fileFormParam,
      MultivaluedMap<String, String> formParams) throws ServletException {
    try {
      ThinQuery tq = null;
      String file = fileFormParam;
      String json = jsonFormParam;
      if (formParams != null) {
        json = formParams.containsKey("json") ? formParams.getFirst("json") : jsonFormParam;
        file = formParams.containsKey("file") ? formParams.getFirst("file") : fileFormParam;
      }
      String filecontent = null;
      if (StringUtils.isNotBlank(json)) {
        filecontent = json;
      } else if (StringUtils.isNotBlank(file)) {
        Response f = repository.getResource(file);
        filecontent = new String((byte[]) f.getEntity());
      }
      if (StringUtils.isBlank(filecontent)) {
        throw new SaikuServiceException(
            "Cannot create new query. Empty file content " + StringUtils.isNotBlank(json) + " or read from file:"
            + file);
      }
      if (thinQueryService.isOldQuery(filecontent)) {
        tq = thinQueryService.convertQuery(filecontent);
      } else {
        ObjectMapper om = new ObjectMapper();
        tq = om.readValue(filecontent, ThinQuery.class);
      }

      if (LOG.isDebugEnabled()) {
        LOG.debug("TRACK\t" + "\t/query/" + queryName + "\tPOST\t tq:" + (tq == null) + " file:" + file);
      }

      if (tq == null) {
        throw new SaikuServiceException("Cannot create blank query (ThinQuery object = null)");
      }
      tq.setName(queryName);

      //SaikuCube cube = tq.getCube();
      //if (StringUtils.isNotBlank(xml)) {
      //String query = ServletUtil.replaceParameters(formParams, xml);
      //return thinQueryService.createNewOlapQuery(queryName, query);
View Full Code Here


        rsc.setRuntime(runtime.intValue());
        return rsc;
      }

      QueryResult qr = RestUtil.convert(thinQueryService.execute(tq));
      ThinQuery tqAfter = thinQueryService.getContext(tq.getName()).getOlapQuery();
      qr.setQuery(tqAfter);
      return qr;
    } catch (Exception e) {
      LOG.error("Cannot execute query (" + tq + ")", e);
      String error = ExceptionUtils.getRootCauseMessage(e);
View Full Code Here

  @POST
  @Consumes({ "application/json" })
  @Path("/enrich")
  public ThinQuery enrich(ThinQuery tq) {
    try {
      ThinQuery tqAfter = thinQueryService.updateQuery(tq);
      return tqAfter;
    } catch (Exception e) {
      LOG.error("Cannot enrich query (" + tq + ")", e);
      String error = ExceptionUtils.getRootCauseMessage(e);
      throw new WebApplicationException(Response.serverError().entity(error).build());
View Full Code Here

            }
            realPositions.add(cellPosition);
          }
        }
      }
      ThinQuery tq = thinQueryService.zoomIn(queryName, realPositions);
      return tq;

    } catch (Exception e) {
      LOG.error("Cannot zoom in on query (" + queryName + ")", e);
      throw new WebApplicationException(e);
View Full Code Here

      @PathParam("queryname") String queryname,
      @QueryParam("format") String format,
      @QueryParam("css") @DefaultValue("false") Boolean css,
      @QueryParam("tableonly") @DefaultValue("false") Boolean tableonly,
      @QueryParam("wrapcontent") @DefaultValue("true") Boolean wrapcontent) {
    ThinQuery tq = thinQueryService.getContext(queryname).getOlapQuery();
    return exportHtml(tq, format, css, tableonly, wrapcontent);
  }
View Full Code Here

      }
      ObjectMapper mapper = new ObjectMapper();
      Map<String, List<String>> levels = mapper.readValue(returns, TypeFactory
          .mapType(Map.class, TypeFactory.fromClass(String.class),
              TypeFactory.collectionType(ArrayList.class, String.class)));
      ThinQuery q = thinQueryService.drillacross(queryName, cellPosition, levels);
      return q;

    } catch (Exception e) {
      LOG.error("Cannot execute query (" + queryName + ")", e);
      String error = ExceptionUtils.getRootCauseMessage(e);
View Full Code Here

      String queryName = UUID.randomUUID().toString();
      //fileContent = ServletUtil.replaceParameters(servletRequest, fileContent);
//queryResource.createQuery(queryName,  null,  null, null, fileContent, queryName, null);
//queryResource.execute(queryName, formatter, 0);
      Map<String, String> parameters = ServletUtil.getParameters(servletRequest);
      ThinQuery tq = query2Resource.createQuery(queryName, fileContent, null, null);
      if (parameters != null) {
        tq.getParameters().putAll(parameters);
      }
      query2Resource.execute(tq);
      return query2Resource.getQueryExcelExport(queryName, formatter);
    } catch (Exception e) {
      LOG.error("Error exporting XLS for file: " + file, e);
View Full Code Here

      //fileContent = ServletUtil.replaceParameters(servletRequest, fileContent);
      String queryName = UUID.randomUUID().toString();
//query2Resource.createQuery(null,  null,  null, null, fileContent, queryName, null);
//query2Resource.execute(queryName,formatter, 0);
      Map<String, String> parameters = ServletUtil.getParameters(servletRequest);
      ThinQuery tq = query2Resource.createQuery(queryName, fileContent, null, null);
      if (parameters != null) {
        tq.getParameters().putAll(parameters);
      }
      query2Resource.execute(tq);
      return query2Resource.getQueryCsvExport(queryName);
    } catch (Exception e) {
      LOG.error("Error exporting CSV for file: " + file, e);
View Full Code Here

      fileContent = ServletUtil.replaceParameters(servletRequest, fileContent);
      String queryName = UUID.randomUUID().toString();
//query2Resource.createQuery(null,  null,  null, null, fileContent, queryName, null);
//QueryResult qr = query2Resource.execute(queryName, formatter, 0);
      Map<String, String> parameters = ServletUtil.getParameters(servletRequest);
      ThinQuery tq = query2Resource.createQuery(queryName, fileContent, null, null);
      if (parameters != null) {
        tq.getParameters().putAll(parameters);
      }
      QueryResult qr = query2Resource.execute(tq);
      return Response.ok().entity(qr).build();
    } catch (Exception e) {
      LOG.error("Error exporting JSON for file: " + file, e);
View Full Code Here

  @Deprecated
  public ThinQuery createEmpty(String name, SaikuCube cube) {
    try {
      Cube cub = olapDiscoverService.getNativeCube(cube);
      Query query = new Query(name, cub);
      ThinQuery tq = Thin.convert(query, cube);
      return tq;

    } catch (Exception e) {
      LOG.error("Cannot create new query for cube :" + cube, e);
    }
View Full Code Here

TOP

Related Classes of org.saiku.olap.query2.ThinHierarchy

Copyright © 2018 www.massapicom. 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.