aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src
diff options
context:
space:
mode:
authorDivesh Mirchandani <Divesh.Mirchandani@amdocs.com>2017-09-14 19:14:21 +0530
committerDivesh Mirchandani <Divesh.Mirchandani@amdocs.com>2017-09-18 17:26:38 +0530
commit396cb378ab8940b1adb8ba1adc656d0b4ad66f99 (patch)
treeb4f6ddc8e7cdfe39bfcbdc75cff7e85c284c5b65 /openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src
parent27f5c2b105676eebb477714fd7323467151965d2 (diff)
Fixed SONAR issues
Fixed blocker, critical, major & minor SONAR issues. Issue-ID: SDC-343 Change-Id: I72e5a3a7fa7d7407a92f98f77e4334827f70f926 Signed-off-by: dd4616 <Divesh.Mirchandani@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java4
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java65
2 files changed, 31 insertions, 38 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java
index 369e90c928..5dc79ebdfe 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java
@@ -23,10 +23,10 @@ package org.openecomp.sdcrests.action.rest;
import com.sun.jersey.multipart.FormDataParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.springframework.validation.annotation.Validated;
+import java.io.InputStream;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.HeaderParam;
@@ -39,8 +39,6 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.io.InputStream;
-
@Path("/workflow/v1.0/actions")
@Produces(MediaType.APPLICATION_JSON)
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java
index e6f5e6b1a3..53ebf0baab 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java
@@ -830,7 +830,6 @@ public class ActionsImpl implements Actions {
HttpServletRequest servletRequest) {
ListResponseWrapper responseList = null;
Map<String, String> errorMap = validateRequestHeaders(servletRequest);
- ;
Map<String, String> queryParamErrors = validateQueryParam(componentID);
errorMap.putAll(queryParamErrors);
if (errorMap.isEmpty()) {
@@ -992,37 +991,36 @@ public class ActionsImpl implements Actions {
if (StringUtils.isEmpty(requestJSON) || requestJSON.equals(REQUEST_EMPTY_BODY)) {
requestBodyErrorMap.put(ACTION_INVALID_REQUEST_BODY_CODE, ACTION_REQUEST_BODY_EMPTY);
} else {
- switch (requestType) {
- case ActionConstants.REQUEST_TYPE_CREATE_ACTION:
- case ActionConstants.REQUEST_TYPE_UPDATE_ACTION:
- //Semantic request specific validations
- Action action = JsonUtil.json2Object(requestJSON, Action.class);
- if (StringUtils.isEmpty(action.getName())) {
- setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE, ACTION_REQUEST_PARAM_NAME,
- requestBodyErrorMap);
- } else {
- //Added check for action name not allowing whitespaces
- if (action.getName().matches(whitespaceRegex)) {
- requestBodyErrorMap
- .put(ACTION_ARTIFACT_INVALID_NAME_CODE, ACTION_REQUEST_INVALID_NAME);
- }
+ if(requestType == ActionConstants.REQUEST_TYPE_CREATE_ACTION){
+ //placeholder for future implementation
+ }
+ if(requestType == ActionConstants.REQUEST_TYPE_UPDATE_ACTION){
+ //Semantic request specific validations
+ Action action = JsonUtil.json2Object(requestJSON, Action.class);
+ if(StringUtils.isEmpty(action.getName())){
+ setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE, ACTION_REQUEST_PARAM_NAME,
+ requestBodyErrorMap);
+ } else {
+ //Added check for action names not allowing whitespaces
+ if (action.getName().matches(whitespaceRegex)){
+ requestBodyErrorMap.put(ACTION_ARTIFACT_INVALID_NAME_CODE, ACTION_REQUEST_INVALID_NAME);
}
+ }
- if (action.getSupportedModels() != null &&
- !isIDPresentInMap(action.getSupportedModels(), SUPPORTED_MODELS_VERSION_ID)) {
- setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE,
- ACTION_REQUEST_PARAM_SUPPORTED_MODELS, requestBodyErrorMap);
- }
- if (action.getSupportedComponents() != null &&
- !isIDPresentInMap(action.getSupportedComponents(), SUPPORTED_COMPONENTS_ID)) {
- setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE,
- ACTION_REQUEST_PARAM_SUPPORTED_COMPONENTS, requestBodyErrorMap);
- }
- if (action.getArtifacts() != null) {
- setErrorValue(ACTION_UPDATE_NOT_ALLOWED_CODE, ACTION_REQUEST_ARTIFACT_OPERATION_ALLOWED,
- requestBodyErrorMap);
- }
- break;
+ if(action.getSupportedModels() != null && !isIDPresentInMap(action.getSupportedModels(),
+ SUPPORTED_MODELS_VERSION_ID)){
+ setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE,
+ ACTION_REQUEST_PARAM_SUPPORTED_MODELS, requestBodyErrorMap);
+ }
+ if(action.getSupportedComponents() != null && !isIDPresentInMap(action
+ .getSupportedComponents(), SUPPORTED_COMPONENTS_ID)){
+ setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE,
+ ACTION_REQUEST_PARAM_SUPPORTED_MODELS, requestBodyErrorMap);
+ }
+ if(action.getArtifacts() != null){
+ setErrorValue(ACTION_UPDATE_NOT_ALLOWED_CODE,
+ ACTION_REQUEST_ARTIFACT_OPERATION_ALLOWED, requestBodyErrorMap);
+ }
}
}
@@ -1037,11 +1035,8 @@ public class ActionsImpl implements Actions {
if (errorMessage != null) {
message = errorMessage + ", " + message;
} else {
- switch (key) {
- case ACTION_REQUEST_INVALID_GENERIC_CODE:
- message = ACTION_REQUEST_MISSING_MANDATORY_PARAM + message;
- break;
- }
+ if(key == ACTION_REQUEST_INVALID_GENERIC_CODE)
+ message = ACTION_REQUEST_MISSING_MANDATORY_PARAM + message;
}
errorMap.put(key, message);
}