diff options
Diffstat (limited to 'sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java')
-rw-r--r-- | sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java index a51accbb..9bab745b 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java @@ -21,9 +21,15 @@ package org.onap.ccsdk.sli.core.sli.provider.base; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicExpression; import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder; @@ -36,6 +42,8 @@ public abstract class AbstractSvcLogicNodeExecutor { public abstract SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException; private static final Logger LOG = LoggerFactory.getLogger(AbstractSvcLogicNodeExecutor.class); + protected static final String PARAMETER_DEBUG_PATTERN = "Parameter: {} resolves to: {} which came from the expression: {}"; + protected static final String SETTING_DEBUG_PATTERN = "Setting context attribute: {} to: {} which came from the expression: {}"; protected String evaluateNodeTest(SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { @@ -90,4 +98,23 @@ public abstract class AbstractSvcLogicNodeExecutor { return (nextNode); } + protected Map<String, String> getResolvedParameters(SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException{ + Map<String, String> parmMap = new HashMap<>(); + + Set<Map.Entry<String, SvcLogicExpression>> parmSet = node + .getParameterSet(); + + for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet + .iterator(); iter.hasNext();) { + Map.Entry<String, SvcLogicExpression> curEnt = iter.next(); + String curName = curEnt.getKey(); + SvcLogicExpression curExpr = curEnt.getValue(); + String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx); + LOG.trace(PARAMETER_DEBUG_PATTERN, curName, curExprValue, curExpr.toString()); + parmMap.put(curName,curExprValue); + } + + return parmMap; + } + } |