本文整理汇总了Java中mondrian.olap.Result.getAxes方法的典型用法代码示例。如果您正苦于以下问题:Java Result.getAxes方法的具体用法?Java Result.getAxes怎么用?Java Result.getAxes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mondrian.olap.Result
的用法示例。
在下文中一共展示了Result.getAxes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import mondrian.olap.Result; //导入方法依赖的package包/类
protected Result run() {
getConnection().getCacheControl(null).flushSchemaCache();
IntegerProperty monLimit =
MondrianProperties.instance().ResultLimit;
int oldLimit = monLimit.get();
try {
monLimit.set(this.resultLimit);
Result result = executeQuery(query, con);
// Check the number of positions on the last axis, which is
// the ROWS axis in a 2 axis query.
int numAxes = result.getAxes().length;
Axis a = result.getAxes()[numAxes - 1];
final int positionCount = a.getPositions().size();
assertEquals(rowCount, positionCount);
return result;
} finally {
monLimit.set(oldLimit);
}
}
示例2: testNonEmptyUnionQuery
import mondrian.olap.Result; //导入方法依赖的package包/类
public void testNonEmptyUnionQuery() {
Result result = executeQuery(
"select {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} on columns,\n"
+ " NON EMPTY Hierarchize(\n"
+ " Union(\n"
+ " Crossjoin(\n"
+ " Crossjoin([Gender].[All Gender].children,\n"
+ " [Marital Status].[All Marital Status].children),\n"
+ " Crossjoin([Customers].[All Customers].children,\n"
+ " [Product].[All Products].children) ),\n"
+ " Crossjoin({([Gender].[All Gender].[M], [Marital Status].[All Marital Status].[M])},\n"
+ " Crossjoin(\n"
+ " [Customers].[All Customers].[USA].children,\n"
+ " [Product].[All Products].children) ) )) on rows\n"
+ "from Sales where ([Time].[1997])");
final Axis rowsAxis = result.getAxes()[1];
Assert.assertEquals(21, rowsAxis.getPositions().size());
}
示例3: JRMondrianResult
import mondrian.olap.Result; //导入方法依赖的package包/类
public JRMondrianResult(Result result)
{
this.result = result;
JRMondrianFactory factory = new JRMondrianFactory();
Query query = result.getQuery();
Axis[] resultAxes = result.getAxes();
axes = new JRMondrianAxis[resultAxes.length];
for (int i = 0; i < resultAxes.length; i++)
{
AxisOrdinal ordinal = AxisOrdinal.StandardAxisOrdinal.forLogicalOrdinal(i);
axes[i] = new JRMondrianAxis(resultAxes[i], query.getMdxHierarchiesOnAxis(ordinal), factory);
}
}
示例4: testVirtualCubeMeasureCaption
import mondrian.olap.Result; //导入方法依赖的package包/类
/**
* Test case for bug <a href="http://jira.pentaho.com/browse/MONDRIAN-352">
* MONDRIAN-352, "Caption is not set on RolapVirtualCubeMesure"</a>.
*/
public void testVirtualCubeMeasureCaption() {
TestContext testContext = TestContext.instance().create(
null,
"<Cube name=\"TestStore\">\n"
+ " <Table name=\"store\"/>\n"
+ " <Dimension name=\"HCB\" caption=\"Has coffee bar caption\">\n"
+ " <Hierarchy hasAll=\"true\">\n"
+ " <Level name=\"Has coffee bar\" column=\"coffee_bar\" uniqueMembers=\"true\"\n"
+ " type=\"Boolean\"/>\n"
+ " </Hierarchy>\n"
+ " </Dimension>\n"
+ " <Measure name=\"Store Sqft\" caption=\"Store Sqft Caption\" column=\"store_sqft\" aggregator=\"sum\" formatString=\"#,###\"/>\n"
+ "</Cube>\n",
"<VirtualCube name=\"VirtualTestStore\">\n"
+ " <VirtualCubeDimension cubeName=\"TestStore\" name=\"HCB\"/>\n"
+ " <VirtualCubeMeasure cubeName=\"TestStore\" name=\"[Measures].[Store Sqft]\"/>\n"
+ "</VirtualCube>",
null,
null,
null);
Result result = testContext.executeQuery(
"select {[Measures].[Store Sqft]} ON COLUMNS,"
+ "{[HCB]} ON ROWS "
+ "from [VirtualTestStore]");
Axis[] axes = result.getAxes();
List<Position> positions = axes[0].getPositions();
Member m0 = positions.get(0).get(0);
String caption = m0.getCaption();
assertEquals("Store Sqft Caption", caption);
}
示例5: outputFlattenedRecurse
import mondrian.olap.Result; //导入方法依赖的package包/类
private static void outputFlattenedRecurse(
Result result,
List<List<Object>> rows,
List<Object> rowValues,
int[] coords,
int axisOrdinal)
{
final Axis[] axes = result.getAxes();
if (axisOrdinal == axes.length) {
final Cell cell = result.getCell(coords);
// Output the raw (unformatted) value of the cell.
// NOTE: We could output other properties of the cell here, such as its
// formatted value, too.
rowValues.add(cell.getValue());
// Add a copy of the completed row to the list of rows.
rows.add(new ArrayList<Object>(rowValues));
} else {
final Axis axis = axes[axisOrdinal];
int k = -1;
int saveLength = rowValues.size();
for (Position position : axis.getPositions()) {
coords[axisOrdinal] = ++k;
for (Member member : position) {
rowValues.add(member.getUniqueName());
}
outputFlattenedRecurse(
result, rows, rowValues, coords, axisOrdinal + 1);
while (rowValues.size() > saveLength) {
rowValues.remove(rowValues.size() - 1);
}
}
}
}
示例6: outputFlattenedRecurse
import mondrian.olap.Result; //导入方法依赖的package包/类
private static void outputFlattenedRecurse( Result result, List<List<Object>> rows, List<Object> rowValues,
int[] coords, int axisOrdinal ) {
final Axis[] axes = result.getAxes();
if ( axisOrdinal == axes.length ) {
final Cell cell = result.getCell( coords );
// Output the raw (unformatted) value of the cell.
// NOTE: We could output other properties of the cell here, such as its
// formatted value, too.
rowValues.add( cell.getValue() );
// Add a copy of the completed row to the list of rows.
rows.add( new ArrayList<>( rowValues ) );
} else {
final Axis axis = axes[axisOrdinal];
int k = -1;
int saveLength = rowValues.size();
for ( Position position : axis.getPositions() ) {
coords[axisOrdinal] = ++k;
for ( Member member : position ) {
rowValues.add( member.getUniqueName() );
}
outputFlattenedRecurse( result, rows, rowValues, coords, axisOrdinal + 1 );
while ( rowValues.size() > saveLength ) {
rowValues.remove( rowValues.size() - 1 );
}
}
}
}