/** * Creates a dimension expression. * * @param dimension Dimension * @pre dimension != null */ public DimensionExpr(Dimension dimension) { Util.assertPrecondition(dimension != null, "dimension != null"); this.dimension = dimension; }
/** * Checks that a postcondition (declared using the javadoc * <code>@post</code> tag) is satisfied. * * @param b The value of executing the condition */ public static void assertPostcondition(boolean b) { assertTrue(b); }
private String calcMemberFqName(MondrianDef.CalculatedMember xmlCalcMember) { if (xmlCalcMember.dimension != null) { return Util.makeFqName( Util.quoteMdxIdentifier(xmlCalcMember.dimension), xmlCalcMember.name); } else { return Util.makeFqName( xmlCalcMember.hierarchy, xmlCalcMember.name); } }
public void toString(StringBuilder buf) { switch (quoting) { case UNQUOTED: buf.append(name); return; case QUOTED: Util.quoteMdxIdentifier(name, buf); return; default: throw Util.unexpected(quoting); } }
public Dimension getDimension(Schema schema) { Util.assertPrecondition(schema != null, "schema != null"); for (int i = 0; i < schema.dimensions.length; i++) { if (schema.dimensions[i].name.equals(source)) { return schema.dimensions[i]; } } throw Util.newInternal( "Cannot find shared dimension '" + source + "'"); } // END pass-through code block ---
/** * Creates a non-internal error. Currently implemented in terms of * internal errors, but later we will create resourced messages. */ public static RuntimeException newError(Throwable e, String message) { return newInternal(e, message); }
public static String makeFqName(String name) { return quoteMdxIdentifier(name); }
private <T extends OlapElement> T lookup( RolapCube cube, SchemaReader reader, int category, String id) { List<Id.Segment> segments = Util.parseIdentifier(id); //noinspection unchecked return (T) reader.lookupCompound(cube, segments, true, category); }
List<Id.Segment> uniqueNameParts; if (defaultMemberName.contains("[")) { uniqueNameParts = Util.parseIdentifier(defaultMemberName); } else { uniqueNameParts = defaultMember = (Member) Util.lookupCompound( getRolapSchema().getSchemaReader(), this, defaultMember = (Member) Util.lookupCompound( getRolapSchema().getSchemaReader(), new DummyElement(), throw Util.newInternal( "Can not find Default Member with name \"" + defaultMemberName + "\" in Hierarchy \""
public Exp createCall(Validator validator, Exp[] args) { int[] categories = getParameterCategories(); Util.assertTrue(categories.length == args.length); for (int i = 0; i < args.length; i++) { args[i] = validateArg(validator, args, i, categories[i]); } final Type type = getResultType(validator, args); if (type == null) { throw Util.newInternal("could not derive type"); } return new ResolvedFunCall(this, args, type); }
boolean fail = true; Member member = query.getSchemaReader(true).getMemberByUniqueName( Util.parseIdentifier(memberName), fail); if (true) { throw new UnsupportedOperationException( throw Util.newInternal("unkown operation '" + operation + "'");
return hlevels; List<Id.Segment> segments = Util.parseIdentifier(hierarchy); if (segments == null || segments.size() == 0) { return hlevels; hlevels.add( hierarchy + "." + Util.quoteMdxIdentifier( hierarchyObj.levels[k].name));
Util.parseConnectString(connectString); final List<String> cacheKey = Arrays.asList( Util.discard(entry);
Util.parseConnectString( (String) infos.properties.get("DataSourceInfo")); throw Util.newError("Unknown database '" + databaseName + "'"); datasourceInfo.catalogMap.get(catalogName); if (namedCatalogInfo == null) { throw Util.newError("Unknown catalog '" + catalogName + "'"); throw Util.newError("No suitable connection found");
/** * Creates a connection to a Mondrian OLAP Engine * using a connect string * and a catalog locator. * * @param connectString Connect string of the form * 'property=value;property=value;...'. * See {@link mondrian.olap.Util#parseConnectString} for more details of the format. * See {@link mondrian.rolap.RolapConnectionProperties} for a list of * allowed properties. * @param locator Use to locate real catalog url by a customized * configuration value. If <code>null</code>, leave the catalog url * unchanged. * @return A {@link Connection}, never null */ public static Connection getConnection( String connectString, CatalogLocator locator) { Util.PropertyList properties = Util.parseConnectString(connectString); return getConnection(properties, locator); }
/**Generates rolap star key based on the fact * using fact alias and SQl filter data * if this one is present in the fact * @param fact the fact based on which is generated the rolap star key * @return the rolap star key */ public static List<String> makeRolapStarKey( final MondrianDef.Relation fact) { List<String> rlStarKey = new ArrayList<String>(); MondrianDef.Table table = null; rlStarKey.add(fact.getAlias()); if (fact instanceof MondrianDef.Table) { table = (MondrianDef.Table) fact; } // Add SQL filter to the key if (!Util.isNull(table) && !Util.isNull(table.filter) && !Util.isBlank(table.filter.cdata)) { rlStarKey.add(table.filter.dialect); rlStarKey.add(table.filter.cdata); } return Collections.unmodifiableList(rlStarKey); }
"does not start with '" + CONNECT_STRING_PREFIX + "'"); Util.PropertyList list = Util.parseConnectString(x); final Map<String, String> map = Util.toMap(info); for (Map.Entry<String, String> entry : map.entrySet()) { list.put(entry.getKey(), entry.getValue());
OlapElement element = Util.lookup(query, Util.parseIdentifier(trimmed));
public boolean isHidden() { final RolapLevel rolapLevel = getLevel(); switch (rolapLevel.getHideMemberCondition()) { case Never: return false; case IfBlankName: { // If the key value in the database is null, then we use // a special key value whose toString() is "null". final String name = getName(); return name.equals(RolapUtil.mdxNullLiteral()) || Util.isBlank(name); } case IfParentsName: { final Member parentMember = getParentMember(); if (parentMember == null) { return false; } final String parentName = parentMember.getName(); final String name = getName(); return (parentName == null ? "" : parentName).equals( name == null ? "" : name); } default: throw Util.badValue(rolapLevel.getHideMemberCondition()); } }