Merge "Blueprint exception handler and REST responses"
[ccsdk/apps.git] / ms / controllerblueprints / modules / service / src / main / java / org / onap / ccsdk / apps / controllerblueprints / service / rs / BlueprintModelRest.java
index 9d0b1e3..255137b 100644 (file)
@@ -42,31 +42,38 @@ public class BlueprintModelRest {
 \r
     @PostMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)\r
     public @ResponseBody\r
-    Mono<BlueprintModelSearch> saveBluePrint(@RequestPart("file") FilePart file) throws BluePrintException{\r
+    Mono<BlueprintModelSearch> saveBlueprint(@RequestPart("file") FilePart file) throws BluePrintException{\r
         return blueprintModelService.saveBlueprintModel(file);\r
     }\r
 \r
     @DeleteMapping(path = "/{id}")\r
-    public void deleteBluePrint(@PathVariable(value = "id") String id) throws BluePrintException {\r
+    public void deleteBlueprint(@PathVariable(value = "id") String id) throws BluePrintException {\r
         this.blueprintModelService.deleteBlueprintModel(id);\r
     }\r
 \r
     @GetMapping(path = "/by-name/{name}/version/{version}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
-    BlueprintModelSearch getBluePrintByNameAndVersion(@PathVariable(value = "name") String name,\r
-                                                          @PathVariable(value = "version") String version) throws BluePrintException {\r
-        return this.blueprintModelService.getBlueprintModelByNameAndVersion(name, version);\r
+    BlueprintModelSearch getBlueprintByNameAndVersion(@PathVariable(value = "name") String name,\r
+                                                      @PathVariable(value = "version") String version) throws BluePrintException {\r
+        return this.blueprintModelService.getBlueprintModelSearchByNameAndVersion(name, version);\r
+    }\r
+\r
+    @GetMapping(path = "/download/by-name/{name}/version/{version}", produces = MediaType.APPLICATION_JSON_VALUE)\r
+    public @ResponseBody\r
+    ResponseEntity<Resource> downloadBlueprintByNameAndVersion(@PathVariable(value = "name") String name,\r
+                                                               @PathVariable(value = "version") String version) throws BluePrintException {\r
+        return this.blueprintModelService.downloadBlueprintModelFileByNameAndVersion(name, version);\r
     }\r
 \r
     @GetMapping(path = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
-    BlueprintModelSearch getCBA(@PathVariable(value = "id") String id) throws BluePrintException {\r
+    BlueprintModelSearch getBlueprintModel(@PathVariable(value = "id") String id) throws BluePrintException {\r
         return this.blueprintModelService.getBlueprintModelSearch(id);\r
     }\r
 \r
     @GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
-    List<BlueprintModelSearch> getAllCBA() {\r
+    List<BlueprintModelSearch> getAllBlueprintModel() {\r
         return this.blueprintModelService.getAllBlueprintModel();\r
     }\r
 \r
@@ -76,7 +83,7 @@ public class BlueprintModelRest {
         return this.blueprintModelService.downloadBlueprintModelFile(id);\r
     }\r
 \r
-    @GetMapping(path = "/publish/{id}", produces = MediaType.APPLICATION_JSON_VALUE)\r
+    @PutMapping(path = "/publish/{id}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     BlueprintModelSearch publishBlueprintModel(@PathVariable(value = "id") String id) throws BluePrintException {\r
         return this.blueprintModelService.publishBlueprintModel(id);\r