diff options
Diffstat (limited to 'appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config')
-rw-r--r-- | appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/merge/MergeNode.java | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/merge/MergeNode.java b/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/merge/MergeNode.java index e8c530486..908965ca7 100644 --- a/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/merge/MergeNode.java +++ b/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/merge/MergeNode.java @@ -53,23 +53,23 @@ public class MergeNode implements SvcLogicJavaPlugin { responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : ""; String jsonData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA); if (StringUtils.isBlank(jsonData)) { - throw new ParameterMissingException("JSON Data is missing"); - } - - String templateData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA); - String templateFile = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_FILE); - - if (StringUtils.isBlank(templateData) && StringUtils.isBlank(templateFile)) { - throw new ParameterMissingException("Template data or Template file is missing"); - } - if (StringUtils.isBlank(templateData)) { - templateData = IOUtils.toString( - MergeNode.class.getClassLoader().getResourceAsStream(templateFile), "UTF-8"); + log.info("No JSON data to merge with template"); + } else { + String templateData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA); + String templateFile = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_FILE); + + if (StringUtils.isBlank(templateData) && StringUtils.isBlank(templateFile)) { + throw new ParameterMissingException("Template data or Template file is missing"); + } + if (StringUtils.isBlank(templateData)) { + templateData = IOUtils.toString( + MergeNode.class.getClassLoader().getResourceAsStream(templateFile), "UTF-8"); + } + + Map<String, String> dataMap = JSONTool.convertToProperties(jsonData); + log.info("Data Maps created :" + dataMap); + trySetContextAttribute(ctx, responsePrefix, templateData, dataMap); } - - Map<String, String> dataMap = JSONTool.convertToProperties(jsonData); - log.info("Data Maps created :" + dataMap); - trySetContextAttribute(ctx, responsePrefix, templateData, dataMap); ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS); log.info("Data Merge Successful :" + ctx); |