- private static String getUpdatedBlueprintWithServiceConf(RefProp refProp, ModelProperties prop, String yamlValue,
- ObjectNode serviceConf) throws IOException {
- Yaml yaml = new Yaml();
-
- // Serialiaze Yaml file
- Map<String, Map> loadedYaml = (Map<String, Map>) yaml.load(yamlValue);
- // Get node templates information from Yaml
- Map<String, Map> nodeTemplates = loadedYaml.get("node_templates");
- logger.info("value of NodeTemplates:" + nodeTemplates);
-
- // Get StringMatch Object information from node templates of Yaml
- Map<String, Map> smObject = nodeTemplates.get("SM");
- logger.info("value of StringMatch:" + smObject);
-
- // Get Properties Object information from stringmatch of Yaml
- Map<String, String> propsObject = smObject.get("properties");
- logger.info("value of PropsObject:" + propsObject);
-
- String deploymentJsonObject = propsObject.get("deployment_JSON");
- logger.info("value of deploymentJson:" + deploymentJsonObject);
-
- ObjectMapper mapper = new ObjectMapper();
- ObjectNode deployJsonNode = (ObjectNode) mapper.readTree(deploymentJsonObject);
- ObjectNode configurationObjectNode = (ObjectNode) deployJsonNode.get("configuration");
-
- // "policyName":"example_model06.ClosedLoop_FRWL_SIG_0538e6f2_8c1b_4656_9999_3501b3c59ad7_StringMatch_",
- String policyNamePrefix = refProp.getStringValue("policy.ms.policyNamePrefix");
- String policyName = prop.getCurrentPolicyScopeAndFullPolicyName(policyNamePrefix);
- configurationObjectNode.put("policyName", policyName);
-
- // "closedLoopControlName":"ClosedLoop-FRWL-SIG-0538e6f2-8c1b-4656-9999-3501b3c59ad7",
- configurationObjectNode.put("closedLoopControlName", prop.getControlName());
- configurationObjectNode.put("messageReaderConsumerGroup", prop.getModelName());
- configurationObjectNode.set("serviceConfigurations", serviceConf);
- propsObject.put("deployment_JSON", deployJsonNode.toString());
- String blueprint = yaml.dump(loadedYaml);
- logger.info("value of updated Yaml File:" + blueprint);
-
- blueprint = yaml.dump(loadedYaml);
- logger.info("value of updated Yaml File:" + blueprint);
-
- return blueprint;
- }
-