@Nonnull public static String resolveApplicationTypeId(@Nonnull ApplicationType type) { return isIdentifiable(type) ? asIdentifiableType(type).getId().get() : type.getI18nKey(); }
@GET public Response getTypes() { List<BaseRestEntity> entityList = new ArrayList<BaseRestEntity>(); for (ApplicationType type : typeAccessor.getEnabledApplicationTypes()) { BaseRestEntity.Builder builder = new BaseRestEntity.Builder(); builder.add("name", type.getI18nKey()); builder.add("iconUrl", type.getIconUrl()); builder.add("iconUri", resolveIconUri(type)); entityList.add(builder.build()); } return ok(entityList).build(); }
@Nullable public static URI resolveIconUri(@Nonnull ApplicationType type) { checkNotNull(type, "type"); if (type instanceof IconizedType) { return ((IconizedType) type).getIconUri(); } else { return type.getIconUrl(); } }
@Nullable public static URI resolveIconUri(@Nonnull ApplicationType type) { checkNotNull(type, "type"); if (type instanceof IconizedType) { return ((IconizedType) type).getIconUri(); } else { return type.getIconUrl(); } }
@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"); } }
public ManifestEntity(final InternalHostApplication internalHostApp, final ApplicationProperties applicationProperties, final AppLinkPluginUtil pluginUtil) { this.name = internalHostApp.getName(); this.typeId = TypeId.getTypeId(internalHostApp.getType()); this.url = internalHostApp.getBaseUrl(); this.iconUrl = internalHostApp.getType().getIconUrl(); this.iconUri = IconUriResolver.resolveIconUri(internalHostApp.getType()); this.inboundAuthenticationTypes.addAll(EntityUtil.getClassNames(internalHostApp.getSupportedInboundAuthenticationTypes())); this.outboundAuthenticationTypes.addAll(EntityUtil.getClassNames(internalHostApp.getSupportedInboundAuthenticationTypes())); this.id = internalHostApp.getId(); this.applinksVersion = pluginUtil.getVersion(); this.version = applicationProperties.getVersion(); this.publicSignup = internalHostApp.hasPublicSignup(); try { this.buildNumber = Long.parseLong(applicationProperties.getBuildNumber()); } catch (NumberFormatException nfe) { this.buildNumber = 0L; LOG.warn("Cannot parse the application's build number {0}, using 0 instead.", applicationProperties.getBuildNumber()); } }
/** * Get a {@link Communicator} instance for the given {@link Site} and {@link ApplicationLink} given * * @param site the {@link Site} * @param applicationLink the {@link ApplicationLink} * @return teh {@link Communicator} instance */ private Communicator getByApplicationLink(Site site, ApplicationLink applicationLink) { checkNotNull(site, "site cannot be null"); checkNotNull(applicationLink, "applicationLink cannot be null"); LOGGER.debug("Getting a Communicator for ApplicationLink '" + applicationLink.getName() + "' of type " + applicationLink.getType ().getI18nKey()); if (applicationLink.getType() instanceof JenkinsApplicationType || applicationLink.getType() instanceof HudsonApplicationType) { return new RestCommunicator(hostApplication, site, applicationLink, authenticationConfigurationManager); } else { throw new IllegalArgumentException(applicationLink.getName() + " is not a Jenkins Application Link"); } }
public ManifestEntity(final InternalHostApplication internalHostApp, final ApplicationProperties applicationProperties, final AppLinkPluginUtil pluginUtil) { this.name = internalHostApp.getName(); this.typeId = TypeId.getTypeId(internalHostApp.getType()); this.url = internalHostApp.getBaseUrl(); this.iconUrl = internalHostApp.getType().getIconUrl(); this.iconUri = IconUriResolver.resolveIconUri(internalHostApp.getType()); this.inboundAuthenticationTypes.addAll(EntityUtil.getClassNames(internalHostApp.getSupportedInboundAuthenticationTypes())); this.outboundAuthenticationTypes.addAll(EntityUtil.getClassNames(internalHostApp.getSupportedInboundAuthenticationTypes())); this.id = internalHostApp.getId(); this.applinksVersion = pluginUtil.getVersion(); this.version = applicationProperties.getVersion(); this.publicSignup = internalHostApp.hasPublicSignup(); try { this.buildNumber = Long.parseLong(applicationProperties.getBuildNumber()); } catch (NumberFormatException nfe) { this.buildNumber = 0L; LOG.warn("Cannot parse the application's build number {0}, using 0 instead.", applicationProperties.getBuildNumber()); } }
public Map<String, String> apply(ApplicationLink from) { return ImmutableMap.of("id", from.getId().get(), "name", from.getName(), "type", i18nResolver.getText(from.getType().getI18nKey())); } })));
internalHostApplication.getName(), internalHostApplication.getBaseUrl(), internalHostApplication.getType().getIconUrl(), resolveIconUri(internalHostApplication.getType()), localRpcUrl,
if (selectedType != null && !selectedType.equals("") && !selectedType.equals(appLink.getType().getI18nKey())) { continue; String appName = appLink.getType().getI18nKey(); String authenticatedUser; try {
public ApplicationLinkEntity(final ApplicationLink applicationLink, final Link self) { this(applicationLink.getId(), TypeId.getTypeId(applicationLink.getType()), applicationLink.getName(), applicationLink.getDisplayUrl(), applicationLink.getType().getIconUrl(), resolveIconUri(applicationLink.getType()), applicationLink.getRpcUrl(), applicationLink.isPrimary(), applicationLink.isSystem(), self); }
protected RendererContextBuilder createContextBuilder(final ApplicationLink applicationLink) { final RendererContextBuilder builder = new RendererContextBuilder() .put("localApplicationName", internalHostApplication.getName()) .put("localApplicationType", i18nResolver.getText(internalHostApplication.getType().getI18nKey())) .put("remoteApplicationName", applicationLink.getName()) .put("remoteApplicationType", i18nResolver.getText(applicationLink.getType().getI18nKey())); return builder; }
public ApplicationLinkEntity(final ApplicationId id, final TypeId typeId, final String name, final URI displayUrl, final URI iconUrl, final URI iconUri, final URI rpcUrl, final Boolean primary, final Boolean isSystem, final Link self) { this.id = id; this.typeId = typeId; this.name = name; this.displayUrl = displayUrl; this.iconUrl = iconUrl; this.iconUri = iconUri; this.isPrimary = primary; this.isSystem = isSystem; this.iconUri = iconUri; if (!isSystem()) { this.rpcUrl = rpcUrl; } addLink(self); }
private void render( final ApplicationLink appLink, final HttpServletRequest request, final HttpServletResponse response) throws IOException { final boolean enabled = configurationManager.isConfigured(appLink.getId(), TrustedAppsAuthenticationProvider.class); final String consumer = internalHostApplication.getName(); final String consumerAppType = i18nResolver.getText(internalHostApplication.getType().getI18nKey()); final String provider = appLink.getName(); final String providerAppType = i18nResolver.getText(appLink.getType().getI18nKey()); render(request, response, consumer, consumerAppType, provider, providerAppType, enabled, emptyContext()); } }
internalHostApplication.getName(), internalHostApplication.getBaseUrl(), internalHostApplication.getType().getIconUrl(), IconUriResolver.resolveIconUri(internalHostApplication.getType()), localRpcUrl,
protected RendererContextBuilder createContextBuilder(final ApplicationLink applicationLink) { return new RendererContextBuilder() .put("localApplicationName", internalHostApplication.getName()) .put("localApplicationType", i18nResolver.getText(internalHostApplication.getType().getI18nKey())) .put("remoteApplicationName", applicationLink.getName()) .put("remoteApplicationType", i18nResolver.getText(applicationLink.getType().getI18nKey())); }
public static RendererContextBuilder createContextBuilder(final ApplicationLink applicationLink, final I18nResolver i18nResolver, final InternalHostApplication internalHostApplication) { final RendererContextBuilder builder = new RendererContextBuilder() .put("localApplicationName", internalHostApplication.getName()) .put("localApplicationType", i18nResolver.getText(internalHostApplication.getType().getI18nKey())) .put("remoteApplicationName", applicationLink.getName()) .put("remoteApplicationType", i18nResolver.getText(applicationLink.getType().getI18nKey())); return builder; }
public static RendererContextBuilder createContextBuilder(final ApplicationLink applicationLink, final I18nResolver i18nResolver, final InternalHostApplication internalHostApplication) { final RendererContextBuilder builder = new RendererContextBuilder() .put("localApplicationName", internalHostApplication.getName()) .put("localApplicationType", i18nResolver.getText(internalHostApplication.getType().getI18nKey())) .put("remoteApplicationName", applicationLink.getName()) .put("remoteApplicationType", i18nResolver.getText(applicationLink.getType().getI18nKey())); return builder; }
private BaseRestEntity getAllTypes() { BaseRestEntity.Builder allTypes = new BaseRestEntity.Builder(); for (final ApplicationType applicationType : typeAccessor.getEnabledApplicationTypes()) { allTypes.add(resolveApplicationTypeId(applicationType), i18nResolver.getText(applicationType.getI18nKey())); } return allTypes.build(); } }