001/* 002// This software is subject to the terms of the Eclipse Public License v1.0 003// Agreement, available at the following URL: 004// http://www.eclipse.org/legal/epl-v10.html. 005// You must accept the terms of that agreement to use this software. 006// 007// Copyright (C) 2012-2012 Pentaho 008// All Rights Reserved. 009*/ 010package mondrian.rolap.agg; 011 012import mondrian.rolap.RolapStar; 013 014import java.util.ArrayList; 015import java.util.Collections; 016import java.util.List; 017 018/** 019 * Subclass of {@link CellRequest} that allows to specify 020 * which columns and measures to return as part of the ResultSet 021 * which we return to the client. 022 */ 023public class DrillThroughCellRequest extends CellRequest { 024 025 private final List<RolapStar.Column> drillThroughColumns = 026 new ArrayList<RolapStar.Column>(); 027 028 private final List<RolapStar.Measure> drillThroughMeasures = 029 new ArrayList<RolapStar.Measure>(); 030 031 public DrillThroughCellRequest( 032 RolapStar.Measure measure, 033 boolean extendedContext) 034 { 035 super(measure, extendedContext, true); 036 } 037 038 public void addDrillThroughColumn(RolapStar.Column column) { 039 this.drillThroughColumns.add(column); 040 } 041 042 public boolean includeInSelect(RolapStar.Column column) { 043 if (drillThroughColumns.size() == 0 044 && drillThroughMeasures.size() == 0) 045 { 046 return true; 047 } 048 return drillThroughColumns.contains(column); 049 } 050 051 public void addDrillThroughMeasure(RolapStar.Measure measure) { 052 this.drillThroughMeasures.add(measure); 053 } 054 055 public boolean includeInSelect(RolapStar.Measure measure) { 056 if (drillThroughColumns.size() == 0 057 && drillThroughMeasures.size() == 0) 058 { 059 return true; 060 } 061 return drillThroughMeasures.contains(measure); 062 } 063 064 public List<RolapStar.Measure> getDrillThroughMeasures() { 065 return Collections.unmodifiableList(drillThroughMeasures); 066 } 067} 068 069// End DrillThroughCellRequest.java