Search in sources :

Example 1 with JiraIssueCreationRequestCreator

use of com.synopsys.integration.alert.api.channel.jira.distribution.JiraIssueCreationRequestCreator 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 JiraIssueCreationRequestCreator

use of com.synopsys.integration.alert.api.channel.jira.distribution.JiraIssueCreationRequestCreator 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)

Example 3 with JiraIssueCreationRequestCreator

use of com.synopsys.integration.alert.api.channel.jira.distribution.JiraIssueCreationRequestCreator in project hub-alert by blackducksoftware.

the class JiraCloudIssueCreatorTest method createTestJiraCloudIssueCreator.

private TestJiraCloudIssueCreator createTestJiraCloudIssueCreator(String projectNameOrKey, JiraCloudJobDetailsModel jiraCloudJobDetailsModel) throws IntegrationException {
    ProjectService projectService = Mockito.mock(ProjectService.class);
    Mockito.when(projectService.getProjectsByName(Mockito.anyString())).thenReturn(new PageOfProjectsResponseModel(List.of(new ProjectComponent("self", "id", "key", projectNameOrKey, null, null, null, null))));
    JiraCustomFieldResolver jiraCustomFieldResolver = new JiraCustomFieldResolver(() -> List.of());
    JiraIssueCreationRequestCreator jiraIssueCreationRequestCreator = new JiraIssueCreationRequestCreator(jiraCustomFieldResolver);
    IssueCategoryRetriever issueCategoryRetriever = new IssueCategoryRetriever();
    return new TestJiraCloudIssueCreator(jiraCloudJobDetailsModel, projectService, jiraIssueCreationRequestCreator, issueCategoryRetriever);
}
Also used : ProjectComponent(com.synopsys.integration.jira.common.model.components.ProjectComponent) JiraCustomFieldResolver(com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraCustomFieldResolver) JiraIssueCreationRequestCreator(com.synopsys.integration.alert.api.channel.jira.distribution.JiraIssueCreationRequestCreator) ProjectService(com.synopsys.integration.jira.common.cloud.service.ProjectService) PageOfProjectsResponseModel(com.synopsys.integration.jira.common.model.response.PageOfProjectsResponseModel) IssueCategoryRetriever(com.synopsys.integration.alert.api.channel.issue.search.IssueCategoryRetriever)

Example 4 with JiraIssueCreationRequestCreator

use of com.synopsys.integration.alert.api.channel.jira.distribution.JiraIssueCreationRequestCreator in project hub-alert by blackducksoftware.

the class JiraServerMessageSenderFactory method createMessageSender.

@Override
public IssueTrackerMessageSender<String> createMessageSender(JiraServerJobDetailsModel distributionDetails) throws AlertException {
    JiraServerProperties jiraServerProperties = jiraServerPropertiesFactory.createJiraPropertiesWithJobId(distributionDetails.getJobId());
    JiraServerServiceFactory jiraServerServiceFactory = jiraServerProperties.createJiraServicesServerFactory(logger, gson);
    // Jira Services
    IssueService issueService = jiraServerServiceFactory.createIssueService();
    IssuePropertyService issuePropertyService = jiraServerServiceFactory.createIssuePropertyService();
    // Common Helpers
    JiraIssueAlertPropertiesManager issuePropertiesManager = new JiraIssueAlertPropertiesManager(gson, issuePropertyService);
    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);
    return createMessageSender(issueService, distributionDetails, projectService, issueCreationRequestCreator, issuePropertiesManager, jiraErrorMessageUtility);
}
Also used : IssueService(com.synopsys.integration.jira.common.server.service.IssueService) FieldService(com.synopsys.integration.jira.common.server.service.FieldService) JiraCustomFieldResolver(com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraCustomFieldResolver) JiraErrorMessageUtility(com.synopsys.integration.alert.api.channel.jira.distribution.JiraErrorMessageUtility) JiraServerServiceFactory(com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory) 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) JiraIssueAlertPropertiesManager(com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueAlertPropertiesManager)

Example 5 with JiraIssueCreationRequestCreator

use of com.synopsys.integration.alert.api.channel.jira.distribution.JiraIssueCreationRequestCreator in project hub-alert by blackducksoftware.

the class JiraCloudMessageSenderFactory method createMessageSender.

@Override
public IssueTrackerMessageSender<String> createMessageSender(JiraCloudJobDetailsModel distributionDetails) throws AlertException {
    JiraCloudProperties jiraCloudProperties = jiraCloudPropertiesFactory.createJiraProperties();
    JiraCloudServiceFactory jiraCloudServiceFactory = jiraCloudProperties.createJiraServicesCloudFactory(logger, gson);
    // Jira Services
    IssueService issueService = jiraCloudServiceFactory.createIssueService();
    IssuePropertyService issuePropertyService = jiraCloudServiceFactory.createIssuePropertyService();
    // Common Helpers
    JiraIssueAlertPropertiesManager issuePropertiesManager = new JiraIssueAlertPropertiesManager(gson, issuePropertyService);
    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);
    return createMessageSender(issueService, distributionDetails, projectService, issueCreationRequestCreator, issuePropertiesManager, jiraErrorMessageUtility);
}
Also used : IssueService(com.synopsys.integration.jira.common.cloud.service.IssueService) FieldService(com.synopsys.integration.jira.common.cloud.service.FieldService) JiraCustomFieldResolver(com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraCustomFieldResolver) JiraErrorMessageUtility(com.synopsys.integration.alert.api.channel.jira.distribution.JiraErrorMessageUtility) 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) JiraIssueAlertPropertiesManager(com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueAlertPropertiesManager)

Aggregations

JiraIssueCreationRequestCreator (com.synopsys.integration.alert.api.channel.jira.distribution.JiraIssueCreationRequestCreator)5 JiraCustomFieldResolver (com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraCustomFieldResolver)5 JiraErrorMessageUtility (com.synopsys.integration.alert.api.channel.jira.distribution.JiraErrorMessageUtility)4 JiraIssueAlertPropertiesManager (com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueAlertPropertiesManager)4 IssuePropertyService (com.synopsys.integration.jira.common.rest.service.IssuePropertyService)4 ProjectService (com.synopsys.integration.jira.common.cloud.service.ProjectService)3 IssueTrackerModelExtractor (com.synopsys.integration.alert.api.channel.issue.IssueTrackerModelExtractor)2 IssueTrackerProcessor (com.synopsys.integration.alert.api.channel.issue.IssueTrackerProcessor)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 JiraCloudProperties (com.synopsys.integration.alert.channel.jira.cloud.JiraCloudProperties)2 JiraServerProperties (com.synopsys.integration.alert.channel.jira.server.JiraServerProperties)2 FieldService (com.synopsys.integration.jira.common.cloud.service.FieldService)2 IssueService (com.synopsys.integration.jira.common.cloud.service.IssueService)2 JiraCloudServiceFactory (com.synopsys.integration.jira.common.cloud.service.JiraCloudServiceFactory)2 FieldService (com.synopsys.integration.jira.common.server.service.FieldService)2 IssueService (com.synopsys.integration.jira.common.server.service.IssueService)2 JiraServerServiceFactory (com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory)2 ProjectService (com.synopsys.integration.jira.common.server.service.ProjectService)2 IssueCategoryRetriever (com.synopsys.integration.alert.api.channel.issue.search.IssueCategoryRetriever)1