}
public DataMart getDataMart() throws GeoEngineException {
DataMart dataMart = null;
IDataSet dataSet;
dataSet = (IDataSet)getEnv().get(EngineConstants.ENV_DATASET);
if(dataSet == null) {
JDBCDataSet jdbcDataSet = new JDBCDataSet();
jdbcDataSet.setQuery(query);
jdbcDataSet.setDataSource(dataSource);
dataSet = jdbcDataSet;
dataSet.setParamsMap(getEnv());
}
if( dataSet.hasBehaviour(QuerableBehaviour.class.getName()) ) {
QuerableBehaviour querableBehaviour = (QuerableBehaviour)dataSet.getBehaviour( QuerableBehaviour.class.getName() );
//querableBehaviour.setQueryTransformer( getDrillQueryTransformer() );
querableBehaviour.setQueryTransformer( new DrillThroughQueryTransformer(this) );
try {
logger.warn("trying to load data...");
dataSet.loadData();
logger.warn("success!!");
} catch (Throwable e) {
logger.error("failure!!",e);
throw new GeoEngineException("Impossible to load data from dataset");
}
IDataStore dataStore = dataSet.getDataStore();
IDataStoreMetaData dataStoreMeta = dataStore.getMetaData();
dataStoreMeta.setIdField( dataStoreMeta.getFieldIndex( getSelectedLevel().getColumnId() ));
dataMart = new DataMart();
dataMart.setDataStore(dataStore);
try {
dataMart.setTargetFeatureName( getSelectedLevel().getFeatureName() );
String columnid = getSelectedLevel().getColumnId();
String[] measureColumnNames = (String[])getMetaData().getMeasureColumnNames().toArray(new String[0]);
Iterator it = dataStore.iterator();