summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>2019-01-04 15:03:29 +0000
committerKevin Smokowski <kevin.smokowski@att.com>2019-01-04 18:20:01 +0000
commit0aa220d048e03fea673d17e15423ffac60078b38 (patch)
treef4dcfa6543531929849e05e039e7f8aebe46b090
parent62e62331a294052109f02686e4529fe613355990 (diff)
TemplateNode update
push parameter values into velocity context to simplify how parameters are used in templates Change-Id: Ic8b4c56ef303ed9447bb1a62300c04c4accb2d6a Issue-ID: CCSDK-911 Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
-rw-r--r--template-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/template/TemplateNode.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/template-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/template/TemplateNode.java b/template-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/template/TemplateNode.java
index 0b5850a0..7310b3fb 100644
--- a/template-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/template/TemplateNode.java
+++ b/template-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/template/TemplateNode.java
@@ -25,6 +25,7 @@ package org.onap.ccsdk.sli.plugins.template;
import java.io.FileInputStream;
import java.io.StringWriter;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
@@ -97,6 +98,10 @@ public class TemplateNode implements SvcLogicJavaPlugin {
VelocityContext context = new VelocityContext();
context.put("ctx", ctx);
context.put("params", params);
+ //Adding these values directly to context makes working with the values cleaner
+ for (Entry<String, String> entry : params.entrySet()) {
+ context.put(entry.getKey(), entry.getValue());
+ }
StringWriter sw = new StringWriter();
template.merge(context, sw);
ctx.setAttribute(outputPath, sw.toString());
@@ -106,4 +111,4 @@ public class TemplateNode implements SvcLogicJavaPlugin {
}
}
-} \ No newline at end of file
+}