From fa68917a405125b75c6b23ca68310aab8c94a79a Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Fri, 21 Apr 2017 12:34:25 -0700 Subject: Make Flags immutable Change-Id: Ib2e06d41d4e1eb6fb40144258067d2c71ac1d620 Signed-off-by: Gary Wu --- .../appc/provider/lcm/util/RequestInputBuilder.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'appc-provider/appc-provider-bundle/src/main/java') diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java index 7af5f073d..f45748de2 100644 --- a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java +++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java @@ -28,6 +28,7 @@ import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.Payload; import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.action.identifiers.ActionIdentifiers; import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.common.header.CommonHeader; import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.common.header.common.header.Flags; +import org.openecomp.appc.domainmodel.lcm.Flags.Mode; import org.openecomp.appc.domainmodel.lcm.RequestContext; import org.openecomp.appc.domainmodel.lcm.VNFOperation; import org.openecomp.appc.requesthandler.objects.RequestHandlerInput; @@ -105,21 +106,23 @@ public class RequestInputBuilder { header.setSubRequestId(commonHeader.getSubRequestId()); Flags inFlags = commonHeader.getFlags(); - org.openecomp.appc.domainmodel.lcm.Flags flags = new org.openecomp.appc.domainmodel.lcm.Flags(); + boolean force = false; + Mode mode = null; + int ttl = 0; if (inFlags != null) { - if(null != inFlags.getForce()) { - flags.setForce(Boolean.parseBoolean(inFlags.getForce().toString().toLowerCase())); + if (null != inFlags.getForce()) { + force = Boolean.parseBoolean(inFlags.getForce().toString().toLowerCase()); } - if(null!=inFlags.getMode()) { - flags.setMode(inFlags.getMode().name()); + if (null != inFlags.getMode()) { + mode = Mode.valueOf(inFlags.getMode().name()); } - if(null!= inFlags.getTtl()) { - flags.setTtl(inFlags.getTtl()); + if (null != inFlags.getTtl()) { + ttl = inFlags.getTtl(); } } - this.requestContext.getCommonHeader().setFlags(flags); + this.requestContext.getCommonHeader().setFlags(new org.openecomp.appc.domainmodel.lcm.Flags(mode, force, ttl)); return this; } -- cgit 1.2.3-korg