diff options
author | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2019-01-10 09:22:46 +0100 |
---|---|---|
committer | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2019-02-18 14:23:17 +0100 |
commit | be01f84ba795a8bea3d9bc8469cccd11ed9ef5e4 (patch) | |
tree | 636d3fe5386268a3035d32dbcbfd260ef170e913 /bpmn/so-bpmn-infrastructure-common/src/main/java | |
parent | 2c46078b2731081fa79b4af0e22a39e6641010ee (diff) |
Validate inputs for pnf association
Issue-ID: SO-1274
Change-Id: I3fdb66ef4bd259bef46c6f092d7d142b6cb5d9dc
Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/java')
2 files changed, 10 insertions, 0 deletions
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"); + } + } } |