diff options
author | SagarS <sagar.shetty@est.tech> | 2022-07-19 14:38:59 +0100 |
---|---|---|
committer | SagarS <sagar.shetty@est.tech> | 2022-07-19 14:39:18 +0100 |
commit | ea82b9bcfd6584bd6f8a5c3e058f744c09e6e09d (patch) | |
tree | a2d97082ec0722c1cfbb22616e19cecabbb52154 /bpmn/so-bpmn-tasks/src | |
parent | 35791e0e356a5bd40f9e96255df184778a686fd2 (diff) |
[SO] CNF Lifecycle parameters update
Change-Id: Idc5e4c19825da65c50deac8fc6e2fed73755885a
Signed-off-by: SagarS <sagar.shetty@est.tech>
Issue-ID: SO-3885
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTask.java | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTask.java index 510cee700c..0fba2d382b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfInstantiateTask.java @@ -27,6 +27,9 @@ import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.SERVICE import static org.onap.so.cnfm.lcm.model.utils.AdditionalParamsConstants.TENANT_ID_PARAM_KEY; import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import java.util.Optional; import org.apache.groovy.util.Maps; import org.onap.logging.filter.base.ONAPComponents; @@ -38,6 +41,7 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.cnfm.lcm.model.AsInstance; import org.onap.so.cnfm.lcm.model.CreateAsRequest; import org.onap.so.cnfm.lcm.model.InstantiateAsRequest; +import org.onap.so.cnfm.lcm.model.AsInfoModificationRequestDeploymentItems; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -46,6 +50,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import camundajar.impl.scala.collection.immutable.HashMap; + /** * This class performs CNF Instantiation @@ -138,9 +144,31 @@ public class CnfInstantiateTask { public void createAsInstanceRequest(final BuildingBlockExecution execution) { try { LOGGER.debug("Executing createAsInstanceRequest task ..."); - + final ExecuteBuildingBlock executeBuildingBlock = + (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); + final RequestDetails requestDetails = executeBuildingBlock.getRequestDetails(); final InstantiateAsRequest instantiateAsRequest = new InstantiateAsRequest(); - + if (requestDetails != null && requestDetails.getRequestParameters() != null) { + List<Map<String, Object>> userParams = requestDetails.getRequestParameters().getUserParams(); + if (userParams != null && !userParams.isEmpty()) { + List deploymentItems = new ArrayList<Object>(); + List deploymentItemsReq = new ArrayList<AsInfoModificationRequestDeploymentItems>(); + for (Map<String, Object> userParam : userParams) { + if (userParam.containsKey("deploymentItems")) { + deploymentItems = (ArrayList<Object>) userParam.get("deploymentItems"); + break; + } + } + for (Object deploymentItem : deploymentItems) { + Map<String, Object> deploymentItemMap = (Map<String, Object>) deploymentItem; + AsInfoModificationRequestDeploymentItems item = new AsInfoModificationRequestDeploymentItems(); + item.setDeploymentItemsId(deploymentItemMap.get("deploymentItemsId").toString()); + item.setLifecycleParameterKeyValues(deploymentItemMap.get("lifecycleParameterKeyValues")); + deploymentItemsReq.add(item); + } + instantiateAsRequest.setDeploymentItems(deploymentItemsReq);; + } + } LOGGER.debug("Adding InstantiateAsRequest to execution {}", instantiateAsRequest); execution.setVariable(INSTANTIATE_AS_REQUEST_OBJECT, instantiateAsRequest); |