Code Review
/
ccsdk
/
sli
/
plugins.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Sonar fix: TemplateNode.java"
[ccsdk/sli/plugins.git]
/
template-node
/
provider
/
src
/
main
/
java
/
org
/
onap
/
ccsdk
/
sli
/
plugins
/
template
/
TemplateNode.java
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
old mode 100644
(file)
new mode 100755
(executable)
index
3d72ce7
..
a78b81e
--- 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.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;
import java.util.Properties;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
@@
-52,6
+53,7
@@
public class TemplateNode implements SvcLogicJavaPlugin {
ve = new VelocityEngine();
setProperties();
ve.init();
ve = new VelocityEngine();
setProperties();
ve.init();
+ ve.loadDirective("org.onap.ccsdk.sli.plugins.template.HideNullJson");
}
protected void setProperties() {
}
protected void setProperties() {
@@
-97,6
+99,10
@@
public class TemplateNode implements SvcLogicJavaPlugin {
VelocityContext context = new VelocityContext();
context.put("ctx", ctx);
context.put("params", params);
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());
StringWriter sw = new StringWriter();
template.merge(context, sw);
ctx.setAttribute(outputPath, sw.toString());
@@
-106,4
+112,4
@@
public class TemplateNode implements SvcLogicJavaPlugin {
}
}
}
}
-}
\ No newline at end of file
+}