+ try {
+ this.restTemplate.delete(url, uriVariables);
+ return new ResponseEntity<>(HttpStatus.OK);
+ } catch (Exception e) {
+ return new ResponseEntity<>(e.getMessage(), HttpStatus.NOT_FOUND);
+ }
+
+ }
+
+ @Value.Immutable
+ @Gson.TypeAdapters
+ interface RicInfo {
+ public String ricName();
+
+ public Collection<String> nodeNames();
+
+ public Collection<String> policyTypes();
+ }
+
+ @Override
+ public ResponseEntity<String> getRicsSupportingType(String typeName) {
+ String url = baseUrl() + "/rics?policyType={typeName}";
+ Map<String, ?> uriVariables = Map.of("typeName", typeName);
+ String rsp = this.restTemplate.getForObject(url, String.class, uriVariables);
+
+ try {
+ Type listType = new TypeToken<List<ImmutableRicInfo>>() {
+ }.getType();
+ List<RicInfo> rspParsed = gson.fromJson(rsp, listType);
+ Collection<String> result = new Vector<>(rspParsed.size());
+ for (RicInfo ric : rspParsed) {
+ result.add(ric.ricName());
+ }
+ return new ResponseEntity<>(gson.toJson(result), HttpStatus.OK);
+ } catch (Exception e) {
+ return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+
+ private HttpEntity<Object> createJsonHttpEntity(Object content) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ return new HttpEntity<Object>(content, headers);