* javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse)
*/
public ActionForward modify(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp) {
CommentInteractionEnterOrEditForm f = (CommentInteractionEnterOrEditForm)form;
MessageResources resources = getResources(req);
if (f.getSortLabel() == null || f.getSortLabel().equals("")){
throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
}
long commandEntryId = f.getCommandEntryId();
CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
if (commandEntry == null || !(commandEntry instanceof CommentCommandEntry)){
throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore")); // may have been deleted
}
CommentCommandEntry commentCommandEntry = (CommentCommandEntry)commandEntry;
checkAccessRights(req, commentCommandEntry.getGroup());
commandEntryManager.evict(commentCommandEntry); // do not modify in this session yet (might be erroneous)
commentCommandEntry.setSortLabel(f.getSortLabel());
commentCommandEntry.setDescription(f.getComment().length() == 0?null:f.getComment());
LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": comment entry #" + commandEntryId + " has been modified to comment value: " + commentCommandEntry.getDescription());
setCommandEntryInRequest(req, commentCommandEntry);
return mapping.findForward("modified");
}