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 SimpleCommandEntry){
return mapping.findForward("editSimpleInteraction");
} else if (commandEntry instanceof SmsCommandEntry){
return mapping.findForward("editSmsInteraction");
} else if (commandEntry instanceof EmailCommandEntry){
return mapping.findForward("editEmailInteraction");
} else if (commandEntry instanceof UserSetCommandEntry){
return mapping.findForward("editUserSetInteraction");
} else if (commandEntry instanceof AccessCheckCommandEntry){
return mapping.findForward("editAccessCheckInteraction");
} else if (commandEntry instanceof FragmentCommandEntry){
return mapping.findForward("editFragmentInteraction");
} else if (commandEntry instanceof IterateCommandEntry){
return mapping.findForward("editIterateInteraction");
} else if (commandEntry instanceof InteractionLogCommandEntry){
return mapping.findForward("editInteractionLogInteraction");
} else if (commandEntry instanceof BreakCommandEntry){
return mapping.findForward("editBreakInteraction");
} else if (commandEntry instanceof ContentParseCommandEntry){
return mapping.findForward("editContentParserInteraction");
} else if (commandEntry instanceof Send2DCodeCommandEntry) {
return mapping.findForward("editSend2DCodeInteraction");
} else if(commandEntry instanceof UpcallCommandEntry){
return mapping.findForward("editUpcallInteraction");
} else if(commandEntry instanceof BlogCommandEntry){
return mapping.findForward("editBlogInteraction");
} else if(commandEntry instanceof HttpCommandEntry){
return mapping.findForward("editHttpInteraction");
} else if(commandEntry instanceof CommentCommandEntry){
return mapping.findForward("editCommentInteraction");
} else if(commandEntry instanceof ImageRecognitionCommandEntry){
return mapping.findForward("editImageRecognitionInteraction");
} else {
throw new BugException("unknown command entry type: " + commandEntry.getClass().getName());
}
}