Search in sources :

Example 1 with IssueSearchService

use of com.synopsys.integration.jira.common.cloud.service.IssueSearchService in project hub-alert by blackducksoftware.

the class JiraCloudGlobalFieldModelTestAction method canUserGetIssues.

@Override
protected boolean canUserGetIssues(FieldUtility fieldUtility) throws IntegrationException {
    JiraCloudProperties jiraProperties = jiraCloudPropertiesFactory.createJiraProperties(fieldUtility);
    JiraCloudServiceFactory jiraCloudServiceFactory = jiraProperties.createJiraServicesCloudFactory(logger, gson);
    IssueSearchService issueSearchService = jiraCloudServiceFactory.createIssueSearchService();
    IssueSearchResponseModel issueSearchResponseModel = issueSearchService.queryForIssuePage("", 0, 1);
    return issueSearchResponseModel.getIssues().size() > 0;
}
Also used : IssueSearchService(com.synopsys.integration.jira.common.cloud.service.IssueSearchService) JiraCloudServiceFactory(com.synopsys.integration.jira.common.cloud.service.JiraCloudServiceFactory) IssueSearchResponseModel(com.synopsys.integration.jira.common.cloud.model.IssueSearchResponseModel) JiraCloudProperties(com.synopsys.integration.alert.channel.jira.cloud.JiraCloudProperties)

Example 2 with IssueSearchService

use of com.synopsys.integration.jira.common.cloud.service.IssueSearchService 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

JiraCloudProperties (com.synopsys.integration.alert.channel.jira.cloud.JiraCloudProperties)2 IssueSearchService (com.synopsys.integration.jira.common.cloud.service.IssueSearchService)2 JiraCloudServiceFactory (com.synopsys.integration.jira.common.cloud.service.JiraCloudServiceFactory)2 IssueTrackerModelExtractor (com.synopsys.integration.alert.api.channel.issue.IssueTrackerModelExtractor)1 IssueTrackerProcessor (com.synopsys.integration.alert.api.channel.issue.IssueTrackerProcessor)1 JiraErrorMessageUtility (com.synopsys.integration.alert.api.channel.jira.distribution.JiraErrorMessageUtility)1 JiraIssueCreationRequestCreator (com.synopsys.integration.alert.api.channel.jira.distribution.JiraIssueCreationRequestCreator)1 JiraCustomFieldResolver (com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraCustomFieldResolver)1 JiraIssueAlertPropertiesManager (com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueAlertPropertiesManager)1 JiraIssueStatusCreator (com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueStatusCreator)1 JiraSearcherFactory (com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraSearcherFactory)1 IssueSearchResponseModel (com.synopsys.integration.jira.common.cloud.model.IssueSearchResponseModel)1 FieldService (com.synopsys.integration.jira.common.cloud.service.FieldService)1 IssueService (com.synopsys.integration.jira.common.cloud.service.IssueService)1 ProjectService (com.synopsys.integration.jira.common.cloud.service.ProjectService)1 IssuePropertyService (com.synopsys.integration.jira.common.rest.service.IssuePropertyService)1