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;
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;
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;
}
@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) {
@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 {
@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,
@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,
@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 {
try {
ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
ComponentBusinessLogic businessLogic = componentBusinessLogicProvider.getInstance(componentTypeEnum);
+ if (internalComponentModel != null) {
+ internalComponentModel = ValidationUtils.sanitizeInputString(internalComponentModel.trim());
+ }
Either<List<Component>, 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());
@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,
@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<String> dataParamsToReturn,
@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,