Bug 204422 Max row limit is not effect.
Build ID: I20070625-1500 Steps To Reproduce: 1. Run Birt Design. 2. Select menu Window->Preferences-> Report Design -> Chart, set 'Max row number of data preview' to 6. 3. Create a new bar chart, open chart builder dialog. 4. Switch to 'Select Data' tab, set dataset. 5. The count of preview data should be 6. 6. Close chart builder dialog and reset 'Max row number of data preview' to 10. 7. Open chart builder dialog again. Expect result: The count of preview data should be 10. Actual result: The count of preview data in chart are still 6. More information:1. Run Birt Design. 2. Select menu Window->Preferences-> Report Design -> Chart, set 'Max row number of data preview' to 6. 3. Create a new bar chart, open chart builder dialog. 4. Switch to 'Select Data' tab, set dataset. 5. The count of preview data should be 6. 6. Close chart builder dialog and reset 'Max row number of data preview' to 10. 7. Open chart builder dialog again. Expect result: The count of preview data should be 10. Actual result: The count of preview data in chart are still 6. In chart, the row limit has been set into app context, the snippet code of chart shows below: queryDefn.setDataSetName( getDataSetFromHandle( ).getQualifiedName( ) ); DataSessionContext dsc = new DataSessionContext( DataSessionContext.MODE_DIRECT_PRESENTATION, getReportDesignHandle( ) ); Map appContext = new HashMap( ); appContext.put( DataEngine.DATA_SET_CACHE_ROW_LIMIT, new Integer( maxRow ) ); dsc.setAppContext( appContext ); DataRequestSession session = DataRequestSession.newSession( dsc ); for ( int i = 0; i < columnExpression.length; i++ ) { queryDefn.addResultSetExpression( columnExpression[i], new ScriptExpression( columnExpression[i] ) ); }
data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/executor/DataSetCacheManager.java
import org.eclipse.birt.data.engine.api.IBaseDataSetDesign;
import org.eclipse.birt.data.engine.api.IBaseDataSourceDesign;
import org.eclipse.birt.data.engine.api.IResultMetaData;
import org.eclipse.birt.data.engine.core.DataException;
import org.eclipse.birt.data.engine.impl.DataSetCacheUtil;
import org.eclipse.birt.data.engine.impl.ResultMetaData;
import org.eclipse.birt.data.engine.odi.IResultClass;
/**
 * Cache manager for ODA data set and Scripted data set. Since connection to
 * data set and retrieve data are expensive operations, it is unnecessary to do
 * them again and again when user just want to see the data in the same
 * configuration of data set. The basic idea is when user want to use cache, the
 * data will be saved into cache in the first time and it will be loaded in the
 * later time. Once the configuration of data set is changed, the data needs to
 * be retrieved again.
 * 
 * Please notice the whole procedure: 1: first check whether data can be loaded
 * from cache 2.1: if yes, then data will be loaded and check whether data needs
 * to be saved into cache will be skipped. 2.2: if no, then data will be retrieved
 * from data set and then whether saving into cache will be checked 2.2.1: if
 * yes, then data will be saved into cache 2.2.2: if no, then nothing will be
 * done
 * 
 * There are three possible value of cacheRowCount: 1: -1, cache all data set 2:
 * 0, don't cache 3: >0, cache the specified value
 * 
 * Here whether data will be loaded from cache can be observed by external
 * caller, but about saving into cache is not.
 */
public class DataSetCacheManager