* org.apache.struts.action.ActionForm,
* javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse)
*/
public ActionForward modify(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp) {
SimpleInteractionEnterOrEditForm simpleInteractionForm = (SimpleInteractionEnterOrEditForm)form;
MessageResources resources = getResources(req);
if (simpleInteractionForm.getSortLabel() == null || simpleInteractionForm.getSortLabel().equals("")){
throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
}
long commandEntryId = simpleInteractionForm.getCommandEntryId();
CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
if (commandEntry == null || !(commandEntry instanceof SimpleCommandEntry)){
throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore")); // may have been deleted
}
SimpleCommandEntry simpleCommandEntry = (SimpleCommandEntry)commandEntry;
checkAccessRights(req, simpleCommandEntry.getGroup());
commandEntryManager.evict(simpleCommandEntry); // do not modify in this session yet (might be erroneous)
simpleCommandEntry.setSimpleCommandEntryType(simpleInteractionForm.getCommandTypeSelection());
simpleCommandEntry.setSortLabel(simpleInteractionForm.getSortLabel());
LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": simple command entry with id: " + commandEntryId + " has been modified");
setCommandEntryInRequest(req, simpleCommandEntry);
return mapping.findForward("modified");
}