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; }
public Response toResponse(final TypeNotInstalledException e) { return badRequest(i18nResolver.getText("applinks.type.not.installed", e.getType())); } }
@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); } } }
private NoSuchApplinkException typeNotInstalled(TypeNotInstalledException e) throws NoSuchApplinkException { return serviceExceptionFactory.raise(NoSuchApplinkException.class, I18nKey.newI18nKey("applinks.service.error.nosuchentity.apptype", e.getName(), e.getType()), e); } }
@Override public void addOrphanedTrustToApplicationLink(final String id, final OrphanedTrustCertificate.Type type, final ApplicationId applicationId) { checkCertificateType(type); final ApplicationLink applicationLink; try { applicationLink = applicationLinkService.getApplicationLink(applicationId); if (applicationLink == null) { throw new RuntimeException("No Application Link with id '" + applicationId + "' found."); } } catch (TypeNotInstalledException e) { throw new IllegalStateException("An application of the type " + e.getType() + " is not installed!", e); } if (type == OrphanedTrustCertificate.Type.OAUTH) { registerOAuthConsumer(id, applicationLink); } else if (type == OrphanedTrustCertificate.Type.OAUTH_SERVICE_PROVIDER) { registerOAuthServiceProvider(id, applicationLink); } }
entityCount = Lists.newArrayList(entityLinkService.getEntityLinksForApplicationLink(applicationLink)).size(); } catch (TypeNotInstalledException e) { return notFound(i18nResolver.getText("applinks.type.not.installed", e.getType()));
logger.warn(String.format("Unable to load ApplicationLink %s due to uninstalled type definition (%s).", id.toString(), e.getType()), e);
logger.warn(String.format("Unable to load ApplicationLink %s due to uninstalled type definition (%s).", id.toString(), e.getType()), e);
logger.warn(String.format("Unable to load ApplicationLink %s due to uninstalled type definition (%s).", id.toString(), e.getType()), e);
logger.warn(String.format("Unable to load ApplicationLink %s due to uninstalled type definition (%s).", id.toString(), e.getType()), e);
public URI createSelfLinkFor(final ApplicationId id) { try { URI baseUri; HttpContext context = CurrentContext.getContext(); if (context != null) { baseUri = context.getUriInfo().getBaseUri(); } else { baseUri = internalHostApplication.getBaseUrl(); } final ApplicationLinkResource applicationLinkResource = restUrlBuilder.getUrlFor( baseUri, ApplicationLinkResource.class); final String idString = id.get(); final javax.ws.rs.core.Response applicationLink = applicationLinkResource.getApplicationLink(idString); return restUrlBuilder.getURI(applicationLink); } catch (TypeNotInstalledException e) { // this should _never_ happen, as com.atlassian.plugins.rest.common.util.RestUrlBuilder.getUrlFor() is just returning a proxy stub throw new IllegalStateException(String.format("Failed to load application %s as the %s type is not installed", id.get(), e.getType())); } }
} catch (TypeNotInstalledException e) { LOG.warn(String.format("Couldn't load application link with id %s, type %s is not installed. " + "All child entity links will be inaccessible.", applicationId, e.getType())); continue;
} catch (TypeNotInstalledException e) { throw new IllegalStateException(String.format("Failed to load application %s as the %s type is not installed", applicationId, e.getType()));
applicationId, e.getType()));
LOG.error("Failed to get application link", e); addErrorToContext(context, ERROR_TYPE_NOT_LOADED, applicationLinkId, e.getType()); addCheckConfigAdminErrorToContext(context); render(context, resp);
LOG.error("TypeNotInstalledException thrown", e); sendFailureEvent(FAILURE_REASON.TYPE_NOT_INSTALLED); return badRequest(String.format(i18nResolver.getText("applinks.error.remote.type.not.installed", e.getType())));
private Response listEntities(final String applicationId, final boolean useAnonymousAccess) { final ApplicationLink link; try { link = applicationLinkService.getApplicationLink(new ApplicationId(applicationId)); } catch (TypeNotInstalledException e) { return badRequest(String.format("Failed to load application %s as the %s type is not installed", applicationId, e.getType())); } Response response; if (link == null) { response = notFound("No application link found with id: " + applicationId); } else { try { if (useAnonymousAccess) { response = ok(new ReferenceEntityList(entityRetriever.getEntitiesForAnonymousAccess(link))); } else { response = ok(new ReferenceEntityList(entityRetriever.getEntities(link))); } } catch (CredentialsRequiredException e) { response = credentialsRequired(i18nResolver); } catch (ResponseException e) { response = serverError(e.toString()); } } return response; }
applicationLink = applicationLinkService.getApplicationLink(entity.getApplicationId()); } catch (TypeNotInstalledException e) { return applicationTypeNotInstalled(entity.getApplicationId(), e.getType());