public DashboardFilterProperty[] getAllPropertiesForCurrentFilter() {
    List results = new ArrayList();
    try {
      // Static properties.
      DashboardFilterProperty[] staticProps = getStaticPropertiesForCurrentFilter();
      if (staticProps != null) results.addAll(Arrays.asList(staticProps));

      // Dynamic properties.
      Iterator it = getDashboard().getDataProviders().iterator();
      while (it.hasNext()) {
        DataProvider dataProvider = (DataProvider) it.next();
        DataProperty[] allProperties = dataProvider.getDataSet().getProperties();
        for (int i = 0; i < allProperties.length; i++) {
          DataProperty property = allProperties[i];
          DashboardFilterProperty prop =
              getDashboardFilterPropertyForCurrentFilter(
                  dataProvider.getCode(), property.getPropertyId());
          if (prop == null)
            prop =
                new DashboardFilterProperty(
                    dataProvider.getCode(), property.getPropertyId(), getFilter(), null, false);
          results.add(prop);
        }
      }
    } catch (Exception e) {
      log.error("Cannot get data provider results.", e);
    }
    return (DashboardFilterProperty[]) results.toArray(new DashboardFilterProperty[results.size()]);
  }
 protected DataSetHolder createDataSetHolder(DataProvider dataProvider, DataSet dataSet)
     throws Exception {
   String providerCode = dataProvider.getCode();
   DataSetHolder dataSetHolder = new DataSetHolder();
   dataSetHolder.dataProviderCode = providerCode;
   dataSetHolder.originalDataSet = dataSet;
   dataSetMap.put(providerCode, dataSetHolder);
   return dataSetHolder;
 }
 protected DataSetHolder getDataSetHolder(DataProvider dataProvider) throws Exception {
   String providerCode = dataProvider.getCode();
   DataSetHolder dataSetHolder = dataSetMap.get(providerCode);
   if (dataSetHolder == null) {
     DataSet dataSet = loadDataSet(dataProvider);
     dataSetHolder = createDataSetHolder(dataProvider, dataSet);
   }
   return dataSetHolder;
 }
 protected DataSet loadDataSet(DataProvider dataProvider) throws Exception {
   CodeBlockTrace trace =
       CodeBlockHelper.newCodeBlockTrace(
               CoreCodeBlockTypes.DATASET_LOAD,
               "dataset-load-" + dataProvider.getCode(),
               "Data set load - " + dataProvider.getDescription(LocaleManager.currentLocale()),
               createDataProviderContext(dataProvider))
           .begin();
   try {
     DataSet dataSet = dataProvider.getDataLoader().load(dataProvider);
     dataSet.setDataProvider(dataProvider);
     ((DataProviderImpl) dataProvider).deserializeDataProperties(dataSet);
     return dataSet;
   } finally {
     trace.end();
   }
 }
 public DataSet filterDataSet(DataProvider dataProvider, DataFilter dataFilter) throws Exception {
   CodeBlockTrace trace =
       CodeBlockHelper.newCodeBlockTrace(
               CoreCodeBlockTypes.DATASET_FILTER,
               "dataset-filter-" + dataProvider.getCode(),
               "Data set filter - " + dataProvider.getDescription(LocaleManager.currentLocale()),
               createDataProviderContext(dataProvider))
           .begin();
   try {
     DataSetHolder dataSetHolder = getDataSetHolder(dataProvider);
     dataSetHolder.filteredDataSet = dataSetHolder.originalDataSet.filter(dataFilter);
     if (dataSetHolder.filteredDataSet != null) {
       ((DataProviderImpl) dataProvider).deserializeDataProperties(dataSetHolder.filteredDataSet);
     }
     return dataSetHolder.getDataSet();
   } finally {
     trace.end();
   }
 }
 protected DataSetHolder removeDataSetHolder(DataProvider dataProvider) throws Exception {
   String providerCode = dataProvider.getCode();
   return dataSetMap.remove(providerCode);
 }
 protected Map createDataProviderContext(DataProvider dataProvider) {
   Map m = new HashMap();
   m.put("Provider code", dataProvider.getCode());
   m.put("Provider description", dataProvider.getDescription(LocaleManager.currentLocale()));
   return m;
 }