diff options
author | Steve Smokowski <ss835w@att.com> | 2019-04-05 13:45:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-05 13:45:29 +0000 |
commit | 8dcb6c2cfe69e95e22601eb1b15b6cbaa6b8746a (patch) | |
tree | 03f0eac860c489f81c31158f9e34885ca79369fc /mso-api-handlers/mso-api-handler-infra | |
parent | 7350292687c521002a4abbcc9f1d24cc37caf13f (diff) | |
parent | 608a077f8ea3b18dddbfeb4d8b486661e05561c7 (diff) |
Merge "Fixed Sonar blocker issues"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java index 695213bf20..0602f09796 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * Modifications Copyright (c) 2019 Samsung * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,44 +22,31 @@ package org.onap.so.apihandlerinfra.validation; -import java.util.List; -import java.util.Map; - import org.onap.so.exceptions.ValidationException; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestParameters; import com.google.common.base.Strings; -public class CustomWorkflowValidation implements ValidationRule{ - +public class CustomWorkflowValidation implements ValidationRule { + @Override - public ValidationInformation validate(ValidationInformation info) throws ValidationException{ - RequestParameters requestParameters = info.getSir().getRequestDetails().getRequestParameters(); - CloudConfiguration cloudConfiguration = info.getSir().getRequestDetails ().getCloudConfiguration(); - String workflowUuid = info.getInstanceIdMap().get("workflowUuid"); - + public ValidationInformation validate(ValidationInformation info) throws ValidationException { + RequestParameters requestParameters = info.getSir().getRequestDetails().getRequestParameters(); + CloudConfiguration cloudConfiguration = info.getSir().getRequestDetails().getCloudConfiguration(); + if (cloudConfiguration == null) { - throw new ValidationException ("cloudConfiguration"); - }else if (Strings.isNullOrEmpty((cloudConfiguration.getCloudOwner ()))) { - throw new ValidationException ("cloudOwner"); - }else if (Strings.isNullOrEmpty((cloudConfiguration.getLcpCloudRegionId ()))) { - throw new ValidationException ("lcpCloudRegionId"); - }else if (Strings.isNullOrEmpty((cloudConfiguration.getTenantId ()))) { - throw new ValidationException ("tenantId"); - } - if(requestParameters == null){ - throw new ValidationException("requestParameters"); - } - - List<Map<String, Object>> userParams = requestParameters.getUserParams(); - if (!validateCustomUserParams(userParams, workflowUuid)) { - throw new ValidationException("userParams"); - } - return info; - } - - private boolean validateCustomUserParams(List<Map<String, Object>> userParams, String workflowUuid) { - return true; + throw new ValidationException("cloudConfiguration"); + } else if (Strings.isNullOrEmpty((cloudConfiguration.getCloudOwner()))) { + throw new ValidationException("cloudOwner"); + } else if (Strings.isNullOrEmpty((cloudConfiguration.getLcpCloudRegionId()))) { + throw new ValidationException("lcpCloudRegionId"); + } else if (Strings.isNullOrEmpty((cloudConfiguration.getTenantId()))) { + throw new ValidationException("tenantId"); + } + if (requestParameters == null) { + throw new ValidationException("requestParameters"); + } + return info; } -}
\ No newline at end of file +} |