From 898ccabd60d1eea9c638386793b2a40215418b5f Mon Sep 17 00:00:00 2001 From: "Smokowski, Kevin (ks6305)" Date: Wed, 25 Apr 2018 21:13:56 +0000 Subject: add replaceAll to slistringutils add replaceAll to slistringutils because it supports regular expressions and replace does not Change-Id: Ibff7acd339103a6bb897d14ca3d31736a5b568ef Issue-ID: CCSDK-253 Signed-off-by: Smokowski, Kevin (ks6305) --- .../sli/core/slipluginutils/SliStringUtils.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'sliPluginUtils/provider/src/main') 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 6402abd6..63c750cb 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 @@ -304,6 +304,28 @@ public class SliStringUtils implements SvcLogicJavaPlugin { ctx.setAttribute(parameters.get("outputPath"), (parameters.get("source").replace(parameters.get("target"), parameters.get("replacement")))); } + /** + * exposes replaceAll to directed graph + * writes the length of source to outputPath + * @param parameters HashMap of parameters passed by the DG to this function + * + * + * + * + * + * + * + * + *
parameterMandatory/Optionaldescription
sourceMandatorysource string
targetMandatoryThis should be a valid regular expression
replacementMandatoryThe replacement sequence of char values
outputPathMandatorythe location in context memory the result is written to
+ * @param ctx Reference to context memory + * @throws SvcLogicException + * @since 11.0.2 + */ + public static void replaceAll(Map parameters, SvcLogicContext ctx) throws SvcLogicException { + SliPluginUtils.checkParameters(parameters, new String[]{"source","outputPath","target","replacement"}, LOG); + ctx.setAttribute(parameters.get("outputPath"), parameters.get("source").replaceAll(parameters.get("target"), parameters.get("replacement"))); + } + /** * Provides substring functionality to Directed Graphs. *

-- cgit 1.2.3-korg