Search in sources :

Example 16 with DataExportParams

use of org.hisp.dhis.datavalue.DataExportParams in project dhis2-core by dhis2.

the class DataValueSetController method getDataValueSetCsv.

@RequestMapping(method = RequestMethod.GET, produces = CONTENT_TYPE_CSV)
public void getDataValueSetCsv(@RequestParam(required = false) Set<String> dataSet, @RequestParam(required = false) Set<String> dataElementGroup, @RequestParam(required = false) Set<String> period, @RequestParam(required = false) Date startDate, @RequestParam(required = false) Date endDate, @RequestParam(required = false) Set<String> orgUnit, @RequestParam(required = false) boolean children, @RequestParam(required = false) Set<String> orgUnitGroup, @RequestParam(required = false) Set<String> attributeOptionCombo, @RequestParam(required = false) boolean includeDeleted, @RequestParam(required = false) Date lastUpdated, @RequestParam(required = false) String lastUpdatedDuration, @RequestParam(required = false) Integer limit, IdSchemes idSchemes, HttpServletResponse response) throws IOException {
    response.setContentType(CONTENT_TYPE_CSV);
    DataExportParams params = dataValueSetService.getFromUrl(dataSet, dataElementGroup, period, startDate, endDate, orgUnit, children, orgUnitGroup, attributeOptionCombo, includeDeleted, lastUpdated, lastUpdatedDuration, limit, idSchemes);
    dataValueSetService.writeDataValueSetCsv(params, response.getWriter());
}
Also used : DataExportParams(org.hisp.dhis.datavalue.DataExportParams) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

DataExportParams (org.hisp.dhis.datavalue.DataExportParams)16 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 DhisSpringTest (org.hisp.dhis.DhisSpringTest)5 Test (org.junit.Test)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 IdSchemes (org.hisp.dhis.common.IdSchemes)3 DataElementCategoryOptionCombo (org.hisp.dhis.dataelement.DataElementCategoryOptionCombo)3 DataValue (org.hisp.dhis.datavalue.DataValue)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 DataElement (org.hisp.dhis.dataelement.DataElement)2 Period (org.hisp.dhis.period.Period)2 OutputStream (java.io.OutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Collection (java.util.Collection)1 Date (java.util.Date)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1