summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2020-09-25 09:38:23 +0000
committerGerrit Code Review <gerrit@onap.org>2020-09-25 09:38:23 +0000
commit924bf901cd966e20eaf2412f576ebc4a0a31fb8c (patch)
treea6fff8c90b28635083eaba07c9c7088086ed4c54 /bpmn/so-bpmn-tasks/src/main
parent7c61f08d9fd61437a762fe57277b6f1f780a14cb (diff)
parent8ee912c7946410144b5ec79758f5d87ef656981b (diff)
Merge "Add userParams as inputs"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
index a1e513fd47..3b81d52703 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
@@ -22,17 +22,22 @@ import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
+import org.onap.so.client.cds.ConfigureInstanceParamsForPnf;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
import org.onap.so.client.cds.PayloadConstants;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.exception.PayloadGenerationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.List;
+import java.util.Map;
import java.util.UUID;
import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_NAME;
import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_VERSION;
@@ -54,13 +59,16 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui
private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils;
private ExtractPojosForBB extractPojosForBB;
private ExceptionBuilder exceptionBuilder;
+ private ConfigureInstanceParamsForPnf configureInstanceParamsForPnf;
@Autowired
public GenericPnfCDSControllerRunnableBB(AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils,
- ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder) {
+ ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder,
+ ConfigureInstanceParamsForPnf configureInstanceParamsForPnf) {
this.abstractCDSProcessingBBUtils = abstractCDSProcessingBBUtils;
this.extractPojosForBB = extractPojosForBB;
this.exceptionBuilder = exceptionBuilder;
+ this.configureInstanceParamsForPnf = configureInstanceParamsForPnf;
}
@Override
@@ -115,6 +123,7 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui
String resolutionKey = null;
try {
final Pnf pnf = getPnf(execution);
+ final String modelCustomizationUuid = pnf.getModelInfoPnf().getModelCustomizationUuid();
final ServiceInstance serviceInstance = getServiceInstance(execution);
resolutionKey = pnf.getPnfName();
@@ -123,10 +132,17 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui
pnfObject);
setExecutionVariable("pnf-id", pnf.getPnfId(), pnfObject);
setExecutionVariable("pnf-name", resolutionKey, pnfObject);
- setExecutionVariable("pnf-customization-uuid", pnf.getModelInfoPnf().getModelCustomizationUuid(),
- pnfObject);
+ setExecutionVariable("pnf-customization-uuid", modelCustomizationUuid, pnfObject);
+
+ final GeneralBuildingBlock generalBuildingBlock = execution.getGeneralBuildingBlock();
- } catch (BBObjectNotFoundException exception) {
+ List<Map<String, Object>> userParamsFromRequest =
+ generalBuildingBlock.getRequestContext().getRequestParameters().getUserParams();
+ if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
+ configureInstanceParamsForPnf.populateInstanceParams(pnfObject, userParamsFromRequest,
+ modelCustomizationUuid);
+ }
+ } catch (BBObjectNotFoundException | PayloadGenerationException exception) {
logger.error("An exception occurred when creating payload for CDS request", exception);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, exception);
}