Search in sources :

Example 1 with ProcessingType

use of com.synopsys.integration.alert.common.enumeration.ProcessingType in project hub-alert by blackducksoftware.

the class DefaultProcessingJobAccessor method convertToFilteredDistributionJobResponseModel.

private FilteredDistributionJobResponseModel convertToFilteredDistributionJobResponseModel(DistributionJobEntity jobEntity) {
    UUID jobId = jobEntity.getJobId();
    ProcessingType processingType = Enum.valueOf(ProcessingType.class, jobEntity.getProcessingType());
    String channelName = jobEntity.getChannelDescriptorName();
    String jobName = jobEntity.getName();
    BlackDuckJobDetailsEntity blackDuckJobDetails = jobEntity.getBlackDuckJobDetails();
    List<String> notificationTypes = blackDuckJobDetailsAccessor.retrieveNotificationTypesForJob(jobId);
    List<BlackDuckProjectDetailsModel> projectDetails = blackDuckJobDetailsAccessor.retrieveProjectDetailsForJob(jobId);
    List<String> policyNames = blackDuckJobDetailsAccessor.retrievePolicyNamesForJob(jobId);
    List<String> vulnerabilitySeverityNames = blackDuckJobDetailsAccessor.retrieveVulnerabilitySeverityNamesForJob(jobId);
    boolean filterByProject = blackDuckJobDetails.getFilterByProject();
    String projectNamePattern = blackDuckJobDetails.getProjectNamePattern();
    String projectVersionNamePattern = blackDuckJobDetails.getProjectVersionNamePattern();
    return new FilteredDistributionJobResponseModel(jobId, processingType, channelName, jobName, notificationTypes, projectDetails, policyNames, vulnerabilitySeverityNames, filterByProject, projectNamePattern, projectVersionNamePattern);
}
Also used : FilteredDistributionJobResponseModel(com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobResponseModel) BlackDuckProjectDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.BlackDuckProjectDetailsModel) ProcessingType(com.synopsys.integration.alert.common.enumeration.ProcessingType) UUID(java.util.UUID) BlackDuckJobDetailsEntity(com.synopsys.integration.alert.database.job.blackduck.BlackDuckJobDetailsEntity)

Example 2 with ProcessingType

use of com.synopsys.integration.alert.common.enumeration.ProcessingType in project hub-alert by blackducksoftware.

the class ProcessingSelectCustomFunctionAction method createActionResponse.

@Override
public ActionResponse<LabelValueSelectOptions> createActionResponse(FieldModel fieldModel, HttpServletContentWrapper servletContentWrapper) {
    String channelName = fieldModel.getFieldValue(ChannelDescriptor.KEY_CHANNEL_NAME).orElse("");
    List<LabelValueSelectOption> options = Arrays.stream(ProcessingType.values()).filter(processingType -> this.shouldInclude(processingType, channelName)).map(processingType -> new LabelValueSelectOption(processingType.getLabel(), processingType.name())).collect(Collectors.toList());
    LabelValueSelectOptions optionList = new LabelValueSelectOptions(options);
    return new ActionResponse<>(HttpStatus.OK, optionList);
}
Also used : AuthorizationManager(com.synopsys.integration.alert.common.security.authorization.AuthorizationManager) Arrays(java.util.Arrays) LabelValueSelectOptions(com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOptions) AlertFieldStatus(com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus) Collection(java.util.Collection) ChannelDescriptor(com.synopsys.integration.alert.common.descriptor.ChannelDescriptor) Set(java.util.Set) Autowired(org.springframework.beans.factory.annotation.Autowired) CustomFunctionAction(com.synopsys.integration.alert.common.action.CustomFunctionAction) Collectors(java.util.stream.Collectors) HttpServletContentWrapper(com.synopsys.integration.alert.common.rest.HttpServletContentWrapper) HttpStatus(org.springframework.http.HttpStatus) LabelValueSelectOption(com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOption) List(java.util.List) Component(org.springframework.stereotype.Component) ActionResponse(com.synopsys.integration.alert.common.action.ActionResponse) ProcessingType(com.synopsys.integration.alert.common.enumeration.ProcessingType) FieldModel(com.synopsys.integration.alert.common.rest.model.FieldModel) IssueTrackerChannelKey(com.synopsys.integration.alert.descriptor.api.model.IssueTrackerChannelKey) LabelValueSelectOption(com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOption) LabelValueSelectOptions(com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOptions) ActionResponse(com.synopsys.integration.alert.common.action.ActionResponse)

Aggregations

ProcessingType (com.synopsys.integration.alert.common.enumeration.ProcessingType)2 ActionResponse (com.synopsys.integration.alert.common.action.ActionResponse)1 CustomFunctionAction (com.synopsys.integration.alert.common.action.CustomFunctionAction)1 ChannelDescriptor (com.synopsys.integration.alert.common.descriptor.ChannelDescriptor)1 LabelValueSelectOption (com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOption)1 LabelValueSelectOptions (com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOptions)1 AlertFieldStatus (com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus)1 BlackDuckProjectDetailsModel (com.synopsys.integration.alert.common.persistence.model.job.BlackDuckProjectDetailsModel)1 FilteredDistributionJobResponseModel (com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobResponseModel)1 HttpServletContentWrapper (com.synopsys.integration.alert.common.rest.HttpServletContentWrapper)1 FieldModel (com.synopsys.integration.alert.common.rest.model.FieldModel)1 AuthorizationManager (com.synopsys.integration.alert.common.security.authorization.AuthorizationManager)1 BlackDuckJobDetailsEntity (com.synopsys.integration.alert.database.job.blackduck.BlackDuckJobDetailsEntity)1 IssueTrackerChannelKey (com.synopsys.integration.alert.descriptor.api.model.IssueTrackerChannelKey)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 List (java.util.List)1 Set (java.util.Set)1 UUID (java.util.UUID)1 Collectors (java.util.stream.Collectors)1