@Override public ApplicationLink getApplicationLink(ApplicationId id) throws TypeNotInstalledException { return applicationLinkService.getApplicationLink(id); }
public static ApplicationLink idToLink(ApplicationLinkService applicationLinkService, ApplicationId id) { try { return applicationLinkService.getApplicationLink(id); } catch (TypeNotInstalledException e) { throw new RuntimeException("Unexpected error: the Fisheye application type is not installed. Check that the Application Link Plugin is installed properly", e); } } }
public ApplicationLink getAppForKey(String projectKey) { ApplicationId appId = keyToAppMap.get(projectKey); try { return appLinkService.getApplicationLink(appId); } catch (TypeNotInstalledException e) { log.error("can't find application id: " + appId + " for jira project key: " + projectKey, e); } return null; }
private ApplicationLink getApplicationLink(final ApplicationId id) { final ApplicationLink applicationLink; try { applicationLink = applicationLinkService.getApplicationLink(id); } catch (TypeNotInstalledException e) { throw new IllegalStateException(String.format( "Failed to load application link %s as type %s is no longer installed.", id, e.getType())); } return applicationLink; }
@Override public Communicator get(ApplicationId applicationId) { checkNotNull(applicationId); try { return get(applicationLinkService.getApplicationLink(applicationId)); } catch (TypeNotInstalledException e) { throw new IllegalArgumentException("Unable to get an ApplicationLink for " + applicationId); } }
private ApplicationLink getApplicationLink(ApplicationId applicationId) throws TypeNotInstalledException { ApplicationLink link = applicationLinkService.getApplicationLink(applicationId); if (link == null) { throw new WebApplicationException(notFound("Applinks with ID " + applicationId + " not found")); } return link; }
@Override @Nullable public ApplicationLink getApplicationLink(@Nonnull final String serverKey) { try { return applicationLinkService.getApplicationLink(new ApplicationId(serverKey)); } catch (TypeNotInstalledException e) { // I'm not reacting to this exception. It should theoretically never happen. And no one would know what to do // with it anyway. Lets just say we didn't find the link. log.warn("Failed to retrieve application link for " + serverKey, e); return null; } }
/** * Get a {@link Communicator} instance for the given {@link Site} and {@link ApplicationId} given * * @param site the {@link Site} * @param applicationId the {@link ApplicationId} * @return teh {@link Communicator} instance */ private Communicator getByApplicationId(Site site, ApplicationId applicationId) { checkNotNull(applicationId, "applicationId cannot be null"); try { return getByApplicationLink(site, applicationLinkService.getApplicationLink(applicationId)); } catch (TypeNotInstalledException e) { throw new IllegalArgumentException("Unable to get an ApplicationLink for " + applicationId); } }
@Override @Nonnull public ApplicationLink getApplicationLink(@Nonnull ApplicationId id) throws NoSuchApplinkException { checkNotNull(id, "id"); try { ApplicationLink link = applicationLinkService.getApplicationLink(id); checkExists(id, link); return link; } catch (TypeNotInstalledException e) { throw typeNotInstalled(e); } }
protected ApplicationLink getApplicationLink(FishEyeInstance instance) { try { return applicationLinkService.getApplicationLink(instance.getApplicationId()); } catch (TypeNotInstalledException e) { throw new RuntimeException(String.format("The application link '%s' has an invalid type", instance.getApplicationId()), e); } }
protected ApplicationLink getApplicationLink(FishEyeInstance instance) { try { return applicationLinkService.getApplicationLink(instance.getApplicationId()); } catch (TypeNotInstalledException e) { throw new RuntimeException(String.format("The application link '%s' has an invalid type", instance.getApplicationId()), e); } }
public boolean apply(FishEyeInstance input) { final ApplicationId applicationId = applicationLinkIdMapper.fromInstanceId(input.getId()); try { //count it as stale if the applinkId doesnt exist, or if it does exist in our store, but doesn't in the actual UAL service. final boolean stale = applicationId == null || applicationLinkService.getApplicationLink(applicationId) == null; if (stale) { log.info("Found stale Fisheye Instance [" + input + "], upgrading..."); } return stale; } catch (TypeNotInstalledException e) { throw new RuntimeException("The required ApplicationLink type is not installed", e); } } }).isEmpty(); //should be empty if there is NO stale instances
@GET @Path("status/{applinkid}") public Response get(@PathParam("applinkid") String applinkId) throws Exception { ApplicationId id = RestApplicationIdParser.parseApplicationId(applinkId); ApplicationLink applink = applicationLinkService.getApplicationLink(id); return Response.ok(new RestTrustedAppsStatus( trustedUtils.inboundTrustEnabled(applink), trustedUtils.outboundTrustEnabled(applink))) .build(); }
@PUT @Path("status/{id}") public Response put(@PathParam("id") String applinkId, final RestBasicStatus restBasicStatus) throws InvalidApplicationIdException, TypeNotInstalledException { ApplicationLink applink = applicationLinkService.getApplicationLink(restApplicationIdParser.parse(applinkId)); final Map<String, String> config = ImmutableMap.of( RestBasicStatus.USERNAME, restBasicStatus.getUsername(), RestBasicStatus.PASSWORD, restBasicStatus.getPassword()); authenticationConfigurationManager.registerProvider(applink.getId(), BasicAuthenticationProvider.class, config); return Response.ok(restBasicStatus).build(); } }
public JiraLocation getLocationById(String id) { if (JiraLocation.LOCAL.getId().equals(id)) { return JiraLocation.LOCAL; } else { try { ApplicationLink link = applicationLinkService.getApplicationLink(new ApplicationId(id)); return JiraLocation.fromAppLink(link); } catch (TypeNotInstalledException e) { return null; } } }
@Override public Collection<Message> doUpgrade() throws Exception { for (Site site : siteService.getAll(false)) { boolean cleanup; try { cleanup = applicationLinkService.getApplicationLink(site.getApplicationId()) == null; } catch (TypeNotInstalledException e) { cleanup = true; } if (cleanup) { siteService.removeSite(site); } } return Collections.emptyList(); }
@Override public void addOrphanedTrustToApplicationLink(final String id, final OrphanedTrustCertificate.Type type, final ApplicationId applicationId) { checkCertificateType(type); try { ApplicationLink applicationLink = applicationLinkService.getApplicationLink(applicationId); trustConfigurator.issueInboundTrust(applicationLink); log.debug("Associated Trusted Apps configuration for Application Link id='" + applicationLink.getId() + "' and name='" + applicationLink.getName() + "'"); } catch (TypeNotInstalledException e) { throw new RuntimeException("An application of the type " + e.getType() + " is not installed!", e); } catch (TrustConfigurator.ConfigurationException e) { throw new RuntimeException("Failed to add Trusted Apps configuration for Application Link with id '" + applicationId + '"', e); } } }
public JiraProxy createJiraProxy(JiraLocation jira) { if (JiraLocation.isLocalLocation().apply(jira)) return new LocalJiraProxy(permissionManager, jiraAuthenticationContext, copyIssueService, attachmentManager, issueManager, issueLinkManager, remoteIssueLinkManager, projectInfoService, jiraBaseUrls, applicationProperties); else { try { final ApplicationLink applicationLink = applicationLinkService.getApplicationLink(new ApplicationId(jira.getId())); return new RemoteJiraProxy(hostApplication, applicationLink, jira, issueLinkClient, jiraAuthenticationContext, attachmentManager); } catch (TypeNotInstalledException e) { return null; } } }
@Override public ApplicationLink getApplicationLink(Site site) { if (site.getApplicationId() == null && site.getId() > 0) { site = get(site.getId()); } try { return applicationLinkService.getApplicationLink(site.getApplicationId()); } catch (TypeNotInstalledException e) { throw new IllegalArgumentException("Unable to get an ApplicationLink for " + site.getApplicationId()); } }
private void renderSnapshotJiraIssues(BlueprintContext contextMap) { String appId = (String) contextMap.get("jira-server-id"); if (StringUtils.isNotBlank(appId)) { try { ReadOnlyApplicationLink appLink = appLinkService.getApplicationLink(new ApplicationId(appId)); String jqlSearch = URLEncoder.encode((String) contextMap.get("jira-query"), "UTF-8"); Channel channel = jiraIssuesHelper.getChannel(appLink, jqlSearch, MAX_RESULT); contextMap.put("jiraissuesmacro", jiraIssuesHelper.renderJiraIssues(channel)); contextMap.put("jiraissuescountmacro", jiraIssuesHelper.getTotalIssueNumber(channel) + " " + helper.getText("jirareports.changelog.blueprint.total.issues.title")); } catch (Exception e) { LOGGER.error("Can not render jira issues", e); contextMap.put("jiraissuesmacro", helper.renderTimeout()); } } }