Search in sources :

Example 1 with IssueSearchService

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

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

the class JiraServerGlobalTestActionWrapper method canUserGetIssues.

public boolean canUserGetIssues() throws IntegrationException {
    IssueSearchService issueSearchService = jiraServerServiceFactory.createIssueSearchService();
    IssueSearchResponseModel issueSearchResponseModel = issueSearchService.queryForIssuePage("", 0, 1);
    return !issueSearchResponseModel.getIssues().isEmpty();
}
Also used : IssueSearchService(com.synopsys.integration.jira.common.server.service.IssueSearchService) IssueSearchResponseModel(com.synopsys.integration.jira.common.server.model.IssueSearchResponseModel)

Example 3 with IssueSearchService

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

the class JiraServerGlobalFieldModelTestAction method canUserGetIssues.

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

Aggregations

IssueSearchService (com.synopsys.integration.jira.common.server.service.IssueSearchService)3 JiraServerProperties (com.synopsys.integration.alert.channel.jira.server.JiraServerProperties)2 IssueSearchResponseModel (com.synopsys.integration.jira.common.server.model.IssueSearchResponseModel)2 JiraServerServiceFactory (com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory)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 IssuePropertyService (com.synopsys.integration.jira.common.rest.service.IssuePropertyService)1 FieldService (com.synopsys.integration.jira.common.server.service.FieldService)1 IssueService (com.synopsys.integration.jira.common.server.service.IssueService)1 ProjectService (com.synopsys.integration.jira.common.server.service.ProjectService)1