use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.UID in project dhis2-core by dhis2.
the class AbstractEventService method deleteEvents.
@Override
public ImportSummaries deleteEvents(List<String> uids) {
ImportSummaries importSummaries = new ImportSummaries();
int counter = 0;
for (String uid : uids) {
importSummaries.addImportSummary(deleteEvent(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 AbstractEnrollmentService method deleteEnrollments.
@Override
public ImportSummaries deleteEnrollments(List<String> uids) {
ImportSummaries importSummaries = new ImportSummaries();
int counter = 0;
for (String uid : uids) {
importSummaries.addImportSummary(deleteEnrollment(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 MapController method putJsonObject.
@Override
@RequestMapping(value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void putJsonObject(@PathVariable String uid, HttpServletRequest request, HttpServletResponse response) throws Exception {
Map map = mappingService.getMap(uid);
if (map == null) {
throw new WebMessageException(WebMessageUtils.notFound("Map does not exist: " + uid));
}
MetadataImportParams params = importService.getParamsFromMap(contextService.getParameterValuesMap());
Map newMap = deserializeJsonEntity(request, response);
newMap.setUid(uid);
mergeService.merge(new MergeParams<>(newMap, map).setMergeMode(params.getMergeMode()));
mappingService.updateMap(map);
}
use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.UID in project dhis2-core by dhis2.
the class SmsGatewayController method getGatewayConfiguration.
@PreAuthorize("hasRole('ALL') or hasRole('F_MOBILE_SENDSMS')")
@RequestMapping(value = "/{uid}", method = RequestMethod.GET, produces = "application/json")
public void getGatewayConfiguration(@PathVariable String uid, HttpServletRequest request, HttpServletResponse response) throws WebMessageException, IOException {
SmsGatewayConfig gateway = gatewayAdminService.getGatewayConfigurationByUid(uid);
if (gateway == null) {
throw new WebMessageException(WebMessageUtils.notFound("No gateway found"));
}
renderService.toJson(response.getOutputStream(), gateway);
}
use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.UID in project dhis2-core by dhis2.
the class EventController method putJsonEventForEventDate.
@RequestMapping(value = "/{uid}/eventDate", method = RequestMethod.PUT, consumes = "application/json")
@PreAuthorize("hasRole('ALL') or hasRole('F_TRACKED_ENTITY_DATAVALUE_ADD')")
public void putJsonEventForEventDate(HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid, ImportOptions importOptions) throws IOException, WebMessageException {
if (!programStageInstanceService.programStageInstanceExists(uid)) {
throw new WebMessageException(WebMessageUtils.notFound("Event not found for ID " + uid));
}
InputStream inputStream = StreamUtils.wrapAndCheckCompressionFormat(request.getInputStream());
Event updatedEvent = renderService.fromJson(inputStream, Event.class);
updatedEvent.setEvent(uid);
eventService.updateEventForEventDate(updatedEvent);
webMessageService.send(WebMessageUtils.ok("Event updated " + uid), response, request);
}
Aggregations