@PUT
@Produces(MediaType.APPLICATION_JSON)
@Path("/{content_id}")
public Content updateContent(@PathParam("content_id") String contentId,
Content changes) {
Content lookedUp = contentCurator.find(contentId);
if (lookedUp == null) {
throw new NotFoundException(
i18n.tr("Content with id {0} could not be found.", contentId));
}
// FIXME: needs arches handled as well?
changes.setId(contentId);
Content updated = contentCurator.createOrUpdate(changes);
// require regeneration of entitlement certificates of affected consumers
Set<String> affectedProducts =
productAdapter.getProductsWithContent(setFrom(contentId));
for (String productId : affectedProducts) {
poolManager.regenerateCertificatesOf(productId, true);