Search in sources :

Example 1 with ProviderProjectOptions

use of com.synopsys.integration.alert.common.descriptor.config.field.endpoint.table.model.ProviderProjectOptions in project hub-alert by blackducksoftware.

the class BlackDuckProjectCustomFunctionAction method getBlackDuckProjectsActionResponse.

private ActionResponse<ProviderProjectOptions> getBlackDuckProjectsActionResponse(Long blackDuckGlobalConfigId, int pageNumber, int pageSize, String searchTerm) {
    AlertPagedModel<ProviderProject> providerProjectsPage = providerDataAccessor.getProjectsByProviderConfigId(blackDuckGlobalConfigId, pageNumber, pageSize, searchTerm);
    List<ProviderProjectSelectOption> options = providerProjectsPage.getModels().stream().map(project -> new ProviderProjectSelectOption(project.getName(), project.getHref(), project.getDescription())).collect(Collectors.toList());
    return new ActionResponse<>(HttpStatus.OK, new ProviderProjectOptions(providerProjectsPage.getTotalPages(), providerProjectsPage.getCurrentPage(), providerProjectsPage.getPageSize(), options));
}
Also used : ProviderDataAccessor(com.synopsys.integration.alert.common.persistence.accessor.ProviderDataAccessor) AlertFieldStatus(com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) HashSet(java.util.HashSet) ActionResponse(com.synopsys.integration.alert.common.action.ActionResponse) ProviderDescriptor(com.synopsys.integration.alert.api.provider.ProviderDescriptor) FieldModel(com.synopsys.integration.alert.common.rest.model.FieldModel) BlackDuckPropertiesFactory(com.synopsys.integration.alert.provider.blackduck.factory.BlackDuckPropertiesFactory) BlackDuckApiTokenValidator(com.synopsys.integration.alert.provider.blackduck.validator.BlackDuckApiTokenValidator) AuthorizationManager(com.synopsys.integration.alert.common.security.authorization.AuthorizationManager) ResponseStatusException(org.springframework.web.server.ResponseStatusException) Collection(java.util.Collection) ProviderProjectOptions(com.synopsys.integration.alert.common.descriptor.config.field.endpoint.table.model.ProviderProjectOptions) ChannelDescriptor(com.synopsys.integration.alert.common.descriptor.ChannelDescriptor) ProviderProjectSelectOption(com.synopsys.integration.alert.common.descriptor.config.field.endpoint.table.model.ProviderProjectSelectOption) Set(java.util.Set) AlertPagedModel(com.synopsys.integration.alert.common.rest.model.AlertPagedModel) Collectors(java.util.stream.Collectors) BlackDuckProperties(com.synopsys.integration.alert.provider.blackduck.BlackDuckProperties) HttpServletContentWrapper(com.synopsys.integration.alert.common.rest.HttpServletContentWrapper) HttpStatus(org.springframework.http.HttpStatus) ProviderProject(com.synopsys.integration.alert.common.persistence.model.ProviderProject) List(java.util.List) Component(org.springframework.stereotype.Component) PagedCustomFunctionAction(com.synopsys.integration.alert.common.action.PagedCustomFunctionAction) Optional(java.util.Optional) ProviderProjectOptions(com.synopsys.integration.alert.common.descriptor.config.field.endpoint.table.model.ProviderProjectOptions) ProviderProjectSelectOption(com.synopsys.integration.alert.common.descriptor.config.field.endpoint.table.model.ProviderProjectSelectOption) ProviderProject(com.synopsys.integration.alert.common.persistence.model.ProviderProject) ActionResponse(com.synopsys.integration.alert.common.action.ActionResponse)

Aggregations

ProviderDescriptor (com.synopsys.integration.alert.api.provider.ProviderDescriptor)1 ActionResponse (com.synopsys.integration.alert.common.action.ActionResponse)1 PagedCustomFunctionAction (com.synopsys.integration.alert.common.action.PagedCustomFunctionAction)1 ChannelDescriptor (com.synopsys.integration.alert.common.descriptor.ChannelDescriptor)1 ProviderProjectOptions (com.synopsys.integration.alert.common.descriptor.config.field.endpoint.table.model.ProviderProjectOptions)1 ProviderProjectSelectOption (com.synopsys.integration.alert.common.descriptor.config.field.endpoint.table.model.ProviderProjectSelectOption)1 AlertFieldStatus (com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus)1 ProviderDataAccessor (com.synopsys.integration.alert.common.persistence.accessor.ProviderDataAccessor)1 ProviderProject (com.synopsys.integration.alert.common.persistence.model.ProviderProject)1 HttpServletContentWrapper (com.synopsys.integration.alert.common.rest.HttpServletContentWrapper)1 AlertPagedModel (com.synopsys.integration.alert.common.rest.model.AlertPagedModel)1 FieldModel (com.synopsys.integration.alert.common.rest.model.FieldModel)1 AuthorizationManager (com.synopsys.integration.alert.common.security.authorization.AuthorizationManager)1 BlackDuckProperties (com.synopsys.integration.alert.provider.blackduck.BlackDuckProperties)1 BlackDuckPropertiesFactory (com.synopsys.integration.alert.provider.blackduck.factory.BlackDuckPropertiesFactory)1 BlackDuckApiTokenValidator (com.synopsys.integration.alert.provider.blackduck.validator.BlackDuckApiTokenValidator)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Optional (java.util.Optional)1