/** * @since 3.1 */ public URI getDisplayUrl(final ApplicationLink link, final String path) { Assertions.isTrue(String.format("Application link %s is not of type %s", link.getId(), getApplicationType().getName()), link.getType() instanceof SubversionPathEntityType); return URIUtil.uncheckedConcatenate(link.getDisplayUrl(), path); } }
public ImmutableApplicationLink(final ApplicationLink that, final ApplicationLinkRequestFactoryFactory requestFactoryFactory) { checkNotNull(that, "that"); checkNotNull(requestFactoryFactory, "requestFactoryFactory"); this.applicationId = that.getId(); this.applicationType = that.getType(); this.name = that.getName(); this.displayUrl = that.getDisplayUrl(); this.rpcUrl = that.getRpcUrl(); this.isPrimary = that.isPrimary(); this.isSystem = that.isSystem(); this.requestFactoryFactory = requestFactoryFactory; }
/** * Getter for the {@link com.atlassian.applinks.api.ApplicationLinkRequestFactory} * * @return the {@link com.atlassian.applinks.api.ApplicationLinkRequestFactory} */ private ApplicationLinkRequestFactory getAuthenticatedRequestFactory() { return applicationLink.createAuthenticatedRequestFactory(); }
public SourceErrorReport(final ApplicationLink applicationLink, final String errorMessage) { this.url = applicationLink.getDisplayUrl().toASCIIString(); this.name = applicationLink.getName(); this.repositoryName = null; this.errorMessage = errorMessage; }
public ApplinkEntity(ApplicationLink link) { this.id = link.getId().get(); this.name = link.getName(); this.displayUrl = link.getDisplayUrl().toASCIIString(); this.rpcUrl = link.getRpcUrl().toASCIIString(); this.applicationType = resolveAppType(link); this.typeId = this.applicationType; this.type = this.applicationType; } }
/** * Creates a new {@link com.atlassian.applinks.spi.link.ApplicationLinkDetails.Builder} * initialized with the state from the supplied * {@link com.atlassian.applinks.api.ApplicationLink} instance. */ public static Builder builder(final ApplicationLink applicationLink) { final Builder builder = new Builder(); builder.displayUrl = applicationLink.getDisplayUrl(); builder.rpcUrl = applicationLink.getRpcUrl(); builder.name = applicationLink.getName(); builder.isPrimary = applicationLink.isPrimary(); return builder; }
private String rebaseLinks(String jiraResponse, ApplicationLink appLink) { // CONF-22283: Display URL is not used when inserting jira issue return jiraResponse.replace(appLink.getRpcUrl().toString(), appLink.getDisplayUrl().toString()); }
public ConfluenceApplicationLinksBean(final Iterable<ApplicationLink> appLinks) { applicationLinks = new ArrayList<ConfluenceApplicationLinkBean>(); for (final ApplicationLink appLink : appLinks) { applicationLinks.add(new ConfluenceApplicationLinkBean(appLink.getId().get(), appLink.getName())); } }
OAuthAuthenticateResponse(ApplicationLink appLink, String authUri) { this.authUri = authUri; this.id = appLink.getId().get(); this.name = appLink.getName(); this.uri = appLink.getDisplayUrl().toString(); }
@Override public Communicator get(ApplicationLink applicationLink) { checkNotNull(applicationLink); LOGGER.debug("Getting a Communicator for ApplicationLink '" + applicationLink.getName() + "' of type " + applicationLink.getType().getI18nKey()); if (applicationLink.getType() instanceof SonarQubeApplicationType) { return new DefaultCommunicator(authenticationConfigurationManager, applicationLink); } else { throw new IllegalArgumentException(applicationLink.getName() + " is not a SonarQube Application Link"); } }
private Object getAtlassianConfigUrl(ApplicationLink applink) { // backwards compatibility with the older Applinks version, where theconfig screen was only exposed as a // Confluence action; // also see ConfluenceLegacyApplicationLinksUrlFilter if (applink.getType() instanceof ConfluenceApplicationType) { return Uris.uncheckedConcatenate(applink.getDisplayUrl(), "/admin/listapplicationlinks.action"); } else { return Uris.uncheckedConcatenate(applink.getDisplayUrl(), "/plugins/servlet/applinks/listApplicationLinks"); } } }
public String getBaseUrlForKey(String projectKey) { ApplicationLink appLink = getAppForKey(projectKey); if (appLink != null) { return appLink.getRpcUrl().toString(); } return null; }
public URI getDisplayUrl(final ApplicationLink link, final String entity) { Assertions.isTrue(String.format("Application link %s is not of type %s", link.getId(), getApplicationType().getName()), link.getType() instanceof GenericApplicationTypeImpl); // we don't know what kind of app the peer is, so we can't point to anything return null; } }
@Nonnull private RemoteApplicationCapabilities updateAndGet(@Nonnull ApplicationLink applink, @Nullable CachedCapabilities currentCapabilities) { try { Manifest manifest = manifestDownloader.downloadNoEvent(applink.getRpcUrl()); return updateAndGet(applink, manifest, currentCapabilities); } catch (ManifestNotFoundException e) { ApplinkError error = toApplinkError(e, "Failed to download manifest"); return updateAndGet(applink.getId(), currentCapabilities, withError(currentCapabilities, error)); } }
private <T> void putPropertyInto(ApplicationLink applicationLink, com.atlassian.jirafisheyeplugin.upgrade.legacy.domain.fisheye.FishEyeInstance fishEyeInstance, MigrationInstanceProperty<T> property) { final T value = property.getProperty(fishEyeProperties, fishEyeInstance); //if the applicationlink already contains a value for the given property key, then don't overwrite it with the old value //this is so that migration of properties can be executed multiple times, with no ill effects. if (applicationLink.getProperty(property.getMigratedKey()) == null) { log.info(String.format("migrating fisheye property [%s] with value [%s] from instance [%s] to applicationlink [%s] with new key [%s]", property.getKey(), value, fishEyeInstance, applicationLink, property.getMigratedKey())); applicationLink.putProperty(property.getMigratedKey(), value == null ? null : value.toString()); } else { log.info(String.format("property %s already exist on applicationlink %s with value %s", property.getMigratedKey(), applicationLink.getId(), applicationLink.getProperty(property.getMigratedKey()))); } } }
private String getProperty(String propertyName) { Object property = applicationLink.getProperty(propertyName); return (property instanceof String) ? (String) property : null; } }
private String getOAuthConfigRemoteURL(final ApplicationLink applicationLink, final String uiPosition, final HttpServletRequest request) { try { final Manifest manifest = manifestRetriever.getManifest(applicationLink.getRpcUrl(), applicationLink.getType()); if (manifest.getAppLinksVersion() != null) { final URI remoteDisplayUrl = getRemoteDisplayUrl(applicationLink, request); final String encodedCallbackUrl = URIUtil.utf8Encode(getCallbackUrl(applicationLink, uiPosition, request)); return AddConsumerReciprocalServlet.getReciprocalServletUrl(remoteDisplayUrl, internalHostApplication.getId(), encodedCallbackUrl, ENABLE_DISABLE_OAUTH_PARAM); } } catch (Exception e) { LOG.warn("An Error occurred when building the URL to the '" + AddConsumerReciprocalServlet.class + "' servlet of the remote application.", e); } return null; }
private void createProjectLink(final String key, final String applicationType, final ApplicationLink applicationLink, final boolean deleteExisting) { final Application app = Application.fromString(applicationType); final KeyAssociations associations = appLinksManager.getKeyAssociations(app, key); if (deleteExisting) { associations.removeAll(); } associations.setPrimary(applicationLink.getName(), applicationLink.getRemoteKey()); }