Support get resource recipe groovy common method 45/34445/1
authorc00149107 <chenchuanyu@huawei.com>
Wed, 7 Mar 2018 07:22:36 +0000 (15:22 +0800)
committerc00149107 <chenchuanyu@huawei.com>
Wed, 7 Mar 2018 07:22:36 +0000 (15:22 +0800)
Support get resource recipe groovy common method

Change-Id: Iec7efcf162465cdef4be9093697a5b094a3020bb
Issue-ID: SO-452
Signed-off-by: c00149107 <chenchuanyu@huawei.com>
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