public List<RolapMember> getMembersInLevel( RolapLevel level, int startOrdinal, int endOrdinal, TupleConstraint constraint) { if (hierarchyAccess != null) { final int depth = level.getDepth(); if (depth < hierarchyAccess.getTopLevelDepth()) { return Collections.emptyList(); } if (depth > hierarchyAccess.getBottomLevelDepth()) { return Collections.emptyList(); } } final List<RolapMember> membersInLevel = memberReader.getMembersInLevel(level, startOrdinal, endOrdinal, constraint); List<RolapMember> filteredMembers = new ArrayList<RolapMember>(); filterMembers(membersInLevel, filteredMembers); return filteredMembers; }
public RolapMember getDefaultMember() { RolapMember defaultMember = (RolapMember) getHierarchy().getDefaultMember(); if (defaultMember != null) { Access i = hierarchyAccess.getAccess(defaultMember); if (i != Access.NONE) { return defaultMember; } } return getRootMembers().get(0); }
private boolean canSee(final RolapMember member) { if (ragged && member.isHidden()) { return false; } if (hierarchyAccess != null) { final Access access = hierarchyAccess.getAccess(member); return access != Access.NONE; } return true; }
public RolapMember getMemberParent(RolapMember member) { RolapMember parentMember = member.getParentMember(); // Skip over hidden parents. while (parentMember != null && parentMember.isHidden()) { parentMember = parentMember.getParentMember(); } // Skip over non-accessible parents. if (parentMember != null) { if (hierarchyAccess.getAccess(parentMember) == Access.NONE) { return null; } } return parentMember; }
public List<RolapMember> getRootMembers() { int topLevelDepth = hierarchyAccess.getTopLevelDepth(); if (topLevelDepth > 0) { RolapLevel topLevel = (RolapLevel) getHierarchy().getLevels()[topLevelDepth]; final List<RolapMember> memberList = getMembersInLevel(topLevel, 0, Integer.MAX_VALUE); if (memberList.isEmpty()) { throw MondrianResource.instance() .HierarchyHasNoAccessibleMembers .ex(getHierarchy().getUniqueName()); } return memberList; } return super.getRootMembers(); }
private void processMemberChildren( List<RolapMember> fullChildren, List<RolapMember> children, MemberChildrenConstraint constraint) { // todo: optimize if parentMember is beyond last level List<RolapMember> grandChildren = null; for (int i = 0; i < fullChildren.size(); i++) { RolapMember member = fullChildren.get(i); // If a child is hidden (due to raggedness) include its children. // This must be done before applying access-control. if (ragged) { if (member.isHidden()) { // Replace this member with all of its children. // They might be hidden too, but we'll get to them in due // course. They also might be access-controlled; that's why // we deal with raggedness before we apply access-control. fullChildren.remove(i); if (grandChildren == null) { grandChildren = new ArrayList<RolapMember>(); } else { grandChildren.clear(); } memberReader.getMemberChildren(member, grandChildren, constraint); fullChildren.addAll(i, grandChildren); // Step back to before the first child we just inserted, // and go through the loop again. --i; continue; } } // Filter out children which are invisible because of // access-control. final Access access; if (hierarchyAccess != null) { access = hierarchyAccess.getAccess(member); } else { access = Access.ALL; } switch (access) { case NONE: break; default: children.add(member); break; } } }