use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.UID in project dhis2-core by dhis2.
the class InterpretationController method writeReportTableInterpretation.
// -------------------------------------------------------------------------
// Intepretation create
// -------------------------------------------------------------------------
@RequestMapping(value = "/reportTable/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" })
public void writeReportTableInterpretation(@PathVariable("uid") String reportTableUid, @RequestParam(value = "pe", required = false) String isoPeriod, @RequestParam(value = "ou", required = false) String orgUnitUid, @RequestBody String text, HttpServletResponse response, HttpServletRequest request) throws WebMessageException {
ReportTable reportTable = idObjectManager.get(ReportTable.class, reportTableUid);
if (reportTable == null) {
throw new WebMessageException(WebMessageUtils.conflict("Report table does not exist or is not accessible: " + reportTableUid));
}
Period period = PeriodType.getPeriodFromIsoString(isoPeriod);
OrganisationUnit orgUnit = getUserOrganisationUnit(orgUnitUid, reportTable, currentUserService.getCurrentUser());
createIntepretation(new Interpretation(reportTable, period, orgUnit, text), request, response);
}
use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.UID in project dhis2-core by dhis2.
the class AbstractTrackedEntityInstanceService method deleteTrackedEntityInstances.
@Override
public ImportSummaries deleteTrackedEntityInstances(List<String> uids) {
ImportSummaries importSummaries = new ImportSummaries();
int counter = 0;
for (String uid : uids) {
importSummaries.addImportSummary(deleteTrackedEntityInstance(uid));
if (counter % FLUSH_FREQUENCY == 0) {
clearSession();
}
counter++;
}
return importSummaries;
}
use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.UID in project dhis2-core by dhis2.
the class DataSetController method getVersion.
@RequestMapping(value = "/{uid}/version", method = RequestMethod.GET)
public void getVersion(@PathVariable("uid") String uid, @RequestParam Map<String, String> parameters, HttpServletResponse response) throws Exception {
DataSet dataSet = manager.get(DataSet.class, uid);
if (dataSet == null) {
throw new WebMessageException(WebMessageUtils.conflict("Data set does not exist: " + uid));
}
Map<String, Integer> versionMap = new HashMap<>();
versionMap.put("version", dataSet.getVersion());
renderService.toJson(response.getOutputStream(), versionMap);
}
use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.UID in project dhis2-core by dhis2.
the class DashboardItemController method putDashboardItemShape.
@RequestMapping(value = "/{uid}/shape/{shape}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void putDashboardItemShape(@PathVariable String uid, @PathVariable DashboardItemShape shape, HttpServletRequest request, HttpServletResponse response) throws Exception {
DashboardItem item = dashboardService.getDashboardItem(uid);
if (item == null) {
throw new WebMessageException(WebMessageUtils.notFound("Dashboard item does not exist: " + uid));
}
Dashboard dashboard = dashboardService.getDashboardFromDashboardItem(item);
if (!aclService.canUpdate(currentUserService.getCurrentUser(), dashboard)) {
throw new UpdateAccessDeniedException("You don't have the proper permissions to update this dashboard.");
}
item.setShape(shape);
dashboardService.updateDashboardItem(item);
}
use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.UID in project dhis2-core by dhis2.
the class ChartController method getChart.
//--------------------------------------------------------------------------
// Get data
//--------------------------------------------------------------------------
@RequestMapping(value = { "/{uid}/data", "/{uid}/data.png" }, method = RequestMethod.GET)
public void getChart(@PathVariable("uid") String uid, @RequestParam(value = "date", required = false) Date date, @RequestParam(value = "ou", required = false) String ou, @RequestParam(value = "width", defaultValue = "800", required = false) int width, @RequestParam(value = "height", defaultValue = "500", required = false) int height, @RequestParam(value = "attachment", required = false) boolean attachment, HttpServletResponse response) throws IOException, WebMessageException {
Chart chart = chartService.getChartNoAcl(uid);
if (chart == null) {
throw new WebMessageException(WebMessageUtils.notFound("Chart does not exist: " + uid));
}
OrganisationUnit unit = ou != null ? organisationUnitService.getOrganisationUnit(ou) : null;
JFreeChart jFreeChart = chartService.getJFreeChart(chart, date, unit, i18nManager.getI18nFormat());
String filename = CodecUtils.filenameEncode(chart.getName()) + ".png";
contextUtils.configureResponse(response, ContextUtils.CONTENT_TYPE_PNG, CacheStrategy.RESPECT_SYSTEM_SETTING, filename, attachment);
ChartUtilities.writeChartAsPNG(response.getOutputStream(), jFreeChart, width, height);
}
Aggregations