Merge "Enable blueprintprocessor and vlantag-api"
[ccsdk/apps.git] / ms / controllerblueprints / modules / service / src / main / java / org / onap / ccsdk / apps / controllerblueprints / service / rs / ModelTypeRest.java
index f6e5c27..0f485a0 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -20,8 +21,6 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
 import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;\r
 import org.springframework.http.MediaType;\r
-import org.springframework.stereotype.Component;\r
-import org.springframework.stereotype.Service;\r
 import org.springframework.web.bind.annotation.*;\r
 \r
 import java.util.List;\r
@@ -45,49 +44,29 @@ public class ModelTypeRest {
     }\r
 \r
     @GetMapping(path = "/{name}", produces = MediaType.APPLICATION_JSON_VALUE)\r
-    public ModelType getModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {\r
-        try {\r
-            return modelTypeService.getModelTypeByName(name);\r
-        } catch (Exception e) {\r
-            throw new BluePrintException(1000, e.getMessage(), e);\r
-        }\r
+    public ModelType getModelTypeByName(@PathVariable(value = "name") String name) {\r
+        return modelTypeService.getModelTypeByName(name);\r
     }\r
 \r
     @GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)\r
-    public List<ModelType> searchModelTypes(@PathVariable(value = "tags") String tags) throws BluePrintException {\r
-        try {\r
-            return modelTypeService.searchModelTypes(tags);\r
-        } catch (Exception e) {\r
-            throw new BluePrintException(1001, e.getMessage(), e);\r
-        }\r
+    public List<ModelType> searchModelTypes(@PathVariable(value = "tags") String tags) {\r
+        return modelTypeService.searchModelTypes(tags);\r
     }\r
 \r
     @GetMapping(path = "/by-definition/{definitionType}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
-    List<ModelType> getModelTypeByDefinitionType(@PathVariable(value = "definitionType") String definitionType) throws BluePrintException {\r
-        try {\r
-            return modelTypeService.getModelTypeByDefinitionType(definitionType);\r
-        } catch (Exception e) {\r
-            throw new BluePrintException(1002, e.getMessage(), e);\r
-        }\r
+    List<ModelType> getModelTypeByDefinitionType(@PathVariable(value = "definitionType") String definitionType) {\r
+        return modelTypeService.getModelTypeByDefinitionType(definitionType);\r
     }\r
 \r
-    @PostMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\r
+    @PostMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ModelType saveModelType(@RequestBody ModelType modelType) throws BluePrintException {\r
-        try {\r
-            return modelTypeService.saveModel(modelType);\r
-        } catch (Exception e) {\r
-            throw new BluePrintException(1100, e.getMessage(), e);\r
-        }\r
+        return modelTypeService.saveModel(modelType);\r
     }\r
 \r
     @DeleteMapping(path = "/{name}")\r
-    public void deleteModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {\r
-        try {\r
-            modelTypeService.deleteByModelName(name);\r
-        } catch (Exception e) {\r
-            throw new BluePrintException(1400, e.getMessage(), e);\r
-        }\r
+    public void deleteModelTypeByName(@PathVariable(value = "name") String name) {\r
+        modelTypeService.deleteByModelName(name);\r
     }\r
 }\r