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