Exemplo n.º 1
0
  int internalAddRow(SqlStatement stmt, int column) throws SQLException {
    RolapMember member = null;
    if (getCurrMember() != null) {
      member = getCurrMember();
    } else {
      boolean checkCacheStatus = true;
      final List<SqlStatement.Accessor> accessors = stmt.getAccessors();
      for (int i = 0; i <= levelDepth; i++) {
        RolapLevel childLevel = levels[i];
        if (childLevel.isAll()) {
          member = memberBuilder.allMember();
          continue;
        }

        if (childLevel.isParentChild()) {
          column++;
        }

        Object value = accessors.get(column++).get();
        if (value == null) {
          value = RolapUtil.sqlNullValue;
        }
        Object captionValue;
        if (childLevel.hasCaptionColumn()) {
          captionValue = accessors.get(column++).get();
        } else {
          captionValue = null;
        }
        RolapMember parentMember = member;
        Object key = cache.makeKey(parentMember, value);
        member = cache.getMember(key, checkCacheStatus);
        checkCacheStatus = false; /* Only check the first time */
        if (member == null) {
          if (constraint instanceof RolapNativeCrossJoin.NonEmptyCrossJoinConstraint
              && childLevel.isParentChild()) {
            member = castToNonEmptyCJConstraint(constraint).findMember(value);
          }
          if (member == null) {
            member =
                memberBuilder.makeMember(
                    parentMember, childLevel, value, captionValue, parentChild, stmt, key, column);
          }
        }

        // Skip over the columns consumed by makeMember
        if (!childLevel.getOrdinalExp().equals(childLevel.getKeyExp())) {
          ++column;
        }
        column += childLevel.getProperties().length;
      }
      setCurrMember(member);
    }
    getList().add(member);
    return column;
  }
Exemplo n.º 2
0
 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;
 }