Skip to content

Instantly share code, notes, and snippets.

@stickfigure
Created April 18, 2012 17:29
Show Gist options
  • Save stickfigure/2415278 to your computer and use it in GitHub Desktop.
Save stickfigure/2415278 to your computer and use it in GitHub Desktop.
Saving the description of an event
/**
* Edit the description of an event.
*/
@AuthRequired
@POST
@Path("/event/description")
@Produces(MediaTypeUTF8.APPLICATION_JSON)
@JsonView(Event.JsonAll.class)
public Event saveDescription(final @FormParam("event") Key<Event> eventKey, final @FormParam("editor") String description) {
ofy.transact(new VoidWork() {
@Override
public void vrun(Ofy ofy) {
Event event = ofy.load().eventAsAdmin(eventKey, me);
event.setDescription(StringUtils.trimToNull(description));
ofy.save(event);
}
});
return loadEventForEdit(eventKey);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment