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 } }
@Override public ApplicationLinkState callWithContext() throws Exception { if (manifestRetriever.getApplicationStatus(applicationLink.getRpcUrl(), applicationLink.getType()) == ApplicationStatus.UNAVAILABLE) { return ApplicationLinkState.OFFLINE; } else { try { final Manifest manifest = manifestRetriever.getManifest(applicationLink.getRpcUrl(), applicationLink.getType()); if (!applicationLink.getId().equals(manifest.getId())) { if (manifest.getAppLinksVersion() != null && manifest.getAppLinksVersion().getMajor() >= 3) { return ApplicationLinkState.UPGRADED_TO_UAL; } else { return ApplicationLinkState.UPGRADED; } } } catch (ManifestNotFoundException e) { // unknown application type LOG.error("The {} application type failed to produce a " + "Manifest for Application Link {}, so we cannot " + "determine the link status.", TypeId.getTypeId( applicationLink.getType()).toString(), applicationLink.getId().toString()); } return ApplicationLinkState.OK; } } });
} else { String error; if (manifestRetriever.getApplicationStatus(applicationLink.getRpcUrl(), applicationLink.getType()) == ApplicationStatus.UNAVAILABLE) { error = i18nResolver.getText("applinks.legacy.upgrade.error.offline"); try { final Manifest manifest = manifestRetriever .getManifest(applicationLink.getRpcUrl(), applicationLink.getType()); if (!applicationLink.getId().equals(manifest.getId())) { if (manifest.getAppLinksVersion() != null && manifest.getAppLinksVersion().getMajor() >= 3) {
} else { String error; if (manifestRetriever.getApplicationStatus(applicationLink.getRpcUrl(), applicationLink.getType()) == ApplicationStatus.UNAVAILABLE) { error = i18nResolver.getText("applinks.legacy.upgrade.error.offline"); try { final Manifest manifest = manifestRetriever .getManifest(applicationLink.getRpcUrl(), applicationLink.getType()); if (!applicationLink.getId().equals(manifest.getId())) { if (manifest.getAppLinksVersion() != null && manifest.getAppLinksVersion().getMajor() >= 3) {
if (!existing.getRpcUrl().equals(linkDetails.getRpcUrl())) { return RestUtil.badRequest(i18nResolver.getText("applinks.error.cannot.update.rpcurl"));
try { if (!applicationLinkService.isAdminUserInRemoteApplication( oldApplicationLink.getRpcUrl(), upgradeApplicationLinkRequestEntity.getUsername(), upgradeApplicationLinkRequestEntity.getPassword())) {
if (!existing.getRpcUrl().equals(linkDetails.getRpcUrl()))
if (!existing.getRpcUrl().equals(linkDetails.getRpcUrl())) { return badRequest(i18nResolver.getText("applinks.error.cannot.update.rpcurl"));