1 package org.onap.nbi.apis.servicecatalog;
3 import java.util.LinkedHashMap;
5 import org.onap.nbi.commons.JsonRepresentation;
6 import org.onap.nbi.commons.Resource;
7 import org.onap.nbi.commons.ResourceManagement;
8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.http.MediaType;
10 import org.springframework.http.ResponseEntity;
11 import org.springframework.util.MultiValueMap;
12 import org.springframework.web.bind.annotation.GetMapping;
13 import org.springframework.web.bind.annotation.PathVariable;
14 import org.springframework.web.bind.annotation.RequestMapping;
15 import org.springframework.web.bind.annotation.RequestParam;
16 import org.springframework.web.bind.annotation.RestController;
19 @RequestMapping("/serviceSpecification")
20 public class ServiceSpecificationResource extends ResourceManagement<Resource> {
24 ServiceSpecificationService serviceSpecificationService;
26 @GetMapping(value = "/{serviceSpecId}", produces = MediaType.APPLICATION_JSON_VALUE)
27 public ResponseEntity<Object> getServiceSpecification(@PathVariable String serviceSpecId,
28 @RequestParam MultiValueMap<String, String> params) {
29 LinkedHashMap response = serviceSpecificationService.get(serviceSpecId);
30 JsonRepresentation filter = new JsonRepresentation(params);
31 if (response.get("serviceSpecCharacteristic") != null) {
32 return this.getResponse(response, filter);
34 return this.getPartialResponse(response, filter);
39 @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
40 public ResponseEntity<Object> findServiceSpecification(@RequestParam MultiValueMap<String, String> params) {
41 List<LinkedHashMap> response = serviceSpecificationService.find(params);
42 JsonRepresentation filter = new JsonRepresentation(params);
43 return this.findResponse(response, filter, null);