@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(); } }
@PUT @Path("{applinkid}") public Response update(@PathParam("applinkid") String applinkId, RestApplicationLink restApplink) throws ServiceException { permissionValidationService.validateAdmin(); ApplicationId id = restApplicationIdParser.parse(applinkId); ApplicationLinkDetails details = restApplink.toDetails(); applinkValidationService.validateUpdate(id, details); if (details.isPrimary()) { applinkHelper.makePrimary(id); } MutableApplicationLink applink = applinkHelper.getMutableApplicationLink(id); applink.update(details); return Response.ok(new RestApplicationLink(applink)).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 } }
.displayUrl(URI.create(entity.urlOverride)) .build(); ((MutableApplicationLink) link).update(newDetails);
existing.update(linkDetails); return RestUtil.updated(createSelfLinkFor(applicationLink.getId()));
existing.update(linkDetails); return updated(createSelfLinkFor(applicationLink.getId()));
existing.update(linkDetails); return updated(createSelfLinkFor(applicationLink.getId()));