Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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;
     }
   }
 }
 public MemberChildrenConstraint getChildByNameConstraint(
     RolapMember parent, Id.Segment childName) {
   // Ragged hierarchies span multiple levels, so SQL WHERE does not work
   // there
   if (!enabled || parent.getHierarchy().isRagged()) {
     return DefaultMemberChildrenConstraint.instance();
   }
   return new ChildByNameConstraint(childName);
 }
Esempio n. 4
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;
 }
Esempio n. 5
0
 /**
  * Returns the scenario inside a calculated member in the scenario dimension. For example, applied
  * to [Scenario].[1], returns the Scenario object representing scenario #1.
  *
  * @param member Wrapper member
  * @return Wrapped scenario
  */
 static Scenario forMember(final RolapMember member) {
   if (isScenario(member.getHierarchy())) {
     final Formula formula = ((RolapCalculatedMember) member).getFormula();
     final ResolvedFunCall resolvedFunCall = (ResolvedFunCall) formula.getExpression();
     final Calc calc = resolvedFunCall.getFunDef().compileCall(null, null);
     return ((ScenarioCalc) calc).getScenario();
   } else {
     return null;
   }
 }
Esempio n. 6
0
    /**
     * Creates a WritebackCell.
     *
     * @param cube Cube
     * @param members Members that form context
     * @param constrainedColumnsBitKey Bitmap of columns which have values
     * @param keyValues List of values, by bit position
     * @param newValue New value
     * @param currentValue Current value
     * @param allocationPolicy Allocation policy
     */
    WritebackCell(
        RolapCube cube,
        List<RolapMember> members,
        BitKey constrainedColumnsBitKey,
        Object[] keyValues,
        double newValue,
        double currentValue,
        AllocationPolicy allocationPolicy) {
      assert keyValues.length == constrainedColumnsBitKey.cardinality();
      Util.discard(cube); // not used currently
      Util.discard(constrainedColumnsBitKey); // not used currently
      Util.discard(keyValues); // not used currently
      this.newValue = newValue;
      this.currentValue = currentValue;
      this.allocationPolicy = allocationPolicy;
      this.atomicCellCount = computeAtomicCellCount(cube, members);

      // Build the array of members by ordinal. If a member is not
      // specified for a particular dimension, use the 'all' member (not
      // necessarily the same as the default member).
      final List<RolapHierarchy> hierarchyList = cube.getHierarchies();
      this.membersByOrdinal = new Member[hierarchyList.size()];
      for (int i = 0; i < membersByOrdinal.length; i++) {
        membersByOrdinal[i] = hierarchyList.get(i).getDefaultMember();
      }
      for (RolapMember member : members) {
        final RolapHierarchy hierarchy = member.getHierarchy();
        if (isScenario(hierarchy)) {
          assert member.isAll();
        }
        // REVIEW The following works because Measures is the only
        // dimension whose members do not belong to RolapCubeDimension,
        // just a regular RolapDimension, but has ordinal 0.
        final int ordinal = hierarchy.getOrdinalInCube();
        membersByOrdinal[ordinal] = member;
      }
    }
Esempio n. 7
0
 public RolapMember getLeadMember(RolapMember member, int n) {
   int i = 0;
   int increment = 1;
   if (n < 0) {
     increment = -1;
     n = -n;
   }
   while (i < n) {
     member = memberReader.getLeadMember(member, increment);
     if (member.isNull()) {
       return member;
     }
     if (canSee(member)) {
       ++i;
     }
   }
   return member;
 }