2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 ONAP
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.ccsdk.sli.core.sli.provider;
23 import java.util.Iterator;
27 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
28 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
29 import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
30 import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
31 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory;
34 public class ReturnNodeExecutor extends SvcLogicNodeExecutor {
36 private static final Logger LOG = LoggerFactory
37 .getLogger(ReturnNodeExecutor.class);
40 public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node,
41 SvcLogicContext ctx) throws SvcLogicException {
43 String status = SvcLogicExpressionResolver.evaluate(
44 node.getAttribute("status"), node, ctx);
47 if (LOG.isDebugEnabled()) {
48 LOG.debug("Returning status " + status);
50 ctx.setStatus(status);
52 if (LOG.isWarnEnabled()) {
53 LOG.warn("Return node has no status attribute set");
57 Set<Map.Entry<String, SvcLogicExpression>> parameterSet = node
60 for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parameterSet
61 .iterator(); iter.hasNext();) {
62 Map.Entry<String, SvcLogicExpression> curEnt = iter.next();
63 String curName = curEnt.getKey();
64 String curValue = SvcLogicExpressionResolver.evaluate(
65 curEnt.getValue(), node, ctx);
67 if (LOG.isDebugEnabled()) {
68 LOG.debug("Setting context attribute " + curName + " to "
71 ctx.setAttribute(curName, curValue);