Example #1
0
 protected CellRequest createRequest(
     final String cube,
     final String measureName,
     final String[] tables,
     final String[] columns,
     final String[] values) {
   RolapStar.Measure starMeasure = getMeasure(cube, measureName);
   CellRequest request = new CellRequest(starMeasure, false, false);
   final RolapStar star = starMeasure.getStar();
   for (int i = 0; i < tables.length; i++) {
     String table = tables[i];
     if (table != null && table.length() > 0) {
       String column = columns[i];
       String value = values[i];
       final RolapStar.Column storeTypeColumn = star.lookupColumn(table, column);
       request.addConstrainedColumn(
           storeTypeColumn, new ValueColumnPredicate(storeTypeColumn, value));
     }
   }
   return request;
 }
Example #2
0
    StarPredicate toPredicate(RolapStar star) {
      RolapStar.Column starColumn[] = new RolapStar.Column[tables.length];
      for (int i = 0; i < tables.length; i++) {
        String table = tables[i];
        String column = columns[i];
        starColumn[i] = star.lookupColumn(table, column);
      }

      List<StarPredicate> orPredList = new ArrayList<StarPredicate>();
      for (String[] values : valueList) {
        assert (values.length == tables.length);
        List<StarPredicate> andPredList = new ArrayList<StarPredicate>();
        for (int i = 0; i < values.length; i++) {
          andPredList.add(new ValueColumnPredicate(starColumn[i], values[i]));
        }
        final StarPredicate predicate =
            andPredList.size() == 1 ? andPredList.get(0) : new AndPredicate(andPredList);
        orPredList.add(predicate);
      }

      return orPredList.size() == 1 ? orPredList.get(0) : new OrPredicate(orPredList);
    }