diff options
author | Dan Timoney <dtimoney@att.com> | 2017-12-19 14:36:21 -0500 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2017-12-19 14:36:21 -0500 |
commit | 50e04450a21eb584fb843fbe009b29798b94a413 (patch) | |
tree | 6552cec4db732a75aca04cd0c1ffca3a89a6ab2d /sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java | |
parent | a2a1997c4976499912dae2aadef52a73c764840b (diff) |
New sliPluginUtils methods
Add new sliPluginUtils methods to faciliate accessing data
in context memory (SvcLogicContext).
Change-Id: I70fe00fd60ac6da4804a41df0a2ef7c51e80f4a0
Issue-ID: CCSDK-158
Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java')
-rw-r--r-- | sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java index 0c43f685..6402abd6 100644 --- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java +++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,7 @@ package org.onap.ccsdk.sli.core.slipluginutils; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Map; - +import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -38,6 +38,9 @@ import org.slf4j.LoggerFactory; public class SliStringUtils implements SvcLogicJavaPlugin { private static final Logger LOG = LoggerFactory.getLogger(SliStringUtils.class); + public static String INPUT_PARAM_SOURCE = "source"; + public static String INPUT_PARAM_TARGET = "target"; + public SliStringUtils() {} /** @@ -393,4 +396,21 @@ public class SliStringUtils implements SvcLogicJavaPlugin { } } + /** + * xmlEscapeText() will be used to format input xml with text. + * + * @param inParams + * accepts the instance of {@link Map} holds the input xml in string + * format. + * @param ctx + * accepts the instance of {@link SvcLogicContext} holds the service + * logic context. + * + */ + public static void xmlEscapeText(Map<String, String> inParams, SvcLogicContext ctx) { + String source = inParams.get(INPUT_PARAM_SOURCE); + String target = inParams.get(INPUT_PARAM_TARGET); + source = StringEscapeUtils.escapeXml(source); + ctx.setAttribute(target, source); + } } |