Esempio n. 1
0
 /**
  * Creates a <code>RestrictedMemberReader</code>.
  *
  * <p>There's no filtering to be done unless either the role has restrictions on this hierarchy,
  * or the hierarchy is ragged; there's a pre-condition to this effect.
  *
  * @param memberReader Underlying (presumably unrestricted) member reader
  * @param role Role whose access profile to obey. The role must have restrictions on this
  *     hierarchy
  * @pre role.getAccessDetails(memberReader.getHierarchy()) != null ||
  *     memberReader.getHierarchy().isRagged()
  */
 RestrictedMemberReader(MemberReader memberReader, Role role) {
   super(memberReader);
   RolapHierarchy hierarchy = memberReader.getHierarchy();
   ragged = hierarchy.isRagged();
   if (role.getAccessDetails(hierarchy) == null) {
     assert ragged;
     hierarchyAccess = RoleImpl.createAllAccess(hierarchy);
   } else {
     hierarchyAccess = role.getAccessDetails(hierarchy);
   }
 }
Esempio n. 2
0
  private void clearCache(RolapCube cube) {
    // Clear the cache for the Sales cube, so the query runs as if
    // for the first time. (TODO: Cleaner way to do this.)
    final Cube salesCube = getConnection().getSchema().lookupCube("Sales", true);
    RolapHierarchy hierarchy =
        (RolapHierarchy)
            salesCube.lookupHierarchy(new Id.NameSegment("Store", Id.Quoting.UNQUOTED), false);
    SmartMemberReader memberReader = (SmartMemberReader) hierarchy.getMemberReader();
    MemberCacheHelper cacheHelper = memberReader.cacheHelper;
    cacheHelper.mapLevelToMembers.cache.clear();
    cacheHelper.mapMemberToChildren.cache.clear();

    // Flush the cache, to ensure that the query gets executed.
    cube.clearCachedAggregations(true);

    CacheControl cacheControl = getConnection().getCacheControl(null);
    final CacheControl.CellRegion measuresRegion = cacheControl.createMeasuresRegion(cube);
    cacheControl.flush(measuresRegion);
  }
Esempio n. 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;
      }
    }