当前位置: 首页>>代码示例>>Java>>正文


Java CellSet类代码示例

本文整理汇总了Java中org.olap4j.CellSet的典型用法代码示例。如果您正苦于以下问题:Java CellSet类的具体用法?Java CellSet怎么用?Java CellSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CellSet类属于org.olap4j包,在下文中一共展示了CellSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseResult

import org.olap4j.CellSet; //导入依赖的package包/类
/**
 * Parses the result into this class's structure
 * 
 * @param result
 *            The CellSet query result
 */
protected void parseResult(CellSet result) throws JRException
{
	if (log.isDebugEnabled())
	{
		OutputStream bos = new ByteArrayOutputStream();
		CellSetFormatter formatter = new RectangularCellSetFormatter(true);
		formatter.format(result, new PrintWriter(bos, true));
		log.debug("Result:\n" + bos.toString());
	}

	xmlaResult = new JRXmlaResult();
	
	parseAxes(result);

	parseCellDataElement(result);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:Olap4jXmlaQueryExecuter.java

示例2: Olap4jResult

import org.olap4j.CellSet; //导入依赖的package包/类
public Olap4jResult(CellSet cSet)
{
	this.cellSet = cSet;
	
	Olap4jFactory factory = new Olap4jFactory();

	List<CellSetAxis> resultAxes = cellSet.getAxes();
	axes = new Olap4jResultAxis[resultAxes.size()];
	for (int i = 0; i < resultAxes.size(); i++)
	{
		// AxisOrdinal ordinal = AxisOrdinal.StandardAxisOrdinal.forLogicalOrdinal(i);
		axes[i] = new Olap4jResultAxis(cellSet.getAxes().get(i),
				cellSet.getAxes().get(i).getAxisMetaData().getHierarchies(),
				factory);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:17,代码来源:Olap4jResult.java

示例3: execute

import org.olap4j.CellSet; //导入依赖的package包/类
/**
 * Executes a query and returns the result as a string.
 *
 * @param queryString MDX query text
 * @return result String
 */
public String execute(String queryString) {
    if (USE_OLAP4J) {
        return runQuery(
            queryString,
            new Util.Functor1<String, CellSet>() {
                public String apply(CellSet param) {
                    StringWriter stringWriter = new StringWriter();
                    PrintWriter printWriter = new PrintWriter(stringWriter);
                    new RectangularCellSetFormatter(false)
                        .format(param, printWriter);
                    printWriter.flush();
                    return stringWriter.toString();
                }
            });
    }
    Result result = runQuery(queryString, true);
    if (this.options.highCardResults) {
        return highCardToString(result);
    } else {
        return toString(result);
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:29,代码来源:CmdRunner.java

示例4: runQuery

import org.olap4j.CellSet; //导入依赖的package包/类
/**
 * Executes a query and processes the result using a callback.
 *
 * @param queryString MDX query text
 */
public <T> T runQuery(String queryString, Util.Functor1<T, CellSet> f) {
    long start = System.currentTimeMillis();
    OlapConnection connection = null;
    OlapStatement statement = null;
    CellSet cellSet = null;
    try {
        connection = getOlapConnection();
        statement = connection.createStatement();
        debug("CmdRunner.runQuery: AFTER createStatement");
        start = System.currentTimeMillis();
        cellSet = statement.executeOlapQuery(queryString);
        return f.apply(cellSet);
    } catch (SQLException e) {
        throw new RuntimeException(e);
    } finally {
        queryTime = (System.currentTimeMillis() - start);
        totalQueryTime += queryTime;
        debug("CmdRunner.runQuery: BOTTOM");
        Util.close(cellSet, statement, connection);
    }
}
 
开发者ID:OSBI,项目名称:mondrian,代码行数:27,代码来源:CmdRunner.java

示例5: parseAxes

import org.olap4j.CellSet; //导入依赖的package包/类
protected void parseAxes(CellSet result)
{
	// Cycle over AxisInfo-Elements
	Iterator<CellSetAxis> itAxis = result.getAxes().iterator();
	log.debug("# axes: " + result.getAxes().size());
	while (itAxis.hasNext())
	{
		CellSetAxis itAxisElement = itAxis.next();
		Axis axis = itAxisElement.getAxisMetaData().getAxisOrdinal();
		if (axis.axisOrdinal() == Axis.FILTER.axisOrdinal())
		{
			if (log.isDebugEnabled())
			{
				log.debug("skipping filter axis: " + axis.name() + ", ordinal: " + axis.axisOrdinal());
			}
			continue;
		}

		JRXmlaResultAxis xmlaAxis = new JRXmlaResultAxis(axis.name());
		xmlaResult.addAxis(xmlaAxis);
		
		if (log.isDebugEnabled())
		{
			log.debug("adding axis: " + axis.name() + ", ordinal: " + axis.axisOrdinal());
		}
		handleHierInfo(xmlaAxis, itAxisElement.getAxisMetaData());
		
		ListIterator<Position> positionsIt = itAxisElement.iterator();
		while (positionsIt.hasNext())
		{
			Position p = positionsIt.next();
			if (log.isDebugEnabled())
			{
				log.debug("adding pos : " + p.getOrdinal() + ", with member size: " + p.getMembers().size());
			}
			handlePosition(xmlaAxis, itAxisElement, p);	
		}
		
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:41,代码来源:Olap4jXmlaQueryExecuter.java

示例6: closeResultSet

import org.olap4j.CellSet; //导入依赖的package包/类
public static void closeResultSet(CellSet cellSet) throws Exception {
	if (cellSet==null) {
		return;
	}
	if (cellSet.isClosed()) {
		return;
	}
	cellSet.close();
}
 
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:10,代码来源:OlapUtils.java

示例7: updateCellSet

import org.olap4j.CellSet; //导入依赖的package包/类
/**
 * This method will update the cell set in this panel.
 */
private void updateCellSet(final CellSet cellSet) {
    cellSetViewer.updateCellSetViewer(query, cellSet);
    try {
        updateMdxText(query.getMdxText());
    } catch (Exception ex) {
        updateMdxText("Exception thrown while retrieving MDX statement:\n" + ex.getMessage());
        logger.error("Error while retrieving MDX statement", ex);
    }
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:13,代码来源:OlapQueryPanel.java

示例8: getCellSet

import org.olap4j.CellSet; //导入依赖的package包/类
/**
 * This method will block and return the CellSet object as soon as the
 * execution is finished. It is preferable to use {@link ResultSetHandle#isRunning()}
 * or a listener to be notified when the CellSet is ready for use.
 */
public CellSet getCellSet() {
	if (!this.rsType.equals(ResultSetType.OLAP)) {
		throw new UnsupportedOperationException("Cannot obtain a CellSet object from a ResultSetHandle that is not of OLAP type.");
	}
	return this.olapCellSet;
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:12,代码来源:ResultSetHandle.java

示例9: select

import org.olap4j.CellSet; //导入依赖的package包/类
public CellSet select(final IScope scope, final String selectComm) {
	CellSet resultCellSet = null;
	OlapConnection oConn = null;
	try {
		oConn = connectMDB(scope);
		resultCellSet = select(scope, oConn, selectComm);
		oConn.close();
	} catch (final SQLException e) {

	}
	return resultCellSet;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:13,代码来源:MdxConnection.java

示例10: getColumnsName

import org.olap4j.CellSet; //导入依赖的package包/类
protected IList<Object> getColumnsName(final CellSet cellSet) {
	final IList<Object> columnsName = GamaListFactory.create();
	final List<CellSetAxis> cellSetAxes = cellSet.getAxes();
	// get headings.
	final CellSetAxis columnsAxis = cellSetAxes.get(Axis.COLUMNS.axisOrdinal());
	for (final Position position : columnsAxis.getPositions()) {
		final Member measure = position.getMembers().get(0);
		columnsName.add(measure.getName());
	}
	return columnsName;

}
 
开发者ID:gama-platform,项目名称:gama,代码行数:13,代码来源:MdxConnection.java

示例11: getRowsData

import org.olap4j.CellSet; //导入依赖的package包/类
protected IList<Object> getRowsData(final CellSet cellSet) {
	final IList<Object> rowsData = GamaListFactory.create();

	final List<CellSetAxis> cellSetAxes = cellSet.getAxes();
	final CellSetAxis columnsAxis = cellSetAxes.get(Axis.COLUMNS.axisOrdinal());
	final CellSetAxis rowsAxis = cellSetAxes.get(Axis.ROWS.axisOrdinal());
	int cellOrdinal = 0;

	for (final Position rowPosition : rowsAxis.getPositions()) {
		final IList<Object> row = GamaListFactory.create();
		final IList<Object> rowMembers = GamaListFactory.create();
		// get member on each row
		for (final Member member : rowPosition.getMembers()) {
			rowMembers.add(member.getName());
		}
		// get value of the cell in each column.
		final IList<Object> cellValues = GamaListFactory.create();
		for (final Position columnPosition : columnsAxis.getPositions()) {
			// Access the cell via its ordinal. The ordinal is kept in step
			// because we increment the ordinal once for each row and
			// column.
			final Cell cell = cellSet.getCell(cellOrdinal);
			// Just for kicks, convert the ordinal to a list of coordinates.
			// The list matches the row and column positions.
			final List<Integer> coordList = cellSet.ordinalToCoordinates(cellOrdinal);
			assert coordList.get(0) == rowPosition.getOrdinal();
			assert coordList.get(1) == columnPosition.getOrdinal();

			++cellOrdinal;
			cellValues.add(cell.getFormattedValue());
		}
		// Add member and value to row
		row.add(rowMembers);
		row.add(cellValues);
		// Add row to rowsData
		rowsData.add(row);
	}
	return rowsData;

}
 
开发者ID:gama-platform,项目名称:gama,代码行数:41,代码来源:MdxConnection.java

示例12: cellSetToString

import org.olap4j.CellSet; //导入依赖的package包/类
private String cellSetToString( CellSet cellSet ) {
  final ByteArrayOutputStream stream = new ByteArrayOutputStream();
  try {
    final PrintWriter pw = new PrintWriter( stream );
    new TraditionalCellSetFormatter().format( cellSet, pw );
    pw.flush();
  } finally {
    try {
      stream.close();
    } catch ( IOException e ) {
      e.printStackTrace();
    }
  }
  return stream.toString().replaceAll( "\r\n", "\n" );
}
 
开发者ID:pentaho,项目名称:mondrian-tck,代码行数:16,代码来源:MondrianExpectation.java

示例13: MDDataSet_Multidimensional

import org.olap4j.CellSet; //导入依赖的package包/类
protected MDDataSet_Multidimensional(CellSet cellSet, boolean omitDefaultSlicerInfo, boolean json) throws SQLException {
   super(cellSet);
   this.omitDefaultSlicerInfo = omitDefaultSlicerInfo;
   this.json = json;
   this.extra = CustomXmlaHandler.getExtra(cellSet.getStatement().getConnection());

}
 
开发者ID:OpenlinkFinancial,项目名称:MXMLABridge,代码行数:8,代码来源:MDataSet.java

示例14: cellIter

import org.olap4j.CellSet; //导入依赖的package包/类
/**
 * Returns an iterator over cells in a result.
 */
private static Iterable<Cell> cellIter(final int[] pageCoords, final CellSet cellSet) {
    return new Iterable<Cell>() {
        public Iterator<Cell> iterator() {
            final int[] axisDimensions = new int[cellSet.getAxes().size() - pageCoords.length];
            assert pageCoords.length <= axisDimensions.length;
            for (int i = 0; i < axisDimensions.length; i++) {
                final CellSetAxis axis = cellSet.getAxes().get(i);
                axisDimensions[i] = axis.getPositions().size();
            }
            final CoordinateIterator coordIter = new CoordinateIterator(axisDimensions, true);
            return new Iterator<Cell>() {
                public boolean hasNext() {
                    return coordIter.hasNext();
                }

                public Cell next() {
                    final int[] ints = coordIter.next();
                    final AbstractList<Integer> intList = new AbstractList<Integer>() {
                        @Override
                        public Integer get(final int index) {
                            return index < ints.length ? ints[index] : pageCoords[index - ints.length];
                        }

                        @Override
                        public int size() {
                            return pageCoords.length + ints.length;
                        }
                    };
                    return cellSet.getCell(intList);
                }

                public void remove() {
                    throw new UnsupportedOperationException();
                }
            };
        }
    };
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:42,代码来源:CellSetFormatter.java

示例15: format

import org.olap4j.CellSet; //导入依赖的package包/类
public Matrix format(final CellSet cellSet) {
    // Compute how many rows are required to display the columns axis.
    final CellSetAxis columnsAxis;
    if (cellSet.getAxes().size() > 0) {
        columnsAxis = cellSet.getAxes().get(0);
    } else {
        columnsAxis = null;
    }
    final AxisInfo columnsAxisInfo = computeAxisInfo(columnsAxis);

    // Compute how many columns are required to display the rows axis.
    final CellSetAxis rowsAxis;
    if (cellSet.getAxes().size() > 1) {
        rowsAxis = cellSet.getAxes().get(1);
    } else {
        rowsAxis = null;
    }
    final AxisInfo rowsAxisInfo = computeAxisInfo(rowsAxis);

    if (cellSet.getAxes().size() > 2) {
        final int[] dimensions = new int[cellSet.getAxes().size() - 2];
        for (int i = 2; i < cellSet.getAxes().size(); i++) {
            final CellSetAxis cellSetAxis = cellSet.getAxes().get(i);
            dimensions[i - 2] = cellSetAxis.getPositions().size();
        }
        for (final int[] pageCoords : CoordinateIterator.iterate(dimensions)) {
            matrix = formatPage(cellSet, pageCoords, columnsAxis, columnsAxisInfo, rowsAxis, rowsAxisInfo);
        }
    } else {
        matrix = formatPage(cellSet, new int[] {}, columnsAxis, columnsAxisInfo, rowsAxis, rowsAxisInfo);
    }

    return matrix;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:35,代码来源:CellSetFormatter.java


注:本文中的org.olap4j.CellSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。