Package org.saiku.web.rest.objects.resultset

Examples of org.saiku.web.rest.objects.resultset.QueryResult


    // Move a dimension
    qs.moveDimension("TestQuery1", "ROWS", "Store", -1);
    qs.moveDimension("TestQuery1", "COLUMNS", "Time", -1);

    // Execute the query.
    QueryResult output = qs.execute("TestQuery1");

    // Make sure output is not null.
    assertNotNull(output);

    // Check a cell value
    Cell[] cellarray = output.getCellset().get(0);
    assertEquals("1997", cellarray[1].getValue());
  }
View Full Code Here


    qs.transformQm2Mdx("TestQuery1");

    // Execute the query.
    Long start = (new Date()).getTime();
    QueryResult output = qs.executeMdx("TestQuery1", "flattened",
        "SELECT "
        + "NON EMPTY {Hierarchize({[Measures].[Profit]})} ON COLUMNS, "
        + "NON EMPTY {Hierarchize({[Product].[Product Name].Members})} ON ROWS "
        + "FROM [Sales]");
View Full Code Here

  public QueryResult execute(ThinQuery tq) {
    try {
      if (thinQueryService.isMdxDrillthrough(tq)) {
        Long start = (new Date()).getTime();
        ResultSet rs = thinQueryService.drillthrough(tq);
        QueryResult rsc = RestUtil.convert(rs);
        rsc.setQuery(tq);
        Long runtime = (new Date()).getTime() - start;
        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);
      return new QueryResult(error);
    }
  }
View Full Code Here

      @QueryParam("position") String position,
      @QueryParam("returns") String returns) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("TRACK\t" + "\t/query/" + queryName + "/drillthrough\tGET");
    }
    QueryResult rsc;
    ResultSet rs = null;
    try {
      Long start = (new Date()).getTime();
      if (position == null) {
        rs = thinQueryService.drillthrough(queryName, maxrows, returns);
      } else {
        String[] positions = position.split(":");
        List<Integer> cellPosition = new ArrayList<Integer>();

        for (String p : positions) {
          Integer pInt = Integer.parseInt(p);
          cellPosition.add(pInt);
        }

        rs = thinQueryService.drillthrough(queryName, cellPosition, maxrows, returns);
      }
      rsc = RestUtil.convert(rs);
      Long runtime = (new Date()).getTime() - start;
      rsc.setRuntime(runtime.intValue());

    } catch (Exception e) {
      LOG.error("Cannot execute query (" + queryName + ")", e);
      String error = ExceptionUtils.getRootCauseMessage(e);
      rsc = new QueryResult(error);

    } finally {
      if (rs != null) {
        Statement statement = null;
        Connection con = null;
View Full Code Here

      @PathParam("format") String format,
      @FormParam("svg") @DefaultValue("") String svg) {

    try {
      CellDataSet cs = thinQueryService.getFormattedResult(queryName, format);
      QueryResult qr = RestUtil.convert(cs);
      PdfReport pdf = new PdfReport();
      byte[] doc = pdf.pdf(qr, svg);
      return Response.ok(doc).type("application/pdf").header(
          "content-disposition",
          "attachment; filename = export.pdf").header(
View Full Code Here

      if (StringUtils.isNotBlank(format)) {
        cs = thinQueryService.execute(tq, format);
      } else {
        cs = thinQueryService.execute(tq);
      }
      QueryResult qr = RestUtil.convert(cs);
      String content = JSConverter.convertToHtml(qr, wrapcontent);
      String html = "";
      if (!tableonly) {
        html += "<!DOCTYPE html><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
        if (css) {
View Full Code Here

      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);
      return Response.serverError().entity(e.getMessage()).status(Status.INTERNAL_SERVER_ERROR).build();
    }
View Full Code Here

      }
    } catch (SQLException e) {
      LOG.error("SQL Exception", e);
    }

    return new QueryResult(rows, 0, width, height);
  }
View Full Code Here

    for (int i = 0; i < body.length && (limit == 0 || i < limit); i++) {
      AbstractBaseCell[] row = body[i];
      rows.add(convert(row, Cell.Type.ROW_HEADER));
    }

    QueryResult qr = new QueryResult(rows, cellSet);
    return qr;

  }
View Full Code Here

      CellDataSet cs = olapQueryService.execute(queryName);
      return RestUtil.convert(cs, limit);
    } catch (Exception e) {
      LOG.error("Cannot execute query (" + queryName + ")", e);
      String error = ExceptionUtils.getRootCauseMessage(e);
      return new QueryResult(error);
    }
  }
View Full Code Here

TOP

Related Classes of org.saiku.web.rest.objects.resultset.QueryResult

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.