use of mondrian.rolap.RestrictedMemberReader.MultiCardinalityDefaultMember in project mondrian by pentaho.
the class SqlConstraintUtils method getRoleConstraintMembers.
public static Map<Level, List<RolapMember>> getRoleConstraintMembers(SchemaReader schemaReader, Member[] members) {
// LinkedHashMap keeps insert-order
Map<Level, List<RolapMember>> roleMembers = new LinkedHashMap<Level, List<RolapMember>>();
Role role = schemaReader.getRole();
for (Member member : members) {
if (member instanceof LimitedRollupMember || member instanceof MultiCardinalityDefaultMember) {
// iterate relevant levels to get accessible members
List<Level> hierarchyLevels = schemaReader.getHierarchyLevels(member.getHierarchy());
for (Level affectedLevel : hierarchyLevels) {
List<RolapMember> slicerMembers = new ArrayList<RolapMember>();
boolean hasCustom = false;
List<Member> availableMembers = schemaReader.getLevelMembers(affectedLevel, false);
for (Member availableMember : availableMembers) {
if (!availableMember.isAll()) {
slicerMembers.add((RolapMember) availableMember);
}
hasCustom |= role.getAccess(availableMember) == Access.CUSTOM;
}
if (!slicerMembers.isEmpty()) {
roleMembers.put(affectedLevel, slicerMembers);
}
if (!hasCustom) {
// we don't have partial access, no need to go deeper
break;
}
}
}
}
return roleMembers;
}
Aggregations