Search in sources :

Example 1 with IssueTrackerModelExtractor

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

the class JiraServerProcessorFactory method createProcessor.

@Override
public IssueTrackerProcessor<String> createProcessor(JiraServerJobDetailsModel distributionDetails) throws AlertException {
    JiraServerProperties jiraProperties = jiraServerPropertiesFactory.createJiraPropertiesWithJobId(distributionDetails.getJobId());
    JiraServerServiceFactory jiraServerServiceFactory = jiraProperties.createJiraServicesServerFactory(logger, gson);
    if (!jiraProperties.isPluginCheckDisabled()) {
        checkIfAlertPluginIsInstalled(jiraServerServiceFactory.createPluginManagerService());
    }
    // Jira Services
    IssueService issueService = jiraServerServiceFactory.createIssueService();
    IssueSearchService issueSearchService = jiraServerServiceFactory.createIssueSearchService();
    IssuePropertyService issuePropertyService = jiraServerServiceFactory.createIssuePropertyService();
    // Common Helpers
    JiraIssueAlertPropertiesManager issuePropertiesManager = new JiraIssueAlertPropertiesManager(gson, issuePropertyService);
    // Extractor Requirement
    JiraIssueStatusCreator jiraIssueStatusCreator = new JiraIssueStatusCreator(distributionDetails.getResolveTransition(), distributionDetails.getReopenTransition());
    JiraSearcherFactory jiraSearcherFactory = new JiraSearcherFactory(issuePropertiesManager, jiraIssueStatusCreator, issueService::getTransitions, issueCategoryRetriever, modelTransformer);
    JiraServerQueryExecutor jiraCloudQueryExecutor = new JiraServerQueryExecutor(issueSearchService);
    IssueTrackerSearcher<String> jiraSearcher = jiraSearcherFactory.createJiraSearcher(distributionDetails.getProjectNameOrKey(), jiraCloudQueryExecutor);
    IssueTrackerModelExtractor<String> extractor = new IssueTrackerModelExtractor<>(jiraMessageFormatter, jiraSearcher);
    ProjectService projectService = jiraServerServiceFactory.createProjectService();
    FieldService fieldService = jiraServerServiceFactory.createFieldService();
    JiraCustomFieldResolver customFieldResolver = new JiraCustomFieldResolver(fieldService::getUserVisibleFields);
    JiraIssueCreationRequestCreator issueCreationRequestCreator = new JiraIssueCreationRequestCreator(customFieldResolver);
    JiraErrorMessageUtility jiraErrorMessageUtility = new JiraErrorMessageUtility(gson, customFieldResolver);
    IssueTrackerMessageSender<String> messageSender = jiraServerMessageSenderFactory.createMessageSender(issueService, distributionDetails, projectService, issueCreationRequestCreator, issuePropertiesManager, jiraErrorMessageUtility);
    return new IssueTrackerProcessor<>(extractor, messageSender);
}
Also used : IssueService(com.synopsys.integration.jira.common.server.service.IssueService) IssueTrackerProcessor(com.synopsys.integration.alert.api.channel.issue.IssueTrackerProcessor) JiraCustomFieldResolver(com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraCustomFieldResolver) JiraErrorMessageUtility(com.synopsys.integration.alert.api.channel.jira.distribution.JiraErrorMessageUtility) IssueSearchService(com.synopsys.integration.jira.common.server.service.IssueSearchService) JiraIssueCreationRequestCreator(com.synopsys.integration.alert.api.channel.jira.distribution.JiraIssueCreationRequestCreator) IssuePropertyService(com.synopsys.integration.jira.common.rest.service.IssuePropertyService) ProjectService(com.synopsys.integration.jira.common.server.service.ProjectService) JiraServerProperties(com.synopsys.integration.alert.channel.jira.server.JiraServerProperties) FieldService(com.synopsys.integration.jira.common.server.service.FieldService) JiraServerServiceFactory(com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory) JiraSearcherFactory(com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraSearcherFactory) IssueTrackerModelExtractor(com.synopsys.integration.alert.api.channel.issue.IssueTrackerModelExtractor) JiraIssueStatusCreator(com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueStatusCreator) JiraIssueAlertPropertiesManager(com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueAlertPropertiesManager)

Example 2 with IssueTrackerModelExtractor

use of com.synopsys.integration.alert.api.channel.issue.IssueTrackerModelExtractor 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);
}
Also used : AzureBoardsProjectAndVersionIssueFinder(com.synopsys.integration.alert.channel.azure.boards.distribution.search.AzureBoardsProjectAndVersionIssueFinder) AzureBoardsWorkItemFinder(com.synopsys.integration.alert.channel.azure.boards.distribution.search.AzureBoardsWorkItemFinder) AzureWorkItemTypeStateService(com.synopsys.integration.azure.boards.common.service.state.AzureWorkItemTypeStateService) AzureWorkItemQueryService(com.synopsys.integration.azure.boards.common.service.query.AzureWorkItemQueryService) ProxyInfo(com.synopsys.integration.rest.proxy.ProxyInfo) IssueTrackerModelExtractor(com.synopsys.integration.alert.api.channel.issue.IssueTrackerModelExtractor) AzureWorkItemCommentService(com.synopsys.integration.azure.boards.common.service.comment.AzureWorkItemCommentService) AzureHttpRequestCreator(com.synopsys.integration.azure.boards.common.http.AzureHttpRequestCreator) AzureHttpService(com.synopsys.integration.azure.boards.common.http.AzureHttpService) AzureBoardsExistingIssueDetailsCreator(com.synopsys.integration.alert.channel.azure.boards.distribution.search.AzureBoardsExistingIssueDetailsCreator) AzureBoardsProperties(com.synopsys.integration.alert.channel.azure.boards.AzureBoardsProperties) IssueTrackerProcessor(com.synopsys.integration.alert.api.channel.issue.IssueTrackerProcessor) IssueTrackerSearcher(com.synopsys.integration.alert.api.channel.issue.search.IssueTrackerSearcher) AzureProjectService(com.synopsys.integration.azure.boards.common.service.project.AzureProjectService) AzureApiVersionAppender(com.synopsys.integration.azure.boards.common.http.AzureApiVersionAppender) AzureBoardsComponentIssueFinder(com.synopsys.integration.alert.channel.azure.boards.distribution.search.AzureBoardsComponentIssueFinder) AzureBoardsIssueStatusResolver(com.synopsys.integration.alert.channel.azure.boards.distribution.search.AzureBoardsIssueStatusResolver) AzureWorkItemService(com.synopsys.integration.azure.boards.common.service.workitem.AzureWorkItemService) AzureProcessService(com.synopsys.integration.azure.boards.common.service.process.AzureProcessService)

Example 3 with IssueTrackerModelExtractor

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

the class JiraCloudProcessorFactory method createProcessor.

@Override
public IssueTrackerProcessor<String> createProcessor(JiraCloudJobDetailsModel distributionDetails) throws AlertException {
    JiraCloudProperties jiraProperties = createJiraCloudProperties();
    JiraCloudServiceFactory jiraCloudServiceFactory = jiraProperties.createJiraServicesCloudFactory(logger, gson);
    if (!jiraProperties.isPluginCheckDisabled()) {
        checkIfAlertPluginIsInstalled(jiraCloudServiceFactory.createPluginManagerService());
    }
    // Jira Cloud Services
    IssueService issueService = jiraCloudServiceFactory.createIssueService();
    IssueSearchService issueSearchService = jiraCloudServiceFactory.createIssueSearchService();
    IssuePropertyService issuePropertyService = jiraCloudServiceFactory.createIssuePropertyService();
    // Common Helpers
    JiraIssueAlertPropertiesManager issuePropertiesManager = new JiraIssueAlertPropertiesManager(gson, issuePropertyService);
    // Extractor Requirement
    JiraIssueStatusCreator jiraIssueStatusCreator = new JiraIssueStatusCreator(distributionDetails.getResolveTransition(), distributionDetails.getReopenTransition());
    JiraSearcherFactory jiraSearcherFactory = new JiraSearcherFactory(issuePropertiesManager, jiraIssueStatusCreator, issueService::getTransitions, issueCategoryRetriever, modelTransformer);
    JiraCloudQueryExecutor jiraCloudQueryExecutor = new JiraCloudQueryExecutor(issueSearchService);
    IssueTrackerSearcher<String> jiraSearcher = jiraSearcherFactory.createJiraSearcher(distributionDetails.getProjectNameOrKey(), jiraCloudQueryExecutor);
    IssueTrackerModelExtractor<String> extractor = new IssueTrackerModelExtractor<>(jiraMessageFormatter, jiraSearcher);
    ProjectService projectService = jiraCloudServiceFactory.createProjectService();
    FieldService fieldService = jiraCloudServiceFactory.createFieldService();
    JiraCustomFieldResolver customFieldResolver = new JiraCustomFieldResolver(fieldService::getUserVisibleFields);
    JiraIssueCreationRequestCreator issueCreationRequestCreator = new JiraIssueCreationRequestCreator(customFieldResolver);
    JiraErrorMessageUtility jiraErrorMessageUtility = new JiraErrorMessageUtility(gson, customFieldResolver);
    IssueTrackerMessageSender<String> messageSender = messageSenderFactory.createMessageSender(issueService, distributionDetails, projectService, issueCreationRequestCreator, issuePropertiesManager, jiraErrorMessageUtility);
    return new IssueTrackerProcessor<>(extractor, messageSender);
}
Also used : IssueService(com.synopsys.integration.jira.common.cloud.service.IssueService) IssueTrackerProcessor(com.synopsys.integration.alert.api.channel.issue.IssueTrackerProcessor) JiraCustomFieldResolver(com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraCustomFieldResolver) JiraErrorMessageUtility(com.synopsys.integration.alert.api.channel.jira.distribution.JiraErrorMessageUtility) IssueSearchService(com.synopsys.integration.jira.common.cloud.service.IssueSearchService) JiraIssueCreationRequestCreator(com.synopsys.integration.alert.api.channel.jira.distribution.JiraIssueCreationRequestCreator) JiraCloudServiceFactory(com.synopsys.integration.jira.common.cloud.service.JiraCloudServiceFactory) IssuePropertyService(com.synopsys.integration.jira.common.rest.service.IssuePropertyService) JiraCloudProperties(com.synopsys.integration.alert.channel.jira.cloud.JiraCloudProperties) ProjectService(com.synopsys.integration.jira.common.cloud.service.ProjectService) FieldService(com.synopsys.integration.jira.common.cloud.service.FieldService) JiraSearcherFactory(com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraSearcherFactory) IssueTrackerModelExtractor(com.synopsys.integration.alert.api.channel.issue.IssueTrackerModelExtractor) JiraIssueStatusCreator(com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueStatusCreator) JiraIssueAlertPropertiesManager(com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueAlertPropertiesManager)

Aggregations

IssueTrackerModelExtractor (com.synopsys.integration.alert.api.channel.issue.IssueTrackerModelExtractor)3 IssueTrackerProcessor (com.synopsys.integration.alert.api.channel.issue.IssueTrackerProcessor)3 JiraErrorMessageUtility (com.synopsys.integration.alert.api.channel.jira.distribution.JiraErrorMessageUtility)2 JiraIssueCreationRequestCreator (com.synopsys.integration.alert.api.channel.jira.distribution.JiraIssueCreationRequestCreator)2 JiraCustomFieldResolver (com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraCustomFieldResolver)2 JiraIssueAlertPropertiesManager (com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueAlertPropertiesManager)2 JiraIssueStatusCreator (com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueStatusCreator)2 JiraSearcherFactory (com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraSearcherFactory)2 IssuePropertyService (com.synopsys.integration.jira.common.rest.service.IssuePropertyService)2 IssueTrackerSearcher (com.synopsys.integration.alert.api.channel.issue.search.IssueTrackerSearcher)1 AzureBoardsProperties (com.synopsys.integration.alert.channel.azure.boards.AzureBoardsProperties)1 AzureBoardsComponentIssueFinder (com.synopsys.integration.alert.channel.azure.boards.distribution.search.AzureBoardsComponentIssueFinder)1 AzureBoardsExistingIssueDetailsCreator (com.synopsys.integration.alert.channel.azure.boards.distribution.search.AzureBoardsExistingIssueDetailsCreator)1 AzureBoardsIssueStatusResolver (com.synopsys.integration.alert.channel.azure.boards.distribution.search.AzureBoardsIssueStatusResolver)1 AzureBoardsProjectAndVersionIssueFinder (com.synopsys.integration.alert.channel.azure.boards.distribution.search.AzureBoardsProjectAndVersionIssueFinder)1 AzureBoardsWorkItemFinder (com.synopsys.integration.alert.channel.azure.boards.distribution.search.AzureBoardsWorkItemFinder)1 JiraCloudProperties (com.synopsys.integration.alert.channel.jira.cloud.JiraCloudProperties)1 JiraServerProperties (com.synopsys.integration.alert.channel.jira.server.JiraServerProperties)1 AzureApiVersionAppender (com.synopsys.integration.azure.boards.common.http.AzureApiVersionAppender)1 AzureHttpRequestCreator (com.synopsys.integration.azure.boards.common.http.AzureHttpRequestCreator)1