X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=sli%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fsdnc%2Fsli%2Fprovider%2FForNodeExecutor.java;fp=sli%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fsdnc%2Fsli%2Fprovider%2FForNodeExecutor.java;h=e9fdc55ef3eb40f494afce84649ff47d4d99dc3a;hb=974b67dd4021e6e839eaad25366bffe6d7a414c8;hp=a669712bc909546aae986db84cbfc15d68876cab;hpb=e0451f75b26082418757f279351c2d3e29c0a5c8;p=sdnc%2Fcore.git diff --git a/sli/provider/src/main/java/org/openecomp/sdnc/sli/provider/ForNodeExecutor.java b/sli/provider/src/main/java/org/openecomp/sdnc/sli/provider/ForNodeExecutor.java index a669712..e9fdc55 100644 --- a/sli/provider/src/main/java/org/openecomp/sdnc/sli/provider/ForNodeExecutor.java +++ b/sli/provider/src/main/java/org/openecomp/sdnc/sli/provider/ForNodeExecutor.java @@ -21,6 +21,7 @@ package org.openecomp.sdnc.sli.provider; +import org.openecomp.sdnc.sli.BreakNodeException; import org.openecomp.sdnc.sli.SvcLogicContext; import org.openecomp.sdnc.sli.SvcLogicException; import org.openecomp.sdnc.sli.SvcLogicExpression; @@ -40,7 +41,7 @@ public class ForNodeExecutor extends SvcLogicNodeExecutor { SvcLogicExpression atomicExpr = node.getAttribute("atomic"); String atomicStr = SvcLogicExpressionResolver.evaluate(atomicExpr, node, ctx); boolean isAtomic = !("false".equalsIgnoreCase(atomicStr)); - + int numOutcomes = node.getNumOutcomes(); String idxVar = SvcLogicExpressionResolver.evaluate( node.getAttribute("index"), node, ctx); @@ -59,21 +60,30 @@ public class ForNodeExecutor extends SvcLogicNodeExecutor { startIdx = Integer.parseInt(startVal); endIdx = Integer.parseInt(endVal); } catch (NumberFormatException e) { - throw new SvcLogicException("Invalid index values [" + startVal - + "," + endVal + "]"); + SvcLogicExpression silentFailureExpr = node.getAttribute("silentFailure"); + String silentFailure = SvcLogicExpressionResolver.evaluate(silentFailureExpr, node, ctx); + boolean isSilentFailure = Boolean.parseBoolean(silentFailure); + String message = "Invalid index values [" + startVal + "," + endVal + "]"; + if(!isSilentFailure){ + throw new SvcLogicException(message); + }else{ + LOG.debug(message + ". Not exiting because silentFailure was set to true."); + return(null); + } } + try { for (int ctr = startIdx; ctr < endIdx; ctr++) { ctx.setAttribute(idxVar, "" + ctr); for (int i = 0; i < numOutcomes; i++) { - + if ("failure".equals(ctx.getStatus()) && isAtomic) { LOG.info("For - stopped executing nodes due to failure status"); return(null); } - + SvcLogicNode nextNode = node.getOutcomeValue("" + (i + 1)); if (nextNode != null) { if (LOG.isDebugEnabled()) { @@ -83,7 +93,6 @@ public class ForNodeExecutor extends SvcLogicNodeExecutor { while (innerNextNode != null) { innerNextNode = svc.executeNode(innerNextNode, ctx); } - } else { if (LOG.isDebugEnabled()) { LOG.debug("For - done: no outcome " + (i + 1)); @@ -91,6 +100,9 @@ public class ForNodeExecutor extends SvcLogicNodeExecutor { } } } + } catch (BreakNodeException br) { + LOG.debug("ForNodeExecutor caught break"); + } return (null); }