From be01f84ba795a8bea3d9bc8469cccd11ed9ef5e4 Mon Sep 17 00:00:00 2001 From: Joanna Jeremicz Date: Thu, 10 Jan 2019 09:22:46 +0100 Subject: Validate inputs for pnf association Issue-ID: SO-1274 Change-Id: I3fdb66ef4bd259bef46c6f092d7d142b6cb5d9dc Signed-off-by: Joanna Jeremicz --- .../bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java | 1 + .../onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'bpmn/so-bpmn-infrastructure-common/src/main') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java index 1407cb9211..c5caea5f2f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java @@ -33,4 +33,5 @@ public class ExecutionVariableNames { public final static String DMAAP_MESSAGE = "dmaapMessage"; public final static String TIMEOUT_FOR_NOTIFICATION = "timeoutForPnfEntryNotification"; public final static String PNF_UUID = "pnfUuid"; + public final static String SERVICE_INSTANCE_ID = "serviceInstanceId"; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java index c1ddf2e04e..a975339e58 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; import com.google.common.base.Strings; @@ -53,6 +54,7 @@ public class PnfCheckInputs implements JavaDelegate { validateCorrelationId(execution); validatePnfUuid(execution); validateTimeout(execution); + validateServiceInstanceId(execution); } private void validateCorrelationId(DelegateExecution execution) { @@ -83,4 +85,11 @@ public class PnfCheckInputs implements JavaDelegate { execution.setVariable(TIMEOUT_FOR_NOTIFICATION, defaultTimeout); } } + + private void validateServiceInstanceId(DelegateExecution execution) { + String serviceInstanceId = (String) execution.getVariable(SERVICE_INSTANCE_ID); + if (Strings.isNullOrEmpty(serviceInstanceId)) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "serviceInstanceId variable not defined"); + } + } } -- cgit 1.2.3-korg