From 2ec6b94890253fec67f4a8a793cb68c0fc1f6535 Mon Sep 17 00:00:00 2001 From: Munir Ahmad Date: Fri, 2 Mar 2018 20:08:46 -0500 Subject: Swap if statement with switch Change-Id: Ifc4011741849569b04160d6a009b8149102f6c33 Issue-ID: SO-437 Signed-off-by: Munir Ahmad --- .../mso/apihandlerinfra/VolumeMsoInfraRequest.java | 39 ++++++++++++---------- 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java index 0524a85bf3..f908a3f0d6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java @@ -144,24 +144,27 @@ public class VolumeMsoInfraRequest { // Verify that the elements correspond to the version - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null || - this.volumeInputs.getVfModuleModelName () != null || this.volumeInputs.getAsdcServiceModelVersion () != null || - this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) { - throw new ValidationException ("format for v1 version of volume request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null || - this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) { - throw new ValidationException ("format for v2 version of volume request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) { - throw new ValidationException ("format for v3 version of volume request"); - } - } + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null || + this.volumeInputs.getVfModuleModelName() != null + || this.volumeInputs.getAsdcServiceModelVersion() != null || + this.volumeInputs.getServiceInstanceId() != null || this.volumeInputs.getVnfId() != null) { + throw new ValidationException("format for v1 version of volume request"); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null || + this.volumeInputs.getServiceInstanceId() != null || this.volumeInputs.getVnfId() != null) { + throw new ValidationException("format for v2 version of volume request"); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) { + throw new ValidationException("format for v3 version of volume request"); + } + break; + } if (!InfraUtils.isActionAllowed (props, "volume", version, action.value ())) { -- cgit 1.2.3-korg