dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22587
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10895: Removed dynamic report table data from web api. Replaces by analytics api.
------------------------------------------------------------
revno: 10895
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-05-20 08:10:29 +0200
message:
Removed dynamic report table data from web api. Replaces by analytics api.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/ImportAction.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/reporttable/ReportTableService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java 2013-03-19 17:09:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java 2013-05-20 06:10:29 +0000
@@ -126,21 +126,6 @@
*/
Grid getReportTableGrid( String uid, I18nFormat format, Date reportingPeriod, String organisationUnitUid );
- Grid getReportTableGrid( int reportTableId, I18nFormat format, Date reportingPeriod, String organisationUnitUid );
-
- /**
- * Instantiates and populates a Grid populated with data from the given
- * ReportTable.
- *
- * @param reportTable the ReportTable.
- * @param format the I18nFormat.
- * @param reportingPeriod the reporting date.
- * @param organisationUnitUid the organisation unit uid.
- * @param minimal indicates whether to include visible columns only in the Grid.
- * @return a Grid.
- */
- Grid getReportTableGrid( ReportTable reportTable, I18nFormat format, Date reportingPeriod, String organisationUnitUid, boolean minimal );
-
ReportTable getReportTable( String uid, String mode );
List<ReportTable> getReportTablesBetween( int first, int max );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2013-05-19 18:49:47 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2013-05-20 06:10:29 +0000
@@ -125,20 +125,6 @@
{
ReportTable reportTable = getReportTable( uid );
- return getReportTableGrid( reportTable, format, reportingPeriod, organisationUnitUid, false );
- }
-
- @Override
- public Grid getReportTableGrid( int reportTableId, I18nFormat format, Date reportingPeriod, String organisationUnitUid )
- {
- ReportTable reportTable = getReportTable( reportTableId );
-
- return getReportTableGrid( reportTable, format, reportingPeriod, organisationUnitUid, false );
- }
-
- @Override
- public Grid getReportTableGrid( ReportTable reportTable, I18nFormat format, Date reportingPeriod, String organisationUnitUid, boolean minimal )
- {
reportTable = initDynamicMetaObjects( reportTable, reportingPeriod, organisationUnitUid, format );
return getGrid( reportTable, format );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java 2013-05-19 18:49:47 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java 2013-05-20 06:10:29 +0000
@@ -368,9 +368,9 @@
new ArrayList<DataElement>(), indicators, new ArrayList<DataSet>(), periods, units,
true, true, false, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, null, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, null, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 7 ) );
assertEquals( 13d, grid.getRow( 0 ).get( 8 ) );
@@ -399,9 +399,9 @@
new ArrayList<DataElement>(), indicators, new ArrayList<DataSet>(), periods, units,
false, false, true, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 11 ) );
assertEquals( 15d, grid.getRow( 0 ).get( 12 ) );
@@ -432,9 +432,9 @@
new ArrayList<DataElement>(), indicators, new ArrayList<DataSet>(), periods, units,
true, false, true, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 7 ) );
assertEquals( 13d, grid.getRow( 0 ).get( 8 ) );
@@ -463,9 +463,9 @@
dataElements, new ArrayList<Indicator>(), new ArrayList<DataSet>(), periods, units,
true, true, false, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 7 ) );
assertEquals( 13d, grid.getRow( 0 ).get( 8 ) );
@@ -494,9 +494,9 @@
dataElements, new ArrayList<Indicator>(), new ArrayList<DataSet>(), periods, units,
false, false, true, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 11 ) );
assertEquals( 15d, grid.getRow( 0 ).get( 12 ) );
@@ -527,9 +527,9 @@
dataElements, new ArrayList<Indicator>(), new ArrayList<DataSet>(), periods, units,
true, false, true, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 7 ) );
assertEquals( 13d, grid.getRow( 0 ).get( 8 ) );
@@ -558,9 +558,9 @@
new ArrayList<DataElement>(), new ArrayList<Indicator>(), dataSets, periods, units,
true, true, false, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 7 ) );
assertEquals( 13d, grid.getRow( 0 ).get( 8 ) );
@@ -589,9 +589,9 @@
new ArrayList<DataElement>(), new ArrayList<Indicator>(), dataSets, periods, units,
false, false, true, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 11 ) );
assertEquals( 15d, grid.getRow( 0 ).get( 12 ) );
@@ -622,9 +622,9 @@
new ArrayList<DataElement>(), new ArrayList<Indicator>(), dataSets, periods, units,
true, false, true, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 7 ) );
assertEquals( 13d, grid.getRow( 0 ).get( 8 ) );
@@ -671,9 +671,9 @@
dataElements, indicators, dataSets, periods, units,
true, true, false, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 7 ) );
assertEquals( 13d, grid.getRow( 0 ).get( 8 ) );
@@ -736,9 +736,9 @@
dataElements, indicators, dataSets, periods, units,
false, false, true, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 11 ) );
assertEquals( 15d, grid.getRow( 0 ).get( 12 ) );
@@ -811,9 +811,9 @@
dataElements, indicators, dataSets, periods, units,
true, false, true, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 7 ) );
assertEquals( 13d, grid.getRow( 0 ).get( 8 ) );
@@ -851,9 +851,9 @@
new ArrayList<DataElement>(), indicators, new ArrayList<DataSet>(), periods, units,
true, true, true, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 3 ) );
assertEquals( 12d, grid.getRow( 0 ).get( 4 ) );
@@ -874,9 +874,9 @@
new ArrayList<DataElement>(), indicators, new ArrayList<DataSet>(), periods, units,
false, false, false, null, null, "january_2000" );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11d, grid.getRow( 0 ).get( 15 ) );
assertEquals( 12d, grid.getRow( 1 ).get( 15 ) );
@@ -898,9 +898,9 @@
false, false, true, null, null, "january_2000" );
reportTable.setTopLimit( 2 );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 2, grid.getHeight() );
}
@@ -922,9 +922,9 @@
false, false, true, null, null, "january_2000" );
reportTable.setSortOrder( ReportTable.DESC );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 14d, grid.getRow( 0 ).get( 11 ) );
assertEquals( 18d, grid.getRow( 0 ).get( 12 ) );
@@ -957,9 +957,9 @@
reportTable.setRegression( true );
- int id = reportTableService.saveReportTable( reportTable );
+ reportTableService.saveReportTable( reportTable );
- Grid grid = reportTableService.getReportTableGrid( id, i18nFormat, date, "0" );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), i18nFormat, date, "0" );
assertEquals( 11.0, grid.getRow( 0 ).get( 7 ) );
assertEquals( 13.0, grid.getRow( 0 ).get( 8 ) );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java 2013-05-14 09:56:21 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java 2013-05-20 06:10:29 +0000
@@ -67,6 +67,10 @@
@Autowired
private IntegrationService integrationService;
+ // -------------------------------------------------------------------------
+ // Get
+ // -------------------------------------------------------------------------
+
@RequestMapping(method = RequestMethod.GET, produces = { "text/html", "text/plain" })
public String getDataValueSets( Model model ) throws Exception
{
@@ -88,6 +92,10 @@
dataValueSetService.writeDataValueSet( dataSet, period, orgUnit, response.getOutputStream() );
}
+ // -------------------------------------------------------------------------
+ // Post
+ // -------------------------------------------------------------------------
+
@RequestMapping(method = RequestMethod.POST, consumes = "application/xml")
@PreAuthorize("hasRole('ALL') or hasRole('F_DATAVALUE_ADD')")
public void postDxf2DataValueSet( ImportOptions importOptions,
@@ -127,6 +135,10 @@
JacksonUtils.toXml( response.getOutputStream(), summary );
}
+ // -------------------------------------------------------------------------
+ // Supportive
+ // -------------------------------------------------------------------------
+
@ExceptionHandler(IllegalArgumentException.class)
public void handleError( IllegalArgumentException ex, HttpServletResponse response )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java 2013-05-15 15:00:45 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java 2013-05-20 06:10:29 +0000
@@ -31,10 +31,8 @@
import static org.hisp.dhis.system.util.CodecUtils.filenameEncode;
import java.io.InputStream;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
-import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -44,14 +42,11 @@
import org.hisp.dhis.common.DimensionService;
import org.hisp.dhis.common.DimensionalObject;
import org.hisp.dhis.common.Grid;
-import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.dxf2.utils.JacksonUtils;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.i18n.I18nManager;
-import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
@@ -59,7 +54,6 @@
import org.hisp.dhis.period.Cal;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.RelativePeriods;
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.reporttable.ReportTableService;
import org.hisp.dhis.system.grid.GridUtils;
@@ -86,8 +80,6 @@
{
public static final String RESOURCE_PATH = "/reportTables";
- private static final String DATA_NAME = "data";
-
@Autowired
public ReportTableService reportTableService;
@@ -198,179 +190,6 @@
}
//--------------------------------------------------------------------------
- // GET - Dynamic data
- //--------------------------------------------------------------------------
-
- @RequestMapping( value = "/data", method = RequestMethod.GET ) // For json, jsonp
- public String getReportTableDynamicData( @RequestParam( required = false, value = "in" ) List<String> indicators,
- @RequestParam( required = false, value = "de" ) List<String> dataElements,
- @RequestParam( required = false, value = "ds" ) List<String> dataSets,
- @RequestParam( value = "ou" ) List<String> orgUnits,
- @RequestParam( required = false, value = "crosstab" ) List<String> crossTab,
- @RequestParam( required = false ) boolean orgUnitIsParent,
- @RequestParam( required = false ) boolean minimal,
- RelativePeriods relatives,
- Model model,
- HttpServletResponse response ) throws Exception
- {
- Grid grid = getReportTableDynamicGrid( indicators, dataElements, dataSets,
- orgUnits, crossTab, orgUnitIsParent, minimal, relatives, response );
-
- model.addAttribute( "model", grid );
- model.addAttribute( "viewClass", "detailed" );
- contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
-
- return grid != null ? "reportTableData" : null;
- }
-
- @RequestMapping( value = "/data.html", method = RequestMethod.GET )
- public void getReportTableDynamicDataHtml( @RequestParam( required = false, value = "in" ) List<String> indicators,
- @RequestParam( required = false, value = "de" ) List<String> dataElements,
- @RequestParam( required = false, value = "ds" ) List<String> dataSets,
- @RequestParam( value = "ou" ) List<String> orgUnits,
- @RequestParam( required = false, value = "crosstab" ) List<String> crossTab,
- @RequestParam( required = false ) boolean orgUnitIsParent,
- @RequestParam( required = false ) boolean minimal,
- RelativePeriods relatives,
- HttpServletResponse response ) throws Exception
- {
- Grid grid = getReportTableDynamicGrid( indicators, dataElements, dataSets,
- orgUnits, crossTab, orgUnitIsParent, minimal, relatives, response );
-
- String filename = DATA_NAME + ".html";
- contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING, filename, false );
-
- GridUtils.toHtml( grid, response.getWriter() );
- }
-
- @RequestMapping( value = "/data.xml", method = RequestMethod.GET )
- public void getReportTableDynamicDataXml( @RequestParam( required = false, value = "in" ) List<String> indicators,
- @RequestParam( required = false, value = "de" ) List<String> dataElements,
- @RequestParam( required = false, value = "ds" ) List<String> dataSets,
- @RequestParam( value = "ou" ) List<String> orgUnits,
- @RequestParam( required = false, value = "crosstab" ) List<String> crossTab,
- @RequestParam( required = false ) boolean orgUnitIsParent,
- @RequestParam( required = false ) boolean minimal,
- RelativePeriods relatives,
- HttpServletResponse response ) throws Exception
- {
- Grid grid = getReportTableDynamicGrid( indicators, dataElements, dataSets,
- orgUnits, crossTab, orgUnitIsParent, minimal, relatives, response );
-
- String filename = DATA_NAME + ".xml";
- contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, filename, false );
-
- GridUtils.toXml( grid, response.getOutputStream() );
- }
-
- @RequestMapping( value = "/data.pdf", method = RequestMethod.GET )
- public void getReportTableDynamicDataPdf( @RequestParam( required = false, value = "in" ) List<String> indicators,
- @RequestParam( required = false, value = "de" ) List<String> dataElements,
- @RequestParam( required = false, value = "ds" ) List<String> dataSets,
- @RequestParam( value = "ou" ) List<String> orgUnits,
- @RequestParam( required = false, value = "crosstab" ) List<String> crossTab,
- @RequestParam( required = false ) boolean orgUnitIsParent,
- @RequestParam( required = false ) boolean minimal,
- RelativePeriods relatives,
- HttpServletResponse response ) throws Exception
- {
- Grid grid = getReportTableDynamicGrid( indicators, dataElements, dataSets,
- orgUnits, crossTab, orgUnitIsParent, minimal, relatives, response );
-
- String filename = DATA_NAME + ".pdf";
- contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, CacheStrategy.RESPECT_SYSTEM_SETTING, filename, false );
-
- GridUtils.toPdf( grid, response.getOutputStream() );
- }
-
- @RequestMapping( value = "/data.xls", method = RequestMethod.GET )
- public void getReportTableDynamicDataXls( @RequestParam( required = false, value = "in" ) List<String> indicators,
- @RequestParam( required = false, value = "de" ) List<String> dataElements,
- @RequestParam( required = false, value = "ds" ) List<String> dataSets,
- @RequestParam( value = "ou" ) List<String> orgUnits,
- @RequestParam( required = false, value = "crosstab" ) List<String> crossTab,
- @RequestParam( required = false ) boolean orgUnitIsParent,
- @RequestParam( required = false ) boolean minimal,
- RelativePeriods relatives,
- HttpServletResponse response ) throws Exception
- {
- Grid grid = getReportTableDynamicGrid( indicators, dataElements, dataSets,
- orgUnits, crossTab, orgUnitIsParent, minimal, relatives, response );
-
- String filename = DATA_NAME + ".xls";
- contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, filename, true );
-
- GridUtils.toXls( grid, response.getOutputStream() );
- }
-
- @RequestMapping( value = "/data.csv", method = RequestMethod.GET )
- public void getReportTableDynamicDataCsv( @RequestParam( required = false, value = "in" ) List<String> indicators,
- @RequestParam( required = false, value = "de" ) List<String> dataElements,
- @RequestParam( required = false, value = "ds" ) List<String> dataSets,
- @RequestParam( value = "ou" ) List<String> orgUnits,
- @RequestParam( required = false, value = "crosstab" ) List<String> crossTab,
- @RequestParam( required = false ) boolean orgUnitIsParent,
- @RequestParam( required = false ) boolean minimal,
- RelativePeriods relatives,
- HttpServletResponse response ) throws Exception
- {
- Grid grid = getReportTableDynamicGrid( indicators, dataElements, dataSets,
- orgUnits, crossTab, orgUnitIsParent, minimal, relatives, response );
-
- String filename = DATA_NAME + ".csv";
- contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, filename, true );
-
- GridUtils.toCsv( grid, response.getOutputStream() );
- }
-
- private Grid getReportTableDynamicGrid( List<String> indicators, List<String> dataElements, List<String> dataSets,
- List<String> orgUnits, List<String> crossTab, boolean orgUnitIsParent, boolean minimal, RelativePeriods relatives, HttpServletResponse response ) throws Exception
- {
- List<Indicator> indicators_ = indicatorService.getIndicatorsByUid( indicators );
- List<DataElement> dataElements_ = dataElementService.getDataElementsByUid( dataElements );
- List<DataSet> dataSets_ = dataSetService.getDataSetsByUid( dataSets );
- List<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitsByUid( orgUnits );
-
- if ( indicators_.isEmpty() && dataElements_.isEmpty() && dataSets_.isEmpty() )
- {
- ContextUtils.conflictResponse( response, "No valid indicators, data elements or data sets specified" );
- return null;
- }
-
- if ( orgUnitIsParent )
- {
- List<OrganisationUnit> childUnits = new ArrayList<OrganisationUnit>();
-
- for ( OrganisationUnit unit : organisationUnits )
- {
- childUnits.addAll( unit.getChildren() );
- }
-
- organisationUnits = childUnits;
- }
-
- if ( organisationUnits.isEmpty() )
- {
- ContextUtils.conflictResponse( response, "No valid organisation units specified" );
- return null;
- }
-
- ReportTable table = new ReportTable();
-
- table.setIndicators( indicators_ );
- table.setDataElements( dataElements_ );
- table.setOrganisationUnits( organisationUnits );
-
- table.setDoIndicators( crossTab != null && crossTab.contains( "data" ) );
- table.setDoPeriods( crossTab != null && crossTab.contains( "periods" ) );
- table.setDoUnits( crossTab != null && crossTab.contains( "orgunits" ) );
-
- table.setRelatives( relatives );
-
- return reportTableService.getReportTableGrid( table, i18nManager.getI18nFormat(), new Date(), null, minimal );
- }
-
- //--------------------------------------------------------------------------
// GET - Report table data
//--------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/ImportAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/ImportAction.java 2012-06-25 18:21:40 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/ImportAction.java 2013-05-20 06:10:29 +0000
@@ -283,6 +283,7 @@
return "dhis14";
}
}
+
return SUCCESS;
}
}