diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/CnfInstantiateTask.java | 48 |
1 files changed, 8 insertions, 40 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/CnfInstantiateTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/CnfInstantiateTask.java index b6be7716f6..0b24f2608b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/CnfInstantiateTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/CnfInstantiateTask.java @@ -19,22 +19,16 @@ */ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter; -import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParametersProvider; -import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.serviceinstancebeans.RequestDetails; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; + /** * This class performs CNF Instantiation * @@ -43,48 +37,22 @@ import org.springframework.stereotype.Component; @Component public class CnfInstantiateTask { private static final Logger LOGGER = LoggerFactory.getLogger(CnfInstantiateTask.class); - private final InputParametersProvider<GenericVnf> sdncInputParametersProvider; private final ExtractPojosForBB extractPojosForBB; - private final InputParametersProvider<Map<String, Object>> userParamInputParametersProvider; @Autowired - public CnfInstantiateTask(final InputParametersProvider<GenericVnf> inputParametersProvider, - final InputParametersProvider<Map<String, Object>> userParamInputParametersProvider, - final ExtractPojosForBB extractPojosForBB) { - this.sdncInputParametersProvider = inputParametersProvider; - this.userParamInputParametersProvider = userParamInputParametersProvider; + public CnfInstantiateTask(final ExtractPojosForBB extractPojosForBB) { this.extractPojosForBB = extractPojosForBB; } public void handleCnfInstatiate(final BuildingBlockExecution execution) { try { LOGGER.debug("Executing handleCnfInstatiate ..."); - final InputParameter userParamsInputParameter = getUserParamsInputParameter(execution); + ExecuteBuildingBlock executeBuildingBlock = (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); + RequestDetails requestDetails = executeBuildingBlock.getRequestDetails(); + LOGGER.debug("RequestDetails: {}", requestDetails); LOGGER.debug("Finished executing handleCnfInstatiate ..."); } catch (final Exception exception) { - LOGGER.error("Unable to get input parameters", exception); - execution.setVariable(INPUT_PARAMETER, NullInputParameter.NULL_INSTANCE); - } - } - - private InputParameter getUserParamsInputParameter(final BuildingBlockExecution execution) { - final GeneralBuildingBlock generalBuildingBlock = execution.getGeneralBuildingBlock(); - if (generalBuildingBlock != null && generalBuildingBlock.getRequestContext() != null - && generalBuildingBlock.getRequestContext().getRequestParameters() != null) { - final List<Map<String, Object>> userParams = - generalBuildingBlock.getRequestContext().getRequestParameters().getUserParams(); - if (userParams != null) { - final Map<String, Object> params = new HashMap<>(); - userParams.stream().forEach(obj -> { - params.putAll(obj); - }); - LOGGER.info("User params found : {}", params); - if (userParams != null && !userParams.isEmpty()) { - return userParamInputParametersProvider.getInputParameter(params); - } - } + LOGGER.error("Unable to instantiate CNF", exception); } - LOGGER.warn("No input parameters found in userparams ..."); - return NullInputParameter.NULL_INSTANCE; } } |