Examples of CellDataSet


Examples of org.saiku.olap.dto.resultset.CellDataSet

  }

  @NotNull
  public static CellDataSet cellSet2Matrix(@Nullable final CellSet cellSet, @NotNull ICellSetFormatter formatter) {
    if (cellSet == null) {
      return new CellDataSet(0, 0);
    }
    final Matrix matrix = formatter.format(cellSet);
    final CellDataSet cds = new CellDataSet(matrix.getMatrixWidth(), matrix.getMatrixHeight());

    int z = 0;
    final AbstractBaseCell[][] bodyvalues =
        new AbstractBaseCell[matrix.getMatrixHeight() - matrix.getOffset()][matrix
            .getMatrixWidth()];
    for (int y = matrix.getOffset(); y < matrix.getMatrixHeight(); y++) {

      for (int x = 0; x < matrix.getMatrixWidth(); x++) {
        bodyvalues[z][x] = matrix.get(x, y);
      }
      z++;
    }

    cds.setCellSetBody(bodyvalues);

    final AbstractBaseCell[][] headervalues = new AbstractBaseCell[matrix.getOffset()][matrix.getMatrixWidth()];
    for (int y = 0; y < matrix.getOffset(); y++) {
      for (int x = 0; x < matrix.getMatrixWidth(); x++) {
        headervalues[y][x] = matrix.get(x, y);
      }
    }
    cds.setCellSetHeaders(headervalues);
    cds.setOffset(matrix.getOffset());
    return cds;

  }
View Full Code Here

Examples of org.saiku.olap.dto.resultset.CellDataSet

    QueryContext qc = getContext(query);
    ThinQuery tq = qc.getOlapQuery();
    CellSet cs = qc.getOlapResult();
    String formatterName = StringUtils.isBlank(format) ? "" : format.toLowerCase();
    ICellSetFormatter cf = cff.forName(formatterName);
    CellDataSet result = OlapResultSetUtil.cellSet2Matrix(cs, cf);

    if (ThinQuery.Type.QUERYMODEL.equals(tq.getType()) && cf instanceof FlattenedCellSetFormatter && tq
        .hasAggregators()) {
      calculateTotals(tq, result, cs, cf);
    }
View Full Code Here

Examples of org.saiku.olap.dto.resultset.CellDataSet

      Long start = new Date().getTime();
      CellSet cellSet = executeInternalQuery(tq);
      String runId = "RUN#:" + ID_GENERATOR.get();
      Long exec = new Date().getTime();

      CellDataSet result = OlapResultSetUtil.cellSet2Matrix(cellSet, formatter);
      Long format = new Date().getTime();

      if (ThinQuery.Type.QUERYMODEL.equals(tq.getType()) && formatter instanceof FlattenedCellSetFormatter && tq
          .hasAggregators()) {
        calculateTotals(tq, result, cellSet, formatter);
      }
      Long totals = new Date().getTime();
      LOG.info(runId + "\tSize: " + result.getWidth() + "/" + result.getHeight() + "\tExecute:\t" + (exec - start)
               + "ms\tFormat:\t" + (format - exec) + "ms\tTotals:\t" + (totals - format) + "ms\t Total: " + (totals
                                                                                                             - start)
               + "ms");

      result.setRuntime(new Double(format - start).intValue());
      return result;
    } catch (Exception e) {
      throw new SaikuServiceException("Can't execute query: " + tq.getName(), e);
    } catch (Error e) {
      throw new SaikuServiceException("Can't execute query: " + tq.getName(), e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.