예제 #1
0
 public boolean removeLevel(
     String queryName, String dimensionName, String uniqueHierarchyName, String uniqueLevelName) {
   IQuery query = getIQuery(queryName);
   removeAllChildren(queryName, dimensionName);
   QueryDimension dimension = query.getDimension(dimensionName);
   try {
     for (Hierarchy hierarchy : dimension.getDimension().getHierarchies()) {
       if (hierarchy.getUniqueName().equals(uniqueHierarchyName)) {
         for (Level level : hierarchy.getLevels()) {
           if (level.getUniqueName().equals(uniqueLevelName)) {
             Selection inclusion = dimension.createSelection(level);
             dimension.getInclusions().remove(inclusion);
             ArrayList<Selection> removals = new ArrayList<Selection>();
             for (Selection sel : dimension.getInclusions()) {
               if ((sel.getRootElement() instanceof Member)) {
                 if (((Member) sel.getRootElement()).getLevel().equals(level)) {
                   if (dimension.getInclusions().contains(sel)) {
                     removals.add(sel);
                   }
                 }
               }
             }
             dimension.getInclusions().removeAll(removals);
           }
         }
       }
     }
   } catch (Exception e) {
     throw new SaikuServiceException(
         "Cannot remove level" + uniqueLevelName + "from dimension " + dimensionName, e);
   }
   return true;
 }
예제 #2
0
 public boolean includeLevel(
     String queryName, String dimensionName, String uniqueHierarchyName, String uniqueLevelName) {
   IQuery query = getIQuery(queryName);
   removeAllChildren(queryName, dimensionName);
   QueryDimension dimension = query.getDimension(dimensionName);
   for (Hierarchy hierarchy : dimension.getDimension().getHierarchies()) {
     if (hierarchy.getUniqueName().equals(uniqueHierarchyName)) {
       for (Level level : hierarchy.getLevels()) {
         if (level.getUniqueName().equals(uniqueLevelName)) {
           Selection sel = dimension.createSelection(level);
           if (!dimension.getInclusions().contains(sel)) {
             dimension.include(level);
           }
           return true;
         }
       }
     }
   }
   return false;
 }