- String policiesJson;
- try {
- policiesJson = policiesToJson(result);
- } catch (ServiceException e) {
- return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
- }
- return new ResponseEntity<>(policiesJson, HttpStatus.OK);
+ @GetMapping("/policy_ids")
+ @ApiOperation(value = "Query policies, only IDs returned")
+ @ApiResponses(
+ value = {@ApiResponse(code = 200, message = "Policy ids", response = String.class, responseContainer = "List"),
+ @ApiResponse(code = 404, message = "RIC or type not found", response = String.class)})
+ public ResponseEntity<String> getPolicyIds( //
+ @RequestParam(name = "type", required = false) String type, //
+ @RequestParam(name = "ric", required = false) String ric, //
+ @RequestParam(name = "service", required = false) String service) //
+ {
+ if ((type != null && this.policyTypes.get(type) == null)) {
+ return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND);
+ }
+ if ((ric != null && this.rics.get(ric) == null)) {
+ return new ResponseEntity<>("RIC not found", HttpStatus.NOT_FOUND);
+ }
+ synchronized (policies) {
+ String policyIdsJson = toPolicyIdsJson(filter(type, ric, service));
+ return new ResponseEntity<>(policyIdsJson, HttpStatus.OK);