use of org.hisp.dhis.mapping.Map in project dhis2-core by dhis2.
the class InterpretationController method writeMapInterpretation.
@RequestMapping(value = "/map/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" })
public void writeMapInterpretation(@PathVariable("uid") String uid, @RequestBody String text, HttpServletResponse response, HttpServletRequest request) throws WebMessageException {
Map map = idObjectManager.get(Map.class, uid);
if (map == null) {
throw new WebMessageException(WebMessageUtils.conflict("Map does not exist or is not accessible: " + uid));
}
createIntepretation(new Interpretation(map, text), request, response);
}
use of org.hisp.dhis.mapping.Map in project dhis2-core by dhis2.
the class MapController method deserializeJsonEntity.
@Override
protected Map deserializeJsonEntity(HttpServletRequest request, HttpServletResponse response) throws IOException {
Map map = super.deserializeJsonEntity(request, response);
mergeMap(map);
return map;
}
use of org.hisp.dhis.mapping.Map in project dhis2-core by dhis2.
the class GeoToolsMapGenerationService method generateMapImage.
// -------------------------------------------------------------------------
// MapGenerationService implementation
// -------------------------------------------------------------------------
@Override
public BufferedImage generateMapImage(MapView mapView) {
Map map = new Map();
map.getMapViews().add(mapView);
return generateMapImage(map);
}
use of org.hisp.dhis.mapping.Map in project dhis2-core by dhis2.
the class DashboardCascadeSharingTest method testDryRunTrue.
@Test
void testDryRunTrue() {
Map map = createMap("A");
map.setSharing(Sharing.builder().publicAccess(DEFAULT).build());
objectManager.save(map, false);
Dashboard dashboard = createDashboardWithItem("A", sharingReadForUserA);
dashboard.getItems().get(0).setMap(map);
objectManager.save(dashboard, false);
CascadeSharingReport report = cascadeSharingService.cascadeSharing(dashboard, CascadeSharingParameters.builder().dryRun(true).build());
assertEquals(0, report.getErrorReports().size());
assertEquals(1, report.getUpdateObjects().size());
assertFalse(aclService.canRead(userA, dashboard.getItems().get(0).getMap()));
assertFalse(aclService.canRead(userB, dashboard.getItems().get(0).getMap()));
}
use of org.hisp.dhis.mapping.Map in project dhis2-core by dhis2.
the class DashboardCascadeSharingTest method testUserGroup.
@Test
void testUserGroup() {
Map mapA = createMap("A");
mapA.setSharing(defaultSharing());
objectManager.save(mapA, false);
Map mapB = createMap("A");
mapB.setSharing(defaultSharing());
objectManager.save(mapB, false);
DashboardItem itemA = createDashboardItem("A");
itemA.setMap(mapA);
DashboardItem itemB = createDashboardItem("B");
itemB.setMap(mapB);
Dashboard dashboard = createDashboard("A", sharingUserGroupA);
dashboard.getItems().add(itemB);
dashboard.getItems().add(itemA);
objectManager.save(dashboard, false);
CascadeSharingReport report = cascadeSharingService.cascadeSharing(dashboard, CascadeSharingParameters.builder().build());
assertEquals(0, report.getErrorReports().size());
assertEquals(1, report.getUpdateObjects().size());
assertTrue(aclService.canRead(userA, mapA));
assertTrue(aclService.canRead(userA, mapB));
}
Aggregations