Merge "Support get resource recipe groovy common method"
authorChuanyu Chen <chenchuanyu@huawei.com>
Wed, 7 Mar 2018 09:25:57 +0000 (09:25 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 7 Mar 2018 09:25:57 +0000 (09:25 +0000)
bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy

index dd6e56a..921e0ee 100644 (file)
@@ -1203,4 +1203,25 @@ class CatalogDbUtils {
                }\r
 \r
        }\r
+       \r
+    /**\r
+     * get resource recipe by resource model uuid and action\r
+     */\r
+    public JSONObject getResourceRecipe(Execution execution, String resourceModelUuid, String action) {\r
+        String endPoint = "/resourceRecipe?resourceModelUuid=" + UriUtils.encode(resourceModelUuid, "UTF-8")+ "&action=" + UriUtils.encode(action, "UTF-8")\r
+        JSONObject responseJson = null\r
+        try {\r
+            msoLogger.debug("ENDPOINT: " + endPoint)\r
+            String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
+\r
+            if (catalogDbResponse != null) {\r
+                responseJson = new JSONObject(catalogDbResponse)\r
+            }\r
+        }\r
+        catch (Exception e) {\r
+            utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)\r
+        }\r
+\r
+        return responseJson\r
+    }\r
 }
\ No newline at end of file