@Path("/bulk") @PUT public Response updateBulk( @Auth AuthModelT authModel, List<ModelT> models, @Context HttpServletRequest request) throws HttpCodeException { // TODO: implement transaction List<ModelT> updatedModels = Lists.newArrayList(); for (ModelT model : models) { updatedModels.add(man.update(getAuthContext(authModel), model)); } return res().success(res().modelData(updatedModels)); }
@Path("/{id}") @PUT public Response update( @Auth AuthModelT authModel, @PathParam("id") PrimaryKeyT id, ModelT model, @Context HttpServletRequest request) throws HttpCodeException { if (!id.equals(model.getId())) { throw new HttpInternalServerErrorException("Invalid Request: ID's do not match"); } ModelT updatedModel = man.update(getAuthContext(authModel), model); if (updatedModel == null) { throw new HttpInternalServerErrorException( "Could not update the " + modelClass.getSimpleName()); } return res().success(res().modelData(updatedModel)); }