AdminBean adminBean = getAdminBean(request);
Site site = adminBean.getSite();
initSiteProfiles(form, site);
SiteDomain siteDomain = SiteDomainDAO.load(Format.getLong(form.getSiteDomainId()));
HomePage homePage = siteDomain.getHomePage();
if (homePage == null) {
homePage = new HomePage();
homePage.setRecUpdateBy(adminBean.getUser().getUserId());
homePage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
homePage.setRecCreateBy(adminBean.getUser().getUserId());
homePage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
siteDomain.setHomePage(homePage);
em.persist(homePage);
HomePageLanguage homePageLanguage = new HomePageLanguage();
homePageLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
homePageLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
homePageLanguage.setRecCreateBy(adminBean.getUser().getUserId());
homePageLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
homePage.setHomePageLanguage(homePageLanguage);
homePage.getHomePageLanguages().add(homePageLanguage);
em.persist(homePageLanguage);
}
form.setHomePageId(Format.getLong(homePage.getHomePageId()));
form.setPageTitle(homePage.getHomePageLanguage().getHomePageTitle());
form.setMetaKeywords(homePage.getHomePageLanguage().getMetaKeywords());
form.setMetaDescription(homePage.getHomePageLanguage().getMetaDescription());
initListInfo(form, homePage);
ActionForward actionForward = actionMapping.findForward("success");
return actionForward;
}