throws Throwable {
SiteDomainMaintActionForm form = (SiteDomainMaintActionForm) actionForm;
AdminBean adminBean = getAdminBean(request);
User user = adminBean.getUser();
Site site = SiteDAO.load(form.getSiteId());
boolean insertMode = false;
if (form.getMode().equals("C")) {
insertMode = true;
}
initSiteProfiles(form, site);
SiteDomain siteDomain = null;
if (!insertMode) {
siteDomain = SiteDomainDAO.load(Format.getLong(form.getSiteDomainId()));
}
else {
siteDomain = new SiteDomain();
}
ActionMessages errors = validate(request, form, site, insertMode);
if (errors.size() != 0) {
saveMessages(request, errors);
initListInfo(form);
return mapping.findForward("error");
}
if (insertMode || form.isSiteProfileClassDefault()) {
saveDefault(form, siteDomain, site, user, adminBean, insertMode);
}
else {
saveLanguage(form, siteDomain, site, user);
}
// In case siteProfileName is updated
initSiteProfiles(form, site);
form.setSingleCheckout(false);
if (site.getSingleCheckout() == Constants.VALUE_YES) {
form.setSingleCheckout(true);
}
adminBean.init(adminBean.getUser().getUserId(), adminBean.getSite().getSiteId());
initListInfo(form);
form.setMode("U");
FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
CacheDAO.removeByKeyPrefix(site.getSiteId(), Constants.CACHE_MENU);
return mapping.findForward("success");
}