use of com.synopsys.integration.alert.channel.jira.server.JiraServerProperties in project hub-alert by blackducksoftware.
the class JiraServerCustomFunctionAction method createActionResponse.
@Override
public ActionResponse<String> createActionResponse(FieldModel fieldModel, HttpServletContentWrapper ignoredServletContent) {
try {
JiraServerProperties jiraProperties = jiraServerPropertiesFactory.createJiraPropertiesWithJobId(UUID.fromString(fieldModel.getId()));
JiraServerServiceFactory jiraServicesFactory = jiraProperties.createJiraServicesServerFactory(logger, gson);
PluginManagerService jiraAppService = jiraServicesFactory.createPluginManagerService();
try {
jiraAppService.installMarketplaceServerApp(JiraConstants.JIRA_APP_KEY);
} catch (IntegrationRestException e) {
if (RestConstants.NOT_FOUND_404 == e.getHttpStatusCode()) {
return new ActionResponse<>(HttpStatus.NOT_FOUND, String.format("The marketplace listing of the '%s' app may not support your version of Jira. Please install the app manually or request a compatibility update. Error: %s", JiraConstants.JIRA_ALERT_APP_NAME, e.getMessage()));
}
return createBadRequestIntegrationException(e);
}
boolean jiraPluginInstalled = JiraPluginCheckUtils.checkIsAppInstalledAndRetryIfNecessary(jiraAppService);
if (!jiraPluginInstalled) {
return new ActionResponse<>(HttpStatus.NOT_FOUND, String.format("Unable to confirm Jira server successfully installed the '%s' plugin. Please verify the installation on you Jira server.", JiraConstants.JIRA_ALERT_APP_NAME));
}
return new ActionResponse<>(HttpStatus.OK, String.format("Successfully installed the '%s' plugin on Jira server.", JiraConstants.JIRA_ALERT_APP_NAME));
} catch (IntegrationException e) {
return createBadRequestIntegrationException(e);
} catch (InterruptedException e) {
logger.error("Thread was interrupted while validating Jira plugin installation.", e);
Thread.currentThread().interrupt();
return new ActionResponse<>(HttpStatus.INTERNAL_SERVER_ERROR, String.format("Thread was interrupted while validating Jira '%s' plugin installation: %s", JiraConstants.JIRA_ALERT_APP_NAME, e.getMessage()));
}
}
use of com.synopsys.integration.alert.channel.jira.server.JiraServerProperties 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;
}
Aggregations