Created
April 18, 2012 17:29
-
-
Save stickfigure/2415278 to your computer and use it in GitHub Desktop.
Saving the description of an event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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