- public ResponseEntity<String> getPolicyTypes() {
-
- Collection<PolicyType> types = this.policyTypes.getAll();
- return new ResponseEntity<String>(policyTypesToJson(types), HttpStatus.OK);
+ @ApiOperation(value = "Returns all the policy types")
+ @ApiResponses(value = {@ApiResponse(code = 200, message = "Policy Types found")})
+ public ResponseEntity<String> getPolicyTypes(@RequestParam(name = "ric", required = false) String ricName) {
+ if (ricName == null) {
+ Collection<PolicyType> types = this.policyTypes.getAll();
+ return new ResponseEntity<String>(policyTypesToJson(types), HttpStatus.OK);
+ } else {
+ try {
+ Collection<PolicyType> types = rics.getRic(ricName).getSupportedPolicyTypes();
+ return new ResponseEntity<String>(policyTypesToJson(types), HttpStatus.OK);
+ } catch (ServiceException e) {
+ return new ResponseEntity<String>(e.toString(), HttpStatus.NOT_FOUND);
+ }
+ }