aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java
diff options
context:
space:
mode:
authorYuli Shlosberg <ys9693@att.com>2017-12-18 15:06:12 +0200
committerYuli Shlosberg <ys9693@att.com>2017-12-25 15:46:32 +0000
commit7b9ef5920d732106337338e65dd92feda1d05731 (patch)
treeb0a958d67af0b3d8ed93778c0e79474281e02b08 /catalog-be/src/main/java
parent05c625fb9c3673d6c60511958f7e051257247c2b (diff)
Kibana and import normative API fix
Change-Id: Ic365ed2122dc16f35b54a064166f4774650c9029 Issue-ID: SDC-265 Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java
index f1dd1539b4..1625b50bae 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java
@@ -590,17 +590,26 @@ public abstract class AbstractValidationsServlet extends BeGenericServlet {
validateToscaTemplatePayloadName(responseWrapper, uploadResourceInfoWrapper.getInnerElement(), userWrapper.getInnerElement());
}
if (responseWrapper.isEmpty()) {
- validateResourceType(responseWrapper, uploadResourceInfoWrapper.getInnerElement(), userWrapper.getInnerElement());
+ validateResourceType(responseWrapper, uploadResourceInfoWrapper.getInnerElement(), userWrapper.getInnerElement(), resourceAuthorityEnum);
}
}
- private void validateResourceType(Wrapper<Response> responseWrapper, UploadResourceInfo uploadResourceInfo, User user) {
+ private void validateResourceType(Wrapper<Response> responseWrapper, UploadResourceInfo uploadResourceInfo, User user, ResourceAuthorityTypeEnum resourceAuthorityEnum) {
String resourceType = uploadResourceInfo.getResourceType();
if (resourceType == null || !ResourceTypeEnum.containsName(resourceType)) {
ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT);
Response errorResponse = buildErrorResponse(responseFormat);
- EnumMap<AuditingFieldsKeysEnum, Object> additionalParam = new EnumMap<AuditingFieldsKeysEnum, Object>(AuditingFieldsKeysEnum.class);
+ EnumMap additionalParam = new EnumMap(AuditingFieldsKeysEnum.class);
+ additionalParam.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, uploadResourceInfo.getName());
+ getComponentsUtils().auditResource(responseFormat, user, null, "", "", AuditingActionEnum.IMPORT_RESOURCE, additionalParam);
+ responseWrapper.setInnerElement(errorResponse);
+ }
+ if (resourceType.equals(ResourceTypeEnum.getTypeByName("VF").getValue()) && resourceAuthorityEnum == ResourceAuthorityTypeEnum.NORMATIVE_TYPE_BE){
+ log.debug("Import of VF resource type is forbidden - VF resource import can be done using onboarding flow only");
+ ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.INVALID_RESOURCE_TYPE);
+ Response errorResponse = buildErrorResponse(responseFormat);
+ EnumMap additionalParam = new EnumMap(AuditingFieldsKeysEnum.class);
additionalParam.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, uploadResourceInfo.getName());
getComponentsUtils().auditResource(responseFormat, user, null, "", "", AuditingActionEnum.IMPORT_RESOURCE, additionalParam);
responseWrapper.setInnerElement(errorResponse);