Search in sources :

Example 1 with ProjectIssueSearchResult

use of com.synopsys.integration.alert.api.channel.issue.search.ProjectIssueSearchResult in project hub-alert by blackducksoftware.

the class JiraComponentIssueFinder method findIssuesByComponent.

@Override
public List<ProjectIssueSearchResult<String>> findIssuesByComponent(ProviderDetails providerDetails, LinkableItem project, LinkableItem projectVersion, BomComponentDetails originalBomComponent) throws AlertException {
    LinkableItem component = originalBomComponent.getComponent();
    LinkableItem nullableComponentVersion = originalBomComponent.getComponentVersion().orElse(null);
    String jqlString = JqlStringCreator.createBlackDuckComponentIssuesSearchString(jiraProjectKey, providerDetails.getProvider(), project, projectVersion, component, nullableComponentVersion);
    List<JiraSearcherResponseModel> issueResponseModels = jqlQueryExecutor.executeQuery(jqlString);
    List<ProjectIssueSearchResult<String>> searchResults = new ArrayList<>();
    for (JiraSearcherResponseModel model : issueResponseModels) {
        IssueBomComponentDetails issueBomComponentDetails = IssueBomComponentDetails.fromBomComponentDetails(originalBomComponent);
        ProjectIssueModel projectIssueModel = ProjectIssueModel.bom(providerDetails, project, projectVersion, issueBomComponentDetails);
        ProjectIssueSearchResult<String> resultFromExistingIssue = searchResultCreator.createIssueResult(model, projectIssueModel);
        searchResults.add(resultFromExistingIssue);
    }
    return searchResults;
}
Also used : LinkableItem(com.synopsys.integration.alert.common.message.model.LinkableItem) IssueBomComponentDetails(com.synopsys.integration.alert.api.channel.issue.model.IssueBomComponentDetails) ProjectIssueSearchResult(com.synopsys.integration.alert.api.channel.issue.search.ProjectIssueSearchResult) ArrayList(java.util.ArrayList) ProjectIssueModel(com.synopsys.integration.alert.api.channel.issue.model.ProjectIssueModel)

Example 2 with ProjectIssueSearchResult

use of com.synopsys.integration.alert.api.channel.issue.search.ProjectIssueSearchResult in project hub-alert by blackducksoftware.

the class JiraIssueSearchResultCreator method createIssueResult.

public ProjectIssueSearchResult<String> createIssueResult(JiraSearcherResponseModel issue, ProjectIssueModel projectIssueModel) {
    IssueCategory issueCategory = issueCategoryRetriever.retrieveIssueCategoryFromProjectIssueModel(projectIssueModel);
    ExistingIssueDetails<String> issueDetails = createExistingIssueDetails(issue, issueCategory);
    return new ProjectIssueSearchResult<>(issueDetails, projectIssueModel);
}
Also used : IssueCategory(com.synopsys.integration.alert.api.channel.issue.search.enumeration.IssueCategory) ProjectIssueSearchResult(com.synopsys.integration.alert.api.channel.issue.search.ProjectIssueSearchResult)

Example 3 with ProjectIssueSearchResult

use of com.synopsys.integration.alert.api.channel.issue.search.ProjectIssueSearchResult in project hub-alert by blackducksoftware.

the class AzureBoardsComponentIssueFinder method findIssuesByComponent.

@Override
public List<ProjectIssueSearchResult<Integer>> findIssuesByComponent(ProviderDetails providerDetails, LinkableItem project, LinkableItem projectVersion, BomComponentDetails bomComponent) throws AlertException {
    AzureSearchFieldMappingBuilder fieldRefNameToValue = createBomFieldReferenceToValueMap(projectVersion, bomComponent);
    List<WorkItemResponseModel> workItems = workItemFinder.findWorkItems(providerDetails.getProvider(), project, fieldRefNameToValue);
    List<ProjectIssueSearchResult<Integer>> searchResults = new ArrayList<>(workItems.size());
    for (WorkItemResponseModel workItem : workItems) {
        IssueBomComponentDetails issueBomComponent = IssueBomComponentDetails.fromBomComponentDetails(bomComponent);
        ProjectIssueModel projectIssueModel = ProjectIssueModel.bom(providerDetails, project, projectVersion, issueBomComponent);
        ExistingIssueDetails<Integer> issueDetails = issueDetailsCreator.createIssueDetails(workItem, workItem.createFieldsWrapper(gson), projectIssueModel);
        ProjectIssueSearchResult<Integer> searchResult = new ProjectIssueSearchResult<>(issueDetails, projectIssueModel);
        searchResults.add(searchResult);
    }
    return searchResults;
}
Also used : IssueBomComponentDetails(com.synopsys.integration.alert.api.channel.issue.model.IssueBomComponentDetails) ProjectIssueSearchResult(com.synopsys.integration.alert.api.channel.issue.search.ProjectIssueSearchResult) ArrayList(java.util.ArrayList) ProjectIssueModel(com.synopsys.integration.alert.api.channel.issue.model.ProjectIssueModel) WorkItemResponseModel(com.synopsys.integration.azure.boards.common.service.workitem.response.WorkItemResponseModel)

Example 4 with ProjectIssueSearchResult

use of com.synopsys.integration.alert.api.channel.issue.search.ProjectIssueSearchResult in project hub-alert by blackducksoftware.

the class AzureBoardsProjectAndVersionIssueFinder method findWorkItemsAndConvertToSearchResults.

private List<ProjectIssueSearchResult<Integer>> findWorkItemsAndConvertToSearchResults(ProviderDetails providerDetails, LinkableItem project, @Nullable LinkableItem projectVersion, AzureSearchFieldMappingBuilder fieldReferenceNameToExpectedValue) throws AlertException {
    List<WorkItemResponseModel> workItems = workItemFinder.findWorkItems(providerDetails.getProvider(), project, fieldReferenceNameToExpectedValue);
    List<ProjectIssueSearchResult<Integer>> searchResults = new ArrayList<>(workItems.size());
    for (WorkItemResponseModel workItem : workItems) {
        WorkItemFieldsWrapper workItemFields = workItem.createFieldsWrapper(gson);
        ProjectIssueModel projectIssueModel = createProjectIssueModel(providerDetails, project, projectVersion, workItemFields);
        ExistingIssueDetails<Integer> issueDetails = issueDetailsCreator.createIssueDetails(workItem, workItemFields, projectIssueModel);
        ProjectIssueSearchResult<Integer> searchResult = new ProjectIssueSearchResult<>(issueDetails, projectIssueModel);
        searchResults.add(searchResult);
    }
    return searchResults;
}
Also used : WorkItemFieldsWrapper(com.synopsys.integration.azure.boards.common.service.workitem.response.WorkItemFieldsWrapper) ProjectIssueSearchResult(com.synopsys.integration.alert.api.channel.issue.search.ProjectIssueSearchResult) ArrayList(java.util.ArrayList) ProjectIssueModel(com.synopsys.integration.alert.api.channel.issue.model.ProjectIssueModel) WorkItemResponseModel(com.synopsys.integration.azure.boards.common.service.workitem.response.WorkItemResponseModel)

Aggregations

ProjectIssueSearchResult (com.synopsys.integration.alert.api.channel.issue.search.ProjectIssueSearchResult)4 ProjectIssueModel (com.synopsys.integration.alert.api.channel.issue.model.ProjectIssueModel)3 ArrayList (java.util.ArrayList)3 IssueBomComponentDetails (com.synopsys.integration.alert.api.channel.issue.model.IssueBomComponentDetails)2 WorkItemResponseModel (com.synopsys.integration.azure.boards.common.service.workitem.response.WorkItemResponseModel)2 IssueCategory (com.synopsys.integration.alert.api.channel.issue.search.enumeration.IssueCategory)1 LinkableItem (com.synopsys.integration.alert.common.message.model.LinkableItem)1 WorkItemFieldsWrapper (com.synopsys.integration.azure.boards.common.service.workitem.response.WorkItemFieldsWrapper)1