throws Exception {
if (log.isDebugEnabled()) {
log.debug("entering 'onSubmit' method...");
}
DefectZone defectZone = (DefectZone) command;
boolean isNew = (defectZone.getDefectZoneId() == null);
Locale locale = request.getLocale();
if (request.getParameter("delete") != null) {
defectZoneManager.removeDefectZone(defectZone.getDefectZoneId().toString());
saveMessage(request, getText("defectZone.deleted", locale));
} else {
List defectZoneAutentifications = new ArrayList();
List defectZoneAutentificationsFromForm = defectZone.getAuthentificationElements();
for (int i = 0; i < defectZoneAutentificationsFromForm.size(); i++) {
AuthentificationElement authentificationElement = (AuthentificationElement) defectZoneAutentificationsFromForm.get(i);
defectZoneAutentifications.add(authentificationElementManager.getAuthentificationElement(authentificationElement.getAuthentificationId().toString()));
}
defectZone.setAuthentificationElements(defectZoneAutentifications);
defectZoneManager.saveDefectZone(defectZone);
String key = (isNew) ? "defectZone.added" : "defectZone.updated";
saveMessage(request, getText(key, locale));
if (defectZone.isEdited()) {
return new ModelAndView("redirect:updating.html?id=" + defectZone.getDefectZoneId() + "&fieldId=" + request.getParameter("fieldId"));
}
}
return new ModelAndView("redirect:" + defectZone.getDocLocation());
}