@Test public void shouldGetGeographicZoneById() { GeographicZone geographicZone = new GeographicZone(); Long geoZoneId = 1L; when(service.getById(geoZoneId)).thenReturn(geographicZone); ResponseEntity<OpenLmisResponse> response = controller.get(geoZoneId); assertThat((GeographicZone) response.getBody().getData().get("geoZone"), is(geographicZone)); verify(service).getById(geoZoneId); }
@RequestMapping(value = "/geographicZones/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION, MANAGE_GEOGRAPHIC_ZONE')") public ResponseEntity<OpenLmisResponse> get(@PathVariable Long id) { return OpenLmisResponse.response("geoZone", service.getById(id)); }
GeographicZoneController extends BaseController { @RequestMapping(value = "/geographicZones/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION, MANAGE_GEOGRAPHIC_ZONE')") public ResponseEntity<OpenLmisResponse> get(@PathVariable Long id) { return OpenLmisResponse.response("geoZone", service.getById(id)); } }
GeographicZoneController extends BaseController { @RequestMapping(value = "/geographicZones/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION, MANAGE_GEOGRAPHIC_ZONE')") public ResponseEntity<OpenLmisResponse> get(@PathVariable Long id) { return OpenLmisResponse.response("geoZone", service.getById(id)); }  }
GeographicZoneController extends BaseController { @RequestMapping(value = "/geographicZones/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION, MANAGE_GEOGRAPHIC_ZONE')") public ResponseEntity<OpenLmisResponse> get(@PathVariable Long id) { return OpenLmisResponse.response("geoZone", service.getById(id)); }  @RequestMapping(value = "/geographicZones/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION, MANAGE_GEOGRAPHIC_ZONE')") ResponseEntity<OpenLmisResponse> get(@PathVariable Long id); @RequestMapping(value = "/geographicZones", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") ResponseEntity<OpenLmisResponse> insert(@RequestBody GeographicZone geographicZone,
                                                 HttpServletRequest request); @RequestMapping(value = "/geographicZones/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") ResponseEntity<OpenLmisResponse> update(@RequestBody GeographicZone geographicZone,
                                                 @PathVariable("id") Long id,
                                                 HttpServletRequest request); @RequestMapping(value = "/geographicZones", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") ResponseEntity<OpenLmisResponse> search(@RequestParam(value = "searchParam") String searchParam,
                                                 @RequestParam(value = "columnName") String columnName,
                                                 @RequestParam(value = "page", defaultValue = "1") Integer page); @RequestMapping(value = "/geographicLevels", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") List<GeographicLevel> getAllGeographicLevels(); @RequestMapping(value = "/parentGeographicZones/{geoLevelCode}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") List<GeographicZone> getAllGeographicZonesAbove(@PathVariable("geoLevelCode") String geographicLevelCode); @RequestMapping(value = "/filtered-geographicZones", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE, MANAGE_SUPERVISORY_NODE, MANAGE_REQUISITION_GROUP, MANAGE_SUPPLY_LINE, MANAGE_USER')") ResponseEntity<OpenLmisResponse> getGeographicZoneByCodeOrName(@RequestParam(value = "searchParam") String searchParam,
                                                                        @Value("${search.results.limit}") String searchLimit); @RequestMapping(value = "/geographic-zone/save-gis", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") ResponseEntity<OpenLmisResponse> saveGeographicZoneGIS(@RequestBody GeoZoneInfo geoZoneGeometries, HttpServletRequest request); }
GeographicZoneController extends BaseController { @RequestMapping(value = "/geographicZones/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION, MANAGE_GEOGRAPHIC_ZONE')") public ResponseEntity<OpenLmisResponse> get(@PathVariable Long id) { return OpenLmisResponse.response("geoZone", service.getById(id)); }  @RequestMapping(value = "/geographicZones/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION, MANAGE_GEOGRAPHIC_ZONE')") ResponseEntity<OpenLmisResponse> get(@PathVariable Long id); @RequestMapping(value = "/geographicZones", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") ResponseEntity<OpenLmisResponse> insert(@RequestBody GeographicZone geographicZone,
                                                 HttpServletRequest request); @RequestMapping(value = "/geographicZones/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") ResponseEntity<OpenLmisResponse> update(@RequestBody GeographicZone geographicZone,
                                                 @PathVariable("id") Long id,
                                                 HttpServletRequest request); @RequestMapping(value = "/geographicZones", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") ResponseEntity<OpenLmisResponse> search(@RequestParam(value = "searchParam") String searchParam,
                                                 @RequestParam(value = "columnName") String columnName,
                                                 @RequestParam(value = "page", defaultValue = "1") Integer page); @RequestMapping(value = "/geographicLevels", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") List<GeographicLevel> getAllGeographicLevels(); @RequestMapping(value = "/parentGeographicZones/{geoLevelCode}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") List<GeographicZone> getAllGeographicZonesAbove(@PathVariable("geoLevelCode") String geographicLevelCode); @RequestMapping(value = "/filtered-geographicZones", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE, MANAGE_SUPERVISORY_NODE, MANAGE_REQUISITION_GROUP, MANAGE_SUPPLY_LINE, MANAGE_USER')") ResponseEntity<OpenLmisResponse> getGeographicZoneByCodeOrName(@RequestParam(value = "searchParam") String searchParam,
                                                                        @Value("${search.results.limit}") String searchLimit); @RequestMapping(value = "/geographic-zone/save-gis", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_GEOGRAPHIC_ZONE')") ResponseEntity<OpenLmisResponse> saveGeographicZoneGIS(@RequestBody GeoZoneInfo geoZoneGeometries, HttpServletRequest request); static final String GEO_ZONES; }