use of org.hisp.dhis.dataanalysis.FollowupParams in project dhis2-core by dhis2.
the class DataAnalysisController method markDataValues.
@PostMapping(value = "/followup/mark", consumes = APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ResponseBody
public void markDataValues(@RequestBody UpdateFollowUpForDataValuesRequest params) {
log.info("markDataValues from DataAnalysisController input " + params);
List<DataValue> dataValues = new ArrayList<>();
for (FollowupParams followup : params.getFollowups()) {
DataElement dataElement = dataElementService.getDataElement(followup.getDataElementId());
Period period = periodService.getPeriod(followup.getPeriodId());
OrganisationUnit source = organisationUnitService.getOrganisationUnit(followup.getOrganisationUnitId());
CategoryOptionCombo categoryOptionCombo = categoryService.getCategoryOptionCombo(followup.getCategoryOptionComboId());
CategoryOptionCombo attributeOptionCombo = categoryService.getCategoryOptionCombo(followup.getAttributeOptionComboId());
DataValue dataValue = dataValueService.getDataValue(dataElement, period, source, categoryOptionCombo, attributeOptionCombo);
if (dataValue != null) {
dataValue.setFollowup(followup.isFollowup());
dataValues.add(dataValue);
}
}
if (dataValues.size() > 0) {
dataValueService.updateDataValues(dataValues);
}
}
Aggregations