use of com.synopsys.integration.azure.boards.common.service.workitem.response.WorkItemResponseModel in project hub-alert by blackducksoftware.
the class AzureBoardsComponentIssueFinderTest method createWorkItemResponseModel.
private WorkItemResponseModel createWorkItemResponseModel(String workItemState) {
JsonObject workItemFields = new JsonObject();
workItemFields.addProperty(WorkItemResponseFields.System_State.getFieldName(), workItemState);
return new WorkItemResponseModel(1, null, workItemFields, null, null, null, null);
}
use of com.synopsys.integration.azure.boards.common.service.workitem.response.WorkItemResponseModel in project hub-alert by blackducksoftware.
the class AzureBoardsComponentIssueFinder method findExistingIssuesByProjectIssueModel.
@Override
public List<ExistingIssueDetails<Integer>> findExistingIssuesByProjectIssueModel(ProjectIssueModel projectIssueModel) throws AlertException {
LinkableItem projectVersion = projectIssueModel.getProjectVersion().orElseThrow(() -> new AlertRuntimeException("Missing project-version"));
String categoryKey = AzureBoardsAlertIssuePropertiesManager.CATEGORY_TYPE_VULNERABILITY_COMPATIBILITY_LABEL;
AzureSearchFieldMappingBuilder fieldRefNameToValue = createBomFieldReferenceToValueMap(projectVersion, projectIssueModel.getBomComponentDetails());
Optional<IssuePolicyDetails> policyDetails = projectIssueModel.getPolicyDetails();
Optional<String> optionalPolicyName = policyDetails.map(IssuePolicyDetails::getName);
if (optionalPolicyName.isPresent()) {
categoryKey = AzureBoardsAlertIssuePropertiesManager.CATEGORY_TYPE_POLICY_COMPATIBILITY_LABEL;
String additionalInfoKey = AzureBoardsAlertIssuePropertiesManager.POLICY_ADDITIONAL_KEY_COMPATIBILITY_LABEL + optionalPolicyName.get();
fieldRefNameToValue.addAdditionalInfoKey(additionalInfoKey);
}
if (projectIssueModel.getComponentUnknownVersionDetails().isPresent()) {
categoryKey = AzureBoardsAlertIssuePropertiesManager.CATEGORY_TYPE_COMPONENT_UNKNOWN_VERSION_COMPATIBILITY_LABEL;
}
fieldRefNameToValue.addCategoryKey(categoryKey);
return workItemFinder.findWorkItems(projectIssueModel.getProvider(), projectIssueModel.getProject(), fieldRefNameToValue).stream().map(workItemResponseModel -> createIssueDetails(workItemResponseModel, projectIssueModel)).collect(Collectors.toList());
}
use of com.synopsys.integration.azure.boards.common.service.workitem.response.WorkItemResponseModel 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;
}
Aggregations