diff options
Diffstat (limited to 'appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java')
-rw-r--r-- | appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java index 935260a10..889bd25da 100644 --- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java @@ -24,10 +24,10 @@ package org.openecomp.appc.executor.impl; import org.apache.commons.lang3.StringUtils; import org.openecomp.appc.domainmodel.lcm.CommonHeader; +import org.openecomp.appc.domainmodel.lcm.RuntimeContext; import org.openecomp.appc.domainmodel.lcm.Status; import org.openecomp.appc.domainmodel.lcm.VNFOperation; import org.openecomp.appc.executor.UnstableVNFException; -import org.openecomp.appc.executor.objects.CommandExecutorInput; import org.openecomp.appc.executor.objects.CommandResponse; import org.openecomp.appc.executor.objects.LCMCommandStatus; import org.openecomp.appc.executor.objects.Params; @@ -90,12 +90,12 @@ public class LCMCommandTask extends CommandTask { @Override - public void onRequestCompletion(CommandExecutorInput request, CommandResponse response) { + public void onRequestCompletion(RuntimeContext request, CommandResponse response) { boolean isAAIUpdated = false; try { - final int statusCode = request.getRuntimeContext().getResponseContext().getStatus().getCode(); + final int statusCode = request.getResponseContext().getStatus().getCode(); if (logger.isDebugEnabled()) { logger.debug("Workflow Execution Status = "+ statusCode); @@ -103,13 +103,13 @@ public class LCMCommandTask extends CommandTask { boolean isSuccess = statusCode == 100 || statusCode == 400; - if (isSuccess && VNFOperation.Terminate == request.getRuntimeContext().getRequestContext().getAction()) { + if (isSuccess && VNFOperation.Terminate == request.getRequestContext().getAction()) { SvcLogicContext ctx = new SvcLogicContext(); - ctx = getVnfdata(request.getRuntimeContext().getVnfContext().getId(), "vnf", ctx); - isAAIUpdated = aaiService.deleteGenericVnfData(request.getRuntimeContext().getVnfContext().getId(), ctx.getAttribute("vnf.resource-version")); + ctx = getVnfdata(request.getVnfContext().getId(), "vnf", ctx); + isAAIUpdated = aaiService.deleteGenericVnfData(request.getVnfContext().getId(), ctx.getAttribute("vnf.resource-version")); } else{ - isAAIUpdated = updateAAI(request.getRuntimeContext().getVnfContext().getId() , false, isSuccess); + isAAIUpdated = updateAAI(request.getVnfContext().getId() , false, isSuccess); } logger.debug("isAAIUpdated = " + isAAIUpdated); } @@ -124,20 +124,20 @@ public class LCMCommandTask extends CommandTask { @Override public void run() { - CommandExecutorInput request = getCommandRequest(); + RuntimeContext request = getCommandRequest(); boolean isAAIUpdated; - final String vnfId = request.getRuntimeContext().getVnfContext().getId(); - final String vnfType = request.getRuntimeContext().getVnfContext().getType(); + final String vnfId = request.getVnfContext().getId(); + final String vnfType = request.getVnfContext().getType(); try { - final CommonHeader commonHeader = request.getRuntimeContext().getRequestContext().getCommonHeader(); + final CommonHeader commonHeader = request.getRequestContext().getCommonHeader(); final boolean forceFlag = commonHeader.getFlags().isForce(); UniqueRequestIdentifier requestIdentifier = new UniqueRequestIdentifier(commonHeader.getOriginatorId(), commonHeader.getRequestId(), commonHeader.getSubRequestId()); String requestIdentifierString = requestIdentifier.toIdentifierString(); requestHandler.onRequestExecutionStart(vnfId,false, requestIdentifierString, forceFlag); - final String currentStatus = request.getRuntimeContext().getVnfContext().getStatus(); - final VNFOperation action = request.getRuntimeContext().getRequestContext().getAction(); + final String currentStatus = request.getVnfContext().getStatus(); + final VNFOperation action = request.getRequestContext().getAction(); final String nextState = lifecyclemanager.getNextState(vnfType, currentStatus, action.name()); @@ -147,18 +147,18 @@ public class LCMCommandTask extends CommandTask { } catch (NoTransitionDefinedException e) { logger.error("Error getting Next State for AAI Update: " + e.getMessage(), e); Params params = new Params().addParam("actionName",e.event).addParam("currentState",e.currentState); - request.getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.NO_TRANSITION_DEFINE_FAILURE.toStatus(params)); + request.getResponseContext().setStatus(LCMCommandStatus.NO_TRANSITION_DEFINE_FAILURE.toStatus(params)); isAAIUpdated = false; } catch (UnstableVNFException e) { logger.error(e.getMessage(), e); Params params = new Params().addParam("vnfId",vnfId); - request.getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.UNSTABLE_VNF_FAILURE.toStatus(params)); + request.getResponseContext().setStatus(LCMCommandStatus.UNSTABLE_VNF_FAILURE.toStatus(params)); isAAIUpdated = false; }catch (Exception e) { logger.error("Error before Request Execution starts.", e); String errorMsg = StringUtils.isEmpty(e.getMessage()) ? e.toString() : e.getMessage(); Params params = new Params().addParam("errorMsg",errorMsg); - request.getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.UNEXPECTED_FAILURE.toStatus(params)); + request.getResponseContext().setStatus(LCMCommandStatus.UNEXPECTED_FAILURE.toStatus(params)); isAAIUpdated = false; } @@ -168,7 +168,7 @@ public class LCMCommandTask extends CommandTask { String errorMsg = "Error updating A& AI before Workflow execution"; logger.error(errorMsg); WorkflowResponse response = new WorkflowResponse(); - response.setResponseContext(request.getRuntimeContext().getResponseContext()); + response.setResponseContext(request.getResponseContext()); CommandResponse commandResponse = super.buildCommandResponse(request, response); this.onRequestCompletion(request,commandResponse); } |