2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.openecomp.sdnc.sli.provider;
24 import java.util.Iterator;
28 import org.openecomp.sdnc.sli.SvcLogicContext;
29 import org.openecomp.sdnc.sli.SvcLogicException;
30 import org.openecomp.sdnc.sli.SvcLogicExpression;
31 import org.openecomp.sdnc.sli.SvcLogicNode;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
35 public class ReturnNodeExecutor extends SvcLogicNodeExecutor {
37 private static final Logger LOG = LoggerFactory
38 .getLogger(ReturnNodeExecutor.class);
41 public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node,
42 SvcLogicContext ctx) throws SvcLogicException {
44 String status = SvcLogicExpressionResolver.evaluate(
45 node.getAttribute("status"), node, ctx);
48 if (LOG.isDebugEnabled()) {
49 LOG.debug("Returning status " + status);
51 ctx.setStatus(status);
53 if (LOG.isWarnEnabled()) {
54 LOG.warn("Return node has no status attribute set");
58 Set<Map.Entry<String, SvcLogicExpression>> parameterSet = node
61 for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parameterSet
62 .iterator(); iter.hasNext();) {
63 Map.Entry<String, SvcLogicExpression> curEnt = iter.next();
64 String curName = curEnt.getKey();
65 String curValue = SvcLogicExpressionResolver.evaluate(
66 curEnt.getValue(), node, ctx);
68 if (LOG.isDebugEnabled()) {
69 LOG.debug("Setting context attribute " + curName + " to "
72 ctx.setAttribute(curName, curValue);