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 ); } } } }
mondrian.olap.Util.PropertyList propList = new mondrian.olap.Util.PropertyList(); propList.put( "Provider", "mondrian" ); propList.put( "Catalog", space.environmentSubstitute( catalog ) ); propList.put( "Role", realRole ); connection = DriverManager.getConnection( propList, null, dataSource ); } else { connection = DriverManager.getConnection( connectString, null ); query = connection.parseQuery( queryString ); result = connection.execute( query );
final Axis[] axes = result.getAxes(); if ( axes.length != 2 ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "MondrianInputErrorOnlyTabular" ) ); for ( Position rowPos : rowsAxis.getPositions() ) { ++rowOrdinal; coords[1] = rowOrdinal; headings.add( rowMember.getHierarchy().getUniqueName() ); for ( Position columnPos : columnsAxis.getPositions() ) { String heading = ""; for ( Member columnMember : columnPos ) { heading += ", "; heading += columnMember.getUniqueName(); rowValues.add( rowMember.getUniqueName() ); for ( int columnOrdinal = 0; columnOrdinal < columnsAxis.getPositions().size(); ++columnOrdinal ) { coords[0] = columnOrdinal; final Cell cell = result.getCell( coords ); rowValues.add( cell.getValue() );
final Axis[] axes = result.getAxes(); rows = new ArrayList<>(); headings = new ArrayList<>(); final List<Position> positions = axis.getPositions(); if ( positions.isEmpty() ) { Hierarchy hierarchy = member.getHierarchy(); headings.add( hierarchy.getUniqueName() );
private String getUniqueNameWithoutAll(Member member) { // build unique string Member parentMember = member.getParentMember(); if ((parentMember != null) && !parentMember.isAll()) { return Util.makeFqName( getUniqueNameWithoutAll(parentMember), member.getName()); } else { return Util.makeFqName(member.getHierarchy(), member.getName()); } }
Member memberParent(Evaluator evaluator, Member member) { Member parent = evaluator.getSchemaReader().getMemberParent(member); if (parent == null) { parent = member.getHierarchy().getNullMember(); } return parent; } });
/** * Creates an element which represents all access to a hierarchy. * * @param hierarchy Hierarchy * @return element representing all access to a given hierarchy */ public static HierarchyAccess createAllAccess(Hierarchy hierarchy) { return new HierarchyAccessImpl( Util.createRootRole(hierarchy.getDimension().getSchema()), hierarchy, Access.ALL, null, null, Role.RollupPolicy.FULL); }
public Dimension getDimension(Schema schema) { Util.assertPrecondition(schema != null, "schema != null"); if (cubeName == null) { return schema.getPublicDimension(name); } else { Cube cube = schema.getCube(cubeName); return cube.getDimension(schema, name); } } // END pass-through code block ---
private Hierarchy getHierarchyWithDefaultName() { for ( Hierarchy hierarchy : dimension.getHierarchies() ) { if ( Util.equalName( hierarchy.getName(), dimension.getName() ) ) { return hierarchy; } } return null; }
/** * Returns the description associated with an ordinal; the return value * is null if the ordinal is not a member of the enumeration. * * @pre isImmutable() */ public final String getDescription(int ordinal) { Util.assertPrecondition(isImmutable()); final Value value = ordinalToValueMap[ordinal - min]; return (value == null) ? null : value.getDescription(); }
public static String getParameterName(Exp[] args) { if (args[0] instanceof Literal && args[0].getCategory() == Category.String) { return (String) ((Literal) args[0]).getValue(); } else { throw Util.newInternal("Parameter name must be a string constant"); } }
/** * Returns the name associated with an ordinal; the return value * is null if the ordinal is not a member of the enumeration. * * @pre isImmutable() */ public final String getName(int ordinal) { Util.assertPrecondition(isImmutable()); final Value value = ordinalToValueMap[ordinal - min]; return (value == null) ? null : value.getName(); }
public OlapElement lookupChild( OlapElement parent, IdentifierSegment segment) { // Only look for calculated members and named sets defined in the // query. for (Formula formula : query.getFormulas()) { if (NameResolver.matches(formula, parent, segment)) { return formula.getElement(); } } return null; }
public Object clone() { return new Formula( isMember, id, exp.clone(), MemberProperty.cloneArray(memberProperties), mdxMember, mdxSet); }
/** * Create an enumeration, initializes it with arrays of code/name pairs, * and freezes it. */ public EnumeratedValues(String[] names, int[] codes, String[] descriptions) { for (int i = 0; i < names.length; i++) { register((V) new BasicValue(names[i], codes[i], descriptions[i])); } makeImmutable(); }
private boolean isBottomLeveRestricted() { for (HierarchyAccess hierarchyAccess : list) { if (hierarchyAccess.getBottomLevelDepth() == hierarchy.getLevels().length) { return true; } } return false; } }
/** * Registers all arguments of a function that are named sets. * * @param call Function call */ private void registerAliasArgs(FunCall call) { for (Exp exp : call.getArgs()) { registerAlias((QueryPart) call, exp); } }
public TupleIterable evaluateIterable( Evaluator evaluator) { final Evaluator.NamedSetEvaluator namedSetEvaluator = evaluator.getNamedSetEvaluator(scopedNamedSet, false); return namedSetEvaluator.evaluateTupleIterable(evaluator); } };