@PUT @Path("{applinkId}") public Response update(@PathParam("applinkId") String applinkId, ApplinkEntity entity) { try { MutableApplicationLink link = linkService.getApplicationLink(new ApplicationId(applinkId)); ApplicationLinkDetails.Builder builder = ApplicationLinkDetails.builder(link); if (entity.rpcUrl != null) { builder.rpcUrl(URI.create(entity.rpcUrl)); } if (entity.displayUrl != null) { builder.displayUrl(URI.create(entity.displayUrl)); } if (entity.name != null) { builder.name(entity.name); } // add more fields as necessary link.update(builder.build()); return Response.ok(new ApplinkEntity(link)).build(); } catch (TypeNotInstalledException e) { return Response.serverError() .entity("Failed to set applink system flag for '" + applinkId + "': " + e) .build(); } }
fisheyeInstance.getName(), fisheyeInstance.getUrl())) .isPrimary(false) //TODO: work out if this should be primary - an instance of 0 should be primary. However, if primary exists, this should not be primary .build(); ApplicationLink applicationLink; try {
.name(entity.name) .isPrimary(entity.primary) .build()); if (entity.urlOverride != null) { log.debug("Overriding display and RPC URL with " + entity.urlOverride); .rpcUrl(URI.create(entity.urlOverride)) .displayUrl(URI.create(entity.urlOverride)) .build(); ((MutableApplicationLink) link).update(newDetails);
.name(options.description) .isPrimary(true) .build() ); options.aid = aid;
@Override public void createAppLink(final ConnectAddonBean addon, final String baseUrl, final AuthenticationType authType, final String publicKey, final String addonUserKey) { transactionTemplate.execute((TransactionCallback<Void>) () -> { String pluginKey = addon.getKey(); URI baseUri = URI.create(baseUrl); final ApplicationId expectedApplicationId = ApplicationIdUtil.generate(baseUri); final RemotePluginContainerApplicationType applicationType = typeAccessor.getApplicationType(RemotePluginContainerApplicationType.class); deleteOldAppLinks(pluginKey, expectedApplicationId); final ApplicationLinkDetails details = ApplicationLinkDetails.builder() .displayUrl(baseUri) .isPrimary(false) .name(addon.getName() != null ? addon.getName() : addon.getKey()) .rpcUrl(baseUri) .build(); log.info("Creating an application link for Connect add-on with key '{}'", pluginKey); ApplicationLink link = applicationLinkService.addApplicationLink(expectedApplicationId, applicationType, details); link.putProperty(PLUGIN_KEY_PROPERTY, pluginKey); link.putProperty(JwtConstants.AppLinks.ADD_ON_USER_KEY_PROPERTY_NAME, addonUserKey); link.putProperty("IS_ACTIVITY_ITEM_PROVIDER", Boolean.FALSE.toString()); link.putProperty("system", Boolean.TRUE.toString()); link.putProperty(JwtConstants.AppLinks.AUTH_METHOD_PROPERTY_NAME, authType.toString()); if (authType == AuthenticationType.JWT) { link.putProperty(JwtConstants.AppLinks.SHARED_SECRET_PROPERTY_NAME, publicKey); } return null; }); }
public ApplicationLinkDetails getDetails() { return ApplicationLinkDetails .builder() .name(getName()) .displayUrl(getDisplayUrl()) .rpcUrl(getRpcUrl()) .isPrimary(isPrimary()) .build(); } }
@Nonnull public ApplicationLinkDetails toDetails() throws IllegalRestRepresentationStateException { return ApplicationLinkDetails.builder() .name(validateString(NAME, getName())) .rpcUrl(validateURI(RPC_URL, getRpcUrl())) .displayUrl(validateURI(DISPLAY_URL, getDisplayUrl())) .isPrimary(isPrimary()) .build(); }
@POST @Path("createStaticUrlAppLink") public javax.ws.rs.core.Response createStaticUrlAppLink(@QueryParam("typeId") final String typeId) throws Exception { final StaticUrlApplicationType type = (StaticUrlApplicationType) typeAccessor.loadApplicationType(typeId); Manifest manifest = manifestRetriever.getManifest(type.getStaticUrl(), type); ApplicationLinkDetails details = ApplicationLinkDetails.builder().name(type.getI18nKey()) .displayUrl(type.getStaticUrl()).rpcUrl(type.getStaticUrl()).isPrimary(true).build(); final ApplicationLink createdApplicationLink = applicationLinkService.addApplicationLink(manifest.getId(), type, details); return ok(new CreatedApplicationLinkEntity(toApplicationLinkEntity(createdApplicationLink), true)); }
public ApplicationLinkDetails getDetails() { return ApplicationLinkDetails .builder() .name(getName()) .displayUrl(getDisplayUrl()) .rpcUrl(getRpcUrl()) .isPrimary(isPrimary()) .build(); } }
private Response update(final MutableApplicationLink link, final URI rpcUrl, final URI displayUrl) { link.update(ApplicationLinkDetails .builder(link) .rpcUrl(rpcUrl) .displayUrl(displayUrl) .build()); LOG.info("Changed RPC URL from {} to {} and display URL from {} to {} for ApplicationLink {} .", link.getRpcUrl(), rpcUrl, link.getDisplayUrl(), displayUrl, link.getId()); return noContent(); // returning the updated applink might be more restful } }