use of com.synopsys.integration.alert.api.channel.issue.search.IssueTrackerSearcher in project hub-alert by blackducksoftware.
the class AzureBoardsProcessorFactory method createProcessor.
@Override
public IssueTrackerProcessor<Integer> createProcessor(AzureBoardsJobDetailsModel distributionDetails) throws AlertException {
AzureBoardsProperties azureBoardsProperties = azureBoardsPropertiesFactory.createAzureBoardsProperties();
String organizationName = azureBoardsProperties.getOrganizationName();
azureBoardsProperties.validateProperties();
// Initialize Http Service
ProxyInfo proxy = proxyManager.createProxyInfoForHost(AzureHttpRequestCreatorFactory.DEFAULT_BASE_URL);
AzureHttpRequestCreator azureHttpRequestCreator = azureBoardsProperties.createAzureHttpRequestCreator(proxy, gson);
AzureHttpService azureHttpService = new AzureHttpService(gson, azureHttpRequestCreator);
// Common Azure Boards Services
AzureApiVersionAppender apiVersionAppender = new AzureApiVersionAppender();
AzureProjectService projectService = new AzureProjectService(azureHttpService, apiVersionAppender);
AzureWorkItemService workItemService = new AzureWorkItemService(azureHttpService, azureHttpRequestCreator);
AzureWorkItemQueryService workItemQueryService = new AzureWorkItemQueryService(azureHttpService, apiVersionAppender);
String projectNameOrId = distributionDetails.getProjectNameOrId();
String teamProjectName = retrieveProjectNameIfNecessary(projectService, organizationName, projectNameOrId);
installCustomFieldsIfNecessary(organizationName, teamProjectName, distributionDetails.getWorkItemType(), projectService, new AzureProcessService(azureHttpService, apiVersionAppender));
// Searcher Requirements
AzureBoardsIssueStatusResolver azureBoardsIssueStatusResolver = new AzureBoardsIssueStatusResolver(distributionDetails.getWorkItemCompletedState(), distributionDetails.getWorkItemReopenState());
AzureBoardsIssueTrackerQueryManager queryManager = new AzureBoardsIssueTrackerQueryManager(organizationName, distributionDetails, workItemService, workItemQueryService);
// Extractor Requirements
AzureBoardsExistingIssueDetailsCreator issueDetailsCreator = new AzureBoardsExistingIssueDetailsCreator(organizationName, issueCategoryRetriever, azureBoardsIssueStatusResolver);
AzureBoardsWorkItemFinder workItemFinder = new AzureBoardsWorkItemFinder(queryManager, teamProjectName);
AzureBoardsProjectAndVersionIssueFinder projectAndVersionIssueFinder = new AzureBoardsProjectAndVersionIssueFinder(gson, issueDetailsCreator, workItemFinder);
AzureBoardsComponentIssueFinder componentIssueFinder = new AzureBoardsComponentIssueFinder(gson, workItemFinder, issueDetailsCreator);
IssueTrackerSearcher<Integer> azureBoardsSearcher = new IssueTrackerSearcher<>(projectAndVersionIssueFinder, projectAndVersionIssueFinder, componentIssueFinder, componentIssueFinder, modelTransformer);
IssueTrackerModelExtractor<Integer> extractor = new IssueTrackerModelExtractor<>(formatter, azureBoardsSearcher);
// Message Sender Requirements
AzureWorkItemTypeStateService workItemTypeStateService = new AzureWorkItemTypeStateService(azureHttpService, apiVersionAppender);
AzureWorkItemCommentService workItemCommentService = new AzureWorkItemCommentService(azureHttpService, apiVersionAppender);
IssueTrackerMessageSender<Integer> messageSender = azureBoardsMessageSenderFactory.createMessageSender(workItemService, workItemTypeStateService, workItemCommentService, organizationName, distributionDetails);
return new IssueTrackerProcessor<>(extractor, messageSender);
}
Aggregations