dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33775
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17299: Data set report. Accepting multiple dimension items for dimensions.
------------------------------------------------------------
revno: 17299
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-10-28 06:29:40 -0400
message:
Data set report. Accepting multiple dimension items for dimensions.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportService.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportService.java 2014-10-28 10:29:40 +0000
@@ -29,7 +29,7 @@
*/
import java.util.List;
-import java.util.Map;
+import java.util.Set;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.dataset.DataSet;
@@ -55,7 +55,7 @@
* @param format the i18n format.
* @return
*/
- String getCustomDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions, boolean selectedUnitOnly, I18nFormat format );
+ String getCustomDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions, boolean selectedUnitOnly, I18nFormat format );
/**
* Generates a list of Grids based on the HTML code for a custom data set report.
@@ -68,7 +68,7 @@
* @param format the i18n format.
* @return a list of Grids.
*/
- List<Grid> getCustomDataSetReportAsGrid( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions,
+ List<Grid> getCustomDataSetReportAsGrid( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions,
boolean selectedUnitOnly, I18nFormat format );
/**
@@ -84,7 +84,7 @@
* @param i18n the i18n object.
* @return a list of Grids.
*/
- List<Grid> getDefaultDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions, boolean selectedUnitOnly, I18nFormat format, I18n i18n );
+ List<Grid> getDefaultDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions, boolean selectedUnitOnly, I18nFormat format, I18n i18n );
/**
* Generates a list of Grids representing a data set report. The data elements
@@ -99,5 +99,5 @@
* @param i18n the i18n object.
* @return a Grid.
*/
- List<Grid> getSectionDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions, boolean selectedUnitOnly, I18nFormat format, I18n i18n );
+ List<Grid> getSectionDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions, boolean selectedUnitOnly, I18nFormat format, I18n i18n );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportStore.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportStore.java 2014-10-28 10:29:40 +0000
@@ -29,6 +29,7 @@
*/
import java.util.Map;
+import java.util.Set;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -41,11 +42,11 @@
{
final String SEPARATOR = "-";
- Map<String, Double> getAggregatedValues( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions, boolean rawData );
+ Map<String, Double> getAggregatedValues( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions, boolean rawData );
- Map<String, Double> getAggregatedSubTotals( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions );
-
- Map<String, Double> getAggregatedTotals( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions );
-
- Map<String, Double> getAggregatedIndicatorValues( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions );
+ Map<String, Double> getAggregatedSubTotals( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions );
+
+ Map<String, Double> getAggregatedTotals( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions );
+
+ Map<String, Double> getAggregatedIndicatorValues( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions );
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java 2014-10-28 10:29:40 +0000
@@ -39,6 +39,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.regex.Matcher;
import org.hisp.dhis.common.Grid;
@@ -103,7 +104,7 @@
// -------------------------------------------------------------------------
@Override
- public String getCustomDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions,
+ public String getCustomDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions,
boolean selectedUnitOnly, I18nFormat format )
{
Map<String, Double> valueMap = dataSetReportStore.getAggregatedValues( dataSet, period, unit, dimensions, selectedUnitOnly );
@@ -116,7 +117,7 @@
}
@Override
- public List<Grid> getCustomDataSetReportAsGrid( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions,
+ public List<Grid> getCustomDataSetReportAsGrid( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions,
boolean selectedUnitOnly, I18nFormat format )
{
String html = getCustomDataSetReport( dataSet, period, unit, dimensions, selectedUnitOnly, format );
@@ -132,7 +133,7 @@
}
@Override
- public List<Grid> getSectionDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions,
+ public List<Grid> getSectionDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions,
boolean selectedUnitOnly, I18nFormat format, I18n i18n )
{
List<Section> sections = new ArrayList<>( dataSet.getSections() );
@@ -197,7 +198,7 @@
for ( DataElement dataElement : dataElements )
{
grid.addRow();
- grid.addValue( new GridValue( dataElement.getFormName() ) ); // Data element name
+ grid.addValue( new GridValue( dataElement.getFormNameFallback() ) ); // Data element name
for ( DataElementCategoryOptionCombo optionCombo : optionCombos ) // Values
{
@@ -246,7 +247,7 @@
}
@Override
- public List<Grid> getDefaultDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions,
+ public List<Grid> getDefaultDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions,
boolean selectedUnitOnly, I18nFormat format, I18n i18n )
{
ListMap<DataElementCategoryCombo, DataElement> map = new ListMap<>();
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java 2014-10-28 10:29:40 +0000
@@ -28,13 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.system.util.ListUtils.getList;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
import org.hisp.dhis.analytics.AnalyticsService;
import org.hisp.dhis.analytics.DataQueryParams;
@@ -68,7 +67,7 @@
@Override
public Map<String, Double> getAggregatedValues( DataSet dataSet, Period period, OrganisationUnit unit,
- Map<String, String> dimensions, boolean rawData )
+ Set<String> dimensions, boolean rawData )
{
List<DataElement> dataElements = new ArrayList<>( dataSet.getDataElements() );
@@ -88,10 +87,7 @@
if ( dimensions != null )
{
- for ( String dim : dimensions.keySet() )
- {
- params.setFilters( analyticsService.getDimension( dim, getList( dimensions.get( dim ) ), null, null, false ) );
- }
+ params.setFilters( analyticsService.getDimensionalObjects( dimensions, null ) );
}
Map<String, Double> map = analyticsService.getAggregatedDataValueMapping( params );
@@ -108,7 +104,7 @@
}
@Override
- public Map<String, Double> getAggregatedSubTotals( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions )
+ public Map<String, Double> getAggregatedSubTotals( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions )
{
Map<String, Double> dataMap = new HashMap<>();
@@ -140,10 +136,7 @@
if ( dimensions != null )
{
- for ( String dim : dimensions.keySet() )
- {
- params.setFilters( analyticsService.getDimension( dim, getList( dimensions.get( dim ) ), null, null, false ) );
- }
+ params.setFilters( analyticsService.getDimensionalObjects( dimensions, null ) );
}
Map<String, Double> map = analyticsService.getAggregatedDataValueMapping( params );
@@ -160,7 +153,7 @@
}
@Override
- public Map<String, Double> getAggregatedTotals( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions )
+ public Map<String, Double> getAggregatedTotals( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions )
{
List<DataElement> dataElements = new ArrayList<>( dataSet.getDataElements() );
@@ -179,10 +172,7 @@
if ( dimensions != null )
{
- for ( String dim : dimensions.keySet() )
- {
- params.setFilters( analyticsService.getDimension( dim, getList( dimensions.get( dim ) ), null, null, false ) );
- }
+ params.setFilters( analyticsService.getDimensionalObjects( dimensions, null ) );
}
Map<String, Double> map = analyticsService.getAggregatedDataValueMapping( params );
@@ -199,7 +189,7 @@
}
@Override
- public Map<String, Double> getAggregatedIndicatorValues( DataSet dataSet, Period period, OrganisationUnit unit, Map<String, String> dimensions )
+ public Map<String, Double> getAggregatedIndicatorValues( DataSet dataSet, Period period, OrganisationUnit unit, Set<String> dimensions )
{
List<Indicator> indicators = new ArrayList<>( dataSet.getIndicators() );
@@ -216,10 +206,7 @@
if ( dimensions != null )
{
- for ( String dim : dimensions.keySet() )
- {
- params.setFilters( analyticsService.getDimension( dim, getList( dimensions.get( dim ) ), null, null, false ) );
- }
+ params.setFilters( analyticsService.getDimensionalObjects( dimensions, null ) );
}
Map<String, Double> map = analyticsService.getAggregatedDataValueMapping( params );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java 2014-10-17 12:27:51 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java 2014-10-28 10:29:40 +0000
@@ -291,6 +291,8 @@
* based on the given set of dimension strings. Splits the strings using : as
* separator. Returns null of dimensions are null or empty.
*
+ * TODO remove
+ *
* @param dimensions the set of strings on format dimension:dimension-option.
* @return a map of dimensions and dimension options.
*/
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java 2014-10-28 10:29:40 +0000
@@ -33,7 +33,6 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
@@ -257,8 +256,6 @@
selectedOrgunit = organisationUnitService.getOrganisationUnit( ou );
- Map<String, String> dimensions = ContextUtils.getDimensionsAndOptions( dimension );
-
String dataSetType = selectedDataSet.getDataSetType();
DataElementCategoryOptionCombo attributeOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
@@ -269,20 +266,20 @@
{
if ( type != null )
{
- grids = dataSetReportService.getCustomDataSetReportAsGrid( selectedDataSet, selectedPeriod, selectedOrgunit, dimensions, selectedUnitOnly, format );
+ grids = dataSetReportService.getCustomDataSetReportAsGrid( selectedDataSet, selectedPeriod, selectedOrgunit, dimension, selectedUnitOnly, format );
}
else
{
- customDataEntryFormCode = dataSetReportService.getCustomDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, dimensions, selectedUnitOnly, format );
+ customDataEntryFormCode = dataSetReportService.getCustomDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, dimension, selectedUnitOnly, format );
}
}
else if ( TYPE_SECTION.equals( dataSetType ) )
{
- grids = dataSetReportService.getSectionDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, dimensions, selectedUnitOnly, format, i18n );
+ grids = dataSetReportService.getSectionDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, dimension, selectedUnitOnly, format, i18n );
}
else
{
- grids = dataSetReportService.getDefaultDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, dimensions, selectedUnitOnly, format, i18n );
+ grids = dataSetReportService.getDefaultDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, dimension, selectedUnitOnly, format, i18n );
}
return type != null ? type : dataSetType;