+
+ /**
+ * Retrive CDS artifacts information from node template and save in resource object.
+ *
+ * @param nodeTemplate node template
+ * @return Returns CDS artifacts information
+ */
+ private JsonObject createCdsArtifactProperties(NodeTemplate nodeTemplate) {
+ Object artifactName = nodeTemplate.getPropertyValue("sdnc_model_name");
+ Object artifactVersion = nodeTemplate.getPropertyValue("sdnc_model_version");
+ if (artifactName != null && artifactVersion != null) {
+ CdsBpWorkFlowListResponse response = queryCdsToGetWorkFlowList(artifactName.toString(), artifactVersion.toString());
+ if (response == null) {
+ return null;
+ }
+
+ JsonObject workFlowProps = new JsonObject();
+ for (String workFlow : response.getWorkflows()) {
+ JsonObject inputs = queryCdsToGetWorkFlowInputProperties(response.getBlueprintName(),
+ response.getVersion(), workFlow);
+ workFlowProps.add(workFlow, inputs);
+ }
+
+ JsonObject controllerProperties = new JsonObject();
+ controllerProperties.addProperty("sdnc_model_name", artifactName.toString());
+ controllerProperties.addProperty("sdnc_model_version", artifactVersion.toString());
+ controllerProperties.add("workflows", workFlowProps);
+ return controllerProperties;
+ }
+ return null;
+ }
+
+ private CdsBpWorkFlowListResponse queryCdsToGetWorkFlowList(String artifactName, String artifactVersion) {
+ return cdsServices.getBlueprintWorkflowList(artifactName, artifactVersion);
+ }
+
+ private JsonObject queryCdsToGetWorkFlowInputProperties(String artifactName, String artifactVersion, String workFlow) {
+ return cdsServices.getWorkflowInputProperties(artifactName, artifactVersion, workFlow);
+ }