throws Exception {
if (log.isDebugEnabled()) {
log.debug("entering 'onSubmit' method...");
}
DocumentType documentType = (DocumentType) command;
boolean isNew = (documentType.getDocumentTypeId() == null);
Locale locale = request.getLocale();
if (request.getParameter("delete") != null) {
documentTypeManager.removeDocumentType(documentType.getDocumentTypeId().toString());
saveMessage(request, getText("documentType.deleted", locale));
} else {
documentTypeManager.saveDocumentType(documentType);
String key = (isNew) ? "documentType.added" : "documentType.updated";
saveMessage(request, getText(key, locale));
if (!isNew) {
return new ModelAndView("redirect:editDocumentType.html", "documentTypeId", documentType.getDocumentTypeId());
}
}
return new ModelAndView(getSuccessView());
}