X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=catalog-be%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fsdc%2Fbe%2Fservlets%2FComponentServlet.java;h=cc1fe2a125f5716fe96ab1a915ad512cb31af88b;hb=5f3e9912406897ee18c424b940881ce08d59bb44;hp=2df63a21242b5aa0f326604f3ef079187038b8c0;hpb=e020ca3c855ec9555213abfdd89e14d72310177d;p=sdc.git diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentServlet.java index 2df63a2124..cc1fe2a125 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentServlet.java @@ -54,8 +54,6 @@ import javax.ws.rs.core.Response; import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogicProvider; -import org.openecomp.sdc.be.components.impl.aaf.AafPermission; -import org.openecomp.sdc.be.components.impl.aaf.PermissionAllowed; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum; @@ -71,10 +69,10 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; import org.openecomp.sdc.be.ui.model.UiLeftPaletteComponent; -import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.be.view.ResponseView; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.log.wrappers.Logger; +import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.stereotype.Controller; @@ -93,9 +91,9 @@ public class ComponentServlet extends BeGenericServlet { private final ComponentBusinessLogicProvider componentBusinessLogicProvider; @Inject - public ComponentServlet(UserBusinessLogic userBusinessLogic, ComponentsUtils componentsUtils, + public ComponentServlet(ComponentsUtils componentsUtils, ComponentBusinessLogicProvider componentBusinessLogicProvider) { - super(userBusinessLogic, componentsUtils); + super(componentsUtils); this.componentBusinessLogicProvider = componentBusinessLogicProvider; } @@ -107,7 +105,6 @@ public class ComponentServlet extends BeGenericServlet { @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))), @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"), @ApiResponse(responseCode = "404", description = "Component not found")}) - @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response conformanceLevelValidation(@PathParam("componentType") final String componentType, @PathParam("componentUuid") final String componentUuid, @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) { @@ -138,7 +135,6 @@ public class ComponentServlet extends BeGenericServlet { @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))), @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"), @ApiResponse(responseCode = "404", description = "Component not found")}) - @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response getRequirementAndCapabilities(@PathParam("componentType") final String componentType, @PathParam("componentId") final String componentId, @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) throws IOException { @@ -170,7 +166,6 @@ public class ComponentServlet extends BeGenericServlet { @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))), @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"), @ApiResponse(responseCode = "404", description = "Component not found")}) - @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response getLatestVersionNotAbstractCheckoutComponents(@PathParam("componentType") final String componentType, @Context final HttpServletRequest request, @QueryParam("internalComponentType") String internalComponentType, @@ -205,7 +200,6 @@ public class ComponentServlet extends BeGenericServlet { @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))), @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"), @ApiResponse(responseCode = "404", description = "Component not found")}) - @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response getLatestVersionNotAbstractCheckoutComponentsByBody(@PathParam("componentType") final String componentType, @Context final HttpServletRequest request, @QueryParam("internalComponentType") String internalComponentType, @@ -244,10 +238,11 @@ public class ComponentServlet extends BeGenericServlet { @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))), @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"), @ApiResponse(responseCode = "404", description = "Component not found")}) - @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response getLatestVersionNotAbstractCheckoutComponentsIdesOnly(@PathParam("componentType") final String componentType, @Context final HttpServletRequest request, @QueryParam("internalComponentType") String internalComponentType, + @QueryParam("componentModel") String internalComponentModel, + @QueryParam("includeNormativeExtensionModels") boolean includeNormativeExtensionModels, @HeaderParam(value = Constants.USER_ID_HEADER) String userId, @Parameter(description = "uid list", required = true) String data) throws IOException { @@ -256,9 +251,12 @@ public class ComponentServlet extends BeGenericServlet { try { ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType); ComponentBusinessLogic businessLogic = componentBusinessLogicProvider.getInstance(componentTypeEnum); + if (internalComponentModel != null) { + internalComponentModel = ValidationUtils.sanitizeInputString(internalComponentModel.trim()); + } Either, ResponseFormat> actionResponse = businessLogic - .getLatestVersionNotAbstractComponentsMetadata(false, HighestFilterEnum.HIGHEST_ONLY, componentTypeEnum, internalComponentType, - userId); + .getLatestVersionNotAbstractComponentsMetadata(false, HighestFilterEnum.HIGHEST_ONLY, componentTypeEnum, + internalComponentType, userId, internalComponentModel, includeNormativeExtensionModels); if (actionResponse.isRight()) { log.debug(FAILED_TO_GET_ALL_NON_ABSTRACT, componentType); return buildErrorResponse(actionResponse.right().value()); @@ -283,7 +281,6 @@ public class ComponentServlet extends BeGenericServlet { @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))), @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"), @ApiResponse(responseCode = "404", description = "Component not found")}) - @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response getComponentInstancesFilteredByPropertiesAndInputs(@PathParam("componentType") final String componentType, @PathParam("componentId") final String componentId, @Context final HttpServletRequest request, @@ -331,7 +328,6 @@ public class ComponentServlet extends BeGenericServlet { @ApiResponse(responseCode = "200", description = "Resource found"), @ApiResponse(responseCode = "403", description = "Restricted operation"), @ApiResponse(responseCode = "404", description = "Resource not found")}) @ResponseView(mixin = {GroupCompositionMixin.class, PolicyCompositionMixin.class}) - @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response getComponentDataFilteredByParams(@PathParam("componentType") final String componentType, @PathParam("componentId") final String componentId, @QueryParam("include") final List dataParamsToReturn, @@ -371,7 +367,6 @@ public class ComponentServlet extends BeGenericServlet { @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Map.class)))), @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"), @ApiResponse(responseCode = "404", description = "Component not found")}) - @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response getFilteredComponentInstanceProperties(@PathParam("componentType") final String componentType, @PathParam("componentId") final String componentId, @PathParam("propertyNameFragment") final String propertyNameFragment,