* javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse)
*/
public ActionForward modify(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp) {
ImageRecognitionInteractionEnterOrEditForm f = (ImageRecognitionInteractionEnterOrEditForm)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 ImageRecognitionCommandEntry)){
throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore")); // may have been deleted
}
ImageRecognitionCommandEntry commentCommandEntry = (ImageRecognitionCommandEntry)commandEntry;
checkAccessRights(req, commentCommandEntry.getGroup());
commandEntryManager.evict(commentCommandEntry); // do not modify in this session yet (might be erroneous)
commentCommandEntry.setSortLabel(f.getSortLabel());
commentCommandEntry.setFolderSuffix(Integer.parseInt(f.getFolderSuffix()));
LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": comment entry #" + commandEntryId + " has been modified;");
setCommandEntryInRequest(req, commentCommandEntry);
return mapping.findForward("modified");
}