/** * Removes the association of a trust bundle from a domain. * * @param bundleName The name of the trust bundle to remove from the domain. * @param domainName The name of the domain to remove from the trust bundle. * @return Status of 200 if the association was removed or a status of 404 if either a domain or * trust bundle with its given name does not exist. */ @DELETE @Path("{bundle}/{domain}") public Response disassociateTrustBundleFromDomain( @PathParam("bundle") String bundleName, @PathParam("domain") String domainName) { // make sure the bundle exists org.nhindirect.config.store.TrustBundle entityBundle; try { entityBundle = bundleDao.getTrustBundleByName(bundleName); if (entityBundle == null) return Response.status(Status.NOT_FOUND).cacheControl(noCache).build(); } catch (Exception e) { log.error("Error looking up bundle.", e); return Response.serverError().cacheControl(noCache).build(); } // make sure the domain exists org.nhindirect.config.store.Domain entityDomain; try { entityDomain = domainDao.getDomainByName(domainName); if (entityDomain == null) return Response.status(Status.NOT_FOUND).cacheControl(noCache).build(); } catch (Exception e) { log.error("Error looking up domain.", e); return Response.serverError().cacheControl(noCache).build(); } // now make the disassociation try { bundleDao.disassociateTrustBundleFromDomain(entityDomain.getId(), entityBundle.getId()); return Response.ok().cacheControl(noCache).build(); } catch (Exception e) { log.error("Error disassociating trust bundle from domain.", e); return Response.serverError().cacheControl(noCache).build(); } }