return actionForward;
}
public void saveDefault(SiteDomainMaintActionForm form, SiteDomain siteDomain, Site site, User user, AdminBean adminBean, boolean insertMode) throws Exception {
EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
SiteDomainLanguage siteDomainLanguage = siteDomain.getSiteDomainLanguage();
SiteDomainParamBean siteDomainParamBean = null;
if (insertMode) {
siteDomainParamBean = new SiteDomainParamBean();
siteDomain.setRecCreateBy(user.getUserId());
siteDomain.setRecCreateDatetime(new Date(System.currentTimeMillis()));
siteDomain.setSite(site);
Template template = TemplateDAO.load(site.getSiteId(), Constants.TEMPLATE_BASIC);
siteDomain.setTemplate(template);
form.setTemplateId(template.getTemplateId().toString());
form.setModuleDisplaySize(String.valueOf(Constants.TEMPLATE_MODULE_DISPLAY_SIZE));
siteDomainParamBean.setModuleDisplaySize(String.valueOf(Constants.TEMPLATE_MODULE_DISPLAY_SIZE));
siteDomainLanguage = new SiteDomainLanguage();
siteDomainLanguage.setSiteLogoContentType("");
siteDomainLanguage.setRecCreateBy(user.getUserId());
siteDomainLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
siteDomain.setSiteDomainLanguage(siteDomainLanguage);
siteDomain.getSiteDomainLanguages().add(siteDomainLanguage);
siteDomain.setBaseCurrency(site.getSiteCurrencyClassDefault());
SiteProfileClass siteProfileClass = SiteProfileClassDAO.load(form.getSiteProfileClassId());
siteDomainLanguage.setSiteProfileClass(siteProfileClass);
}
else {
Template template = TemplateDAO.load(site.getSiteId(), Format.getLong(form.getTemplateId()));
siteDomain.setTemplate(template);
if (!Format.isNullOrEmpty(siteDomainLanguage.getSiteDomainParam())) {
siteDomainParamBean = (SiteDomainParamBean) Utility.joxUnMarshall(SiteDomainParamBean.class, siteDomainLanguage.getSiteDomainParam());
}
siteDomainParamBean.setMailFromContactUs(form.getMailFromContactUs());
siteDomainParamBean.setMailFromPwdReset(form.getMailFromPwdReset());
siteDomainParamBean.setSubjectNotification(form.getSubjectNotification());
siteDomainParamBean.setMailFromNotification(form.getMailFromNotification());
siteDomainParamBean.setSubjectPwdReset(form.getSubjectPwdReset());
siteDomainParamBean.setMailFromCustSales(form.getMailFromCustSales());
siteDomainParamBean.setSubjectCustSales(form.getSubjectCustSales());
siteDomainParamBean.setMailFromShippingQuote(form.getMailFromShippingQuote());
siteDomainParamBean.setSubjectShippingQuote(form.getSubjectShippingQuote());
siteDomainParamBean.setTemplateFooter(form.getTemplateFooter());
siteDomainParamBean.setCheckoutNotificationEmail(form.getCheckoutNotificationEmail());
siteDomainParamBean.setCheckoutShoppingCartMessage(form.getCheckoutShoppingCartMessage());
siteDomainParamBean.setCategoryPageSize(form.getCategoryPageSize());
siteDomainParamBean.setPaymentProcessType(form.getPaymentProcessType());
siteDomainParamBean.setBusinessContactName(form.getBusinessContactName());
siteDomainParamBean.setBusinessCompany(form.getBusinessCompany());
siteDomainParamBean.setBusinessAddress1(form.getBusinessAddress1());
siteDomainParamBean.setBusinessAddress2(form.getBusinessAddress2());
siteDomainParamBean.setBusinessCity(form.getBusinessCity());
siteDomainParamBean.setBusinessStateCode(form.getBusinessStateCode());
siteDomainParamBean.setBusinessCountryCode(form.getBusinessCountryCode());
siteDomainParamBean.setBusinessPostalCode(form.getBusinessPostalCode());
siteDomainParamBean.setBusinessPhone(form.getBusinessPhone());
siteDomainParamBean.setBusinessFax(form.getBusinessFax());
siteDomainParamBean.setBusinessEmail(form.getBusinessEmail());
siteDomainParamBean.setModuleDisplaySize(form.getModuleDisplaySize());
siteDomainParamBean.setCheckoutIncludeShippingPickup(String.valueOf(Constants.VALUE_NO));
siteDomainParamBean.setCheckoutAllowsShippingQuote(String.valueOf(Constants.VALUE_NO));
if (form.isCheckoutIncludePickup()) {
siteDomainParamBean.setCheckoutIncludeShippingPickup(String.valueOf(Constants.VALUE_YES));
}
if (form.isCheckoutAllowsShippingQuote()) {
siteDomainParamBean.setCheckoutAllowsShippingQuote(String.valueOf(Constants.VALUE_YES));
}
}
siteDomainLanguage.setSiteName(form.getSiteName());
siteDomainLanguage.setRecUpdateBy(user.getUserId());
siteDomainLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
siteDomain.setSiteDomainName(form.getSiteDomainName());
siteDomain.setSiteDomainPrefix(form.getSiteDomainPrefix());
siteDomain.setSitePublicPortNum(form.getSitePublicPortNum());
siteDomain.setSiteSslEnabled(form.isSiteSecureConnectionEnabled() ? Constants.VALUE_YES : Constants.VALUE_NO);
siteDomain.setSiteSecurePortNum(form.getSiteSecurePortNum());
if (form.getBaseSiteCurrencyClassId() != null) {
SiteCurrencyClass siteCurrencyClass = (SiteCurrencyClass) em.find(SiteCurrencyClass.class, Format.getLong(form.getBaseSiteCurrencyClassId()));
siteDomain.setBaseCurrency(siteCurrencyClass);
}
else {
siteDomain.setBaseCurrency(null);
}
siteDomain.setActive(form.isActive() ? Constants.ACTIVE_YES : Constants.ACTIVE_NO);
siteDomain.setRecUpdateBy(user.getUserId());
siteDomain.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
siteDomainLanguage.setSiteDomainParam(Utility.joxMarshall("SiteDomainParamBean", siteDomainParamBean));
if (insertMode) {
em.persist(siteDomainLanguage);
em.persist(siteDomain);
form.setSiteDomainId(siteDomain.getSiteDomainId().toString());
form.setSiteDomainLangId(siteDomainLanguage.getSiteDomainLangId().toString());
form.setDefaultSiteDomainLangId(siteDomainLanguage.getSiteDomainLangId().toString());
}
SiteProfileForm siteProfileForms[] = form.getSiteProfiles();
for (int i = 0; i < siteProfileForms.length; i++) {
SiteProfileForm siteProfileForm = siteProfileForms[i];
SiteProfile siteProfile = null;