String commandEntryIdParam = req.getParameter("commandEntryId");
if (commandEntryIdParam == null){
throw new BugException("missing command entry id parameter");
}
long commandEntryId = Long.parseLong(commandEntryIdParam);
CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
if (commandEntry == null){ // command may have been deleted
throw new InputException(getResources(req).getMessage(locale,"smssvc.commandEntryNotAvailable"));
}
LOGGER.info("distributing edit action according to command entry type: " + commandEntry.getClass().getSimpleName());
req.setAttribute("commandEntryId",commandEntryId);
if (commandEntry instanceof SmsCommandEntry){
return mapping.findForward("editSmsTemplate");
} else if (commandEntry instanceof EmailCommandEntry){
return mapping.findForward("editEmailTemplate");
} else if (commandEntry instanceof UpcallCommandEntry) {
return mapping.findForward("editUpcallTemplate");
} else if (commandEntry instanceof HttpCommandEntry) {
return mapping.findForward("editHttpTemplate");
} else {
throw new BugException("unsupported command entry type for template: " + commandEntry.getClass().getName());
}
}