}
AdminBean adminBean = getAdminBean(request);
Site site = adminBean.getSite();
initSiteProfiles(form, site);
CustomAttributeGroup customAttributeGroup = new CustomAttributeGroup();
if (!insertMode) {
customAttributeGroup = CustomAttributeGroupDAO.load(site.getSiteId(), Format.getLong(form.getCustomAttribGroupId()));
}
ActionMessages errors = validate(form, site.getSiteId());
if (errors.size() != 0) {
saveMessages(request, errors);
return mapping.findForward("error");
}
if (insertMode) {
customAttributeGroup.setRecCreateBy(adminBean.getUser().getUserId());
customAttributeGroup.setRecCreateDatetime(new Date(System.currentTimeMillis()));
}
customAttributeGroup.setCustomAttribGroupName(form.getCustomAttribGroupName());
customAttributeGroup.setSite(site);
customAttributeGroup.setRecUpdateBy(adminBean.getUser().getUserId());
customAttributeGroup.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
if (insertMode) {
em.persist(customAttributeGroup);
}
else {
// em.update(customAttributeGroup);
}
form.setMode("U");
form.setCustomAttribGroupId(customAttributeGroup.getCustomAttribGroupId().toString());
FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
return mapping.findForward("success");
}