Exemplo n.º 1
0
 public boolean removeMember(
     String queryName, String dimensionName, String uniqueMemberName, String selectionType)
     throws SaikuServiceException {
   IQuery query = getIQuery(queryName);
   removeAllChildren(queryName, dimensionName);
   List<IdentifierSegment> memberList =
       IdentifierNode.parseIdentifier(uniqueMemberName).getSegmentList();
   QueryDimension dimension = query.getDimension(dimensionName);
   final Selection.Operator selectionMode = Selection.Operator.valueOf(selectionType);
   try {
     if (log.isDebugEnabled()) {
       log.debug(
           "query: "
               + queryName
               + " remove:"
               + selectionMode.toString()
               + " "
               + memberList.size());
     }
     Selection selection = dimension.createSelection(selectionMode, memberList);
     dimension.getInclusions().remove(selection);
     return true;
   } catch (OlapException e) {
     throw new SaikuServiceException(
         "Error removing member (" + uniqueMemberName + ") of dimension (" + dimensionName + ")",
         e);
   }
 }
Exemplo n.º 2
0
  public boolean includeMember(
      String queryName,
      String dimensionName,
      String uniqueMemberName,
      String selectionType,
      int memberposition) {
    IQuery query = getIQuery(queryName);

    List<IdentifierSegment> memberList =
        IdentifierNode.parseIdentifier(uniqueMemberName).getSegmentList();
    QueryDimension dimension = query.getDimension(dimensionName);
    final Selection.Operator selectionMode = Selection.Operator.valueOf(selectionType);
    try {
      removeAllChildren(queryName, dimensionName);
      Selection sel = dimension.createSelection(selectionMode, memberList);
      if (dimension.getInclusions().contains(sel)) {
        dimension.getInclusions().remove(sel);
      }
      if (memberposition < 0) {
        memberposition = dimension.getInclusions().size();
      }
      dimension.getInclusions().add(memberposition, sel);
      return true;
    } catch (OlapException e) {
      throw new SaikuServiceException(
          "Cannot include member query ("
              + queryName
              + ") dimension ("
              + dimensionName
              + ") member ("
              + uniqueMemberName
              + ") operator ("
              + selectionType
              + ") position "
              + memberposition,
          e);
    }
  }