/*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software
* Foundation.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
* or from the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* Copyright (c) 2008 - 2009 Pentaho Corporation, . All rights reserved.
*/
package org.pentaho.reporting.engine.classic.extensions.datasources.mondrian;
import javax.swing.table.TableModel;
import mondrian.olap.Result;
import org.pentaho.reporting.engine.classic.core.DataRow;
import org.pentaho.reporting.engine.classic.core.ReportDataFactoryException;
/**
* This data-factory operates in Legacy-Mode providing a preprocessed view on the mondrian result.
* It behaves exactly as known from the Pentaho-Platform and the Pentaho-Report-Designer. This mode
* of operation breaks the structure of the resulting table as soon as new rows are returned by the
* server.
*
* @author Thomas Morgner
*/
public class SimpleLegacyBandedMDXDataFactory extends AbstractMDXDataFactory
{
public SimpleLegacyBandedMDXDataFactory()
{
}
/**
* Queries a datasource. The string 'query' defines the name of the query. The Parameterset given here may contain
* more data than actually needed for the query.
* <p/>
* The parameter-dataset may change between two calls, do not assume anything, and do not hold references to the
* parameter-dataset or the position of the columns in the dataset.
*
* @param queryName the query name
* @param parameters the parameters for the query
* @return the result of the query as table model.
* @throws org.pentaho.reporting.engine.classic.core.ReportDataFactoryException if an error occured while performing the query.
*/
public TableModel queryData(final String queryName, final DataRow parameters) throws ReportDataFactoryException
{
final Result cellSet = performQuery(queryName, parameters);
return new LegacyBandedMDXTableModel(cellSet, extractQueryLimit(parameters));
}
}