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);
 }
예제 #2
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;
   }
 }
예제 #3
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;
      }
    }