use of org.hisp.dhis.legend.LegendSet in project dhis2-core by dhis2.
the class LegendSetController method deleteObject.
@Override
@RequestMapping(value = "/{uid}", method = RequestMethod.DELETE)
@PreAuthorize("hasRole('F_GIS_ADMIN') or hasRole('F_LEGEND_SET_DELETE') or hasRole('ALL')")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteObject(@PathVariable String uid, HttpServletRequest request, HttpServletResponse response) throws Exception {
LegendSet legendSet = legendSetService.getLegendSet(uid);
if (legendSet == null) {
throw new WebMessageException(WebMessageUtils.notFound("Legend set does not exist: " + uid));
}
legendSet.getLegends().clear();
legendSetService.deleteLegendSet(legendSet);
}
use of org.hisp.dhis.legend.LegendSet in project dhis2-core by dhis2.
the class DhisConvenienceTest method createLegendSet.
public static LegendSet createLegendSet(char uniqueCharacter) {
LegendSet legendSet = new LegendSet();
legendSet.setAutoFields();
legendSet.setName("LegendSet" + uniqueCharacter);
return legendSet;
}
use of org.hisp.dhis.legend.LegendSet in project dhis2-core by dhis2.
the class DataSetDeletionHandler method deleteLegendSet.
@Override
public void deleteLegendSet(LegendSet legendSet) {
for (DataSet dataSet : idObjectManager.getAllNoAcl(DataSet.class)) {
for (LegendSet ls : dataSet.getLegendSets()) {
if (legendSet.equals(ls)) {
dataSet.getLegendSets().remove(ls);
idObjectManager.updateNoAcl(dataSet);
}
}
}
}
Aggregations