public IDataStore getDomainValues(
     String fieldName, Integer start, Integer limit, IDataStoreFilter filter) {
   IDataStore toReturn = null;
   try {
     String tableName = this.getTemporaryTableName();
     logger.debug("Temporary table name : [" + tableName + "]");
     if (tableName == null) {
       logger.error("Temporary table name not set, cannot proceed!!");
       throw new SpagoBIEngineRuntimeException("Temporary table name not set");
     }
     IDataSource dataSource = this.getDataSourceForPersistence();
     if (dataSource == null) {
       logger.error("Datasource for persistence not set, cannot proceed!!");
       throw new SpagoBIEngineRuntimeException("Datasource for persistence not set");
     }
     String signature = this.getSignature();
     IDataSetTableDescriptor tableDescriptor = null;
     if (signature.equals(TemporaryTableManager.getLastDataSetSignature(tableName))) {
       // signature matches: no need to create a TemporaryTable
       tableDescriptor = TemporaryTableManager.getLastDataSetTableDescriptor(tableName);
     } else {
       tableDescriptor = this.persist(tableName, dataSource);
       TemporaryTableManager.setLastDataSetTableDescriptor(tableName, tableDescriptor);
       TemporaryTableManager.setLastDataSetSignature(tableName, signature);
     }
     String filterColumnName = tableDescriptor.getColumnName(fieldName);
     StringBuffer buffer =
         new StringBuffer("Select DISTINCT " + filterColumnName + " FROM " + tableName);
     manageFilterOnDomainValues(buffer, fieldName, tableDescriptor, filter);
     String sqlStatement = buffer.toString();
     toReturn = TemporaryTableManager.queryTemporaryTable(sqlStatement, dataSource, start, limit);
     toReturn.getMetaData().changeFieldAlias(0, fieldName);
   } catch (Exception e) {
     logger.error("Error loading the domain values for the field " + fieldName, e);
     throw new SpagoBIEngineRuntimeException(
         "Error loading the domain values for the field " + fieldName, e);
   }
   return toReturn;
 }
 public IDataSetTableDescriptor persist(String tableName, IDataSource dataSource) {
   PersistedTableManager persister = new PersistedTableManager();
   try {
     persister.persistDataSet(this, dataSource, tableName);
   } catch (Exception e) {
     throw new SpagoBIRuntimeException("Error while persisting dataset", e);
   }
   List<String> fields = this.getFieldsList();
   IDataSetTableDescriptor descriptor = null;
   try {
     descriptor = TemporaryTableManager.getTableDescriptor(fields, tableName, dataSource);
   } catch (Exception e) {
     throw new SpagoBIRuntimeException("Error while getting table information", e);
   }
   return descriptor;
 }