Search in sources :

Example 1 with BomEditWithProjectNameNotificationContent

use of com.synopsys.integration.alert.provider.blackduck.processor.model.BomEditWithProjectNameNotificationContent in project hub-alert by blackducksoftware.

the class BomEditNotificationMessageExtractorTest method createBomEditWithProjectNameNotificationContent.

private BomEditWithProjectNameNotificationContent createBomEditWithProjectNameNotificationContent() {
    BomEditNotificationContent bomEditNotificationContent = new BomEditNotificationContent();
    bomEditNotificationContent.setProjectVersion(PROJECT_VERSION_ITEM.getValue());
    bomEditNotificationContent.setBomComponent("http://bomComponentUrl");
    bomEditNotificationContent.setComponentName(COMPONENT.getValue());
    bomEditNotificationContent.setComponentVersionName(COMPONENT_VERSION.getValue());
    return new BomEditWithProjectNameNotificationContent(bomEditNotificationContent, PROJECT_ITEM.getLabel(), PROJECT_VERSION_ITEM.getLabel());
}
Also used : BomEditNotificationContent(com.synopsys.integration.blackduck.api.manual.component.BomEditNotificationContent) BomEditWithProjectNameNotificationContent(com.synopsys.integration.alert.provider.blackduck.processor.model.BomEditWithProjectNameNotificationContent)

Example 2 with BomEditWithProjectNameNotificationContent

use of com.synopsys.integration.alert.provider.blackduck.processor.model.BomEditWithProjectNameNotificationContent in project hub-alert by blackducksoftware.

the class BomEditNotificationDetailExtractor method extractDetailedContent.

@Override
public List<DetailedNotificationContent> extractDetailedContent(AlertNotificationModel alertNotificationModel, BomEditNotificationView notificationView) {
    BomEditNotificationContent notificationContent = notificationView.getContent();
    Optional<ProjectVersionWrapper> optionalProjectAndVersion = retrieveProjectAndVersion(alertNotificationModel.getProviderConfigId(), notificationContent.getProjectVersion());
    if (optionalProjectAndVersion.isPresent()) {
        ProjectVersionWrapper projectAndVersion = optionalProjectAndVersion.get();
        ProjectView project = projectAndVersion.getProjectView();
        ProjectVersionView projectVersion = projectAndVersion.getProjectVersionView();
        String projectName = project.getName();
        BomEditWithProjectNameNotificationContent updatedNotificationContent = new BomEditWithProjectNameNotificationContent(notificationContent, projectName, projectVersion.getVersionName());
        DetailedNotificationContent detailedContent = DetailedNotificationContent.project(alertNotificationModel, updatedNotificationContent, projectName, projectVersion.getVersionName());
        return List.of(detailedContent);
    }
    return List.of();
}
Also used : BomEditNotificationContent(com.synopsys.integration.blackduck.api.manual.component.BomEditNotificationContent) ProjectVersionView(com.synopsys.integration.blackduck.api.generated.view.ProjectVersionView) DetailedNotificationContent(com.synopsys.integration.alert.processor.api.detail.DetailedNotificationContent) ProjectView(com.synopsys.integration.blackduck.api.generated.view.ProjectView) BomEditWithProjectNameNotificationContent(com.synopsys.integration.alert.provider.blackduck.processor.model.BomEditWithProjectNameNotificationContent) ProjectVersionWrapper(com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper)

Aggregations

BomEditWithProjectNameNotificationContent (com.synopsys.integration.alert.provider.blackduck.processor.model.BomEditWithProjectNameNotificationContent)2 BomEditNotificationContent (com.synopsys.integration.blackduck.api.manual.component.BomEditNotificationContent)2 DetailedNotificationContent (com.synopsys.integration.alert.processor.api.detail.DetailedNotificationContent)1 ProjectVersionView (com.synopsys.integration.blackduck.api.generated.view.ProjectVersionView)1 ProjectView (com.synopsys.integration.blackduck.api.generated.view.ProjectView)1 ProjectVersionWrapper (com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper)1