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;
if (!Format.isNullOrEmpty(siteProfileForm.getSiteProfileId())) {
siteProfile = (SiteProfile) em.find(SiteProfile.class, Format.getLong(siteProfileForm.getSiteProfileId()));
}
else {
siteProfile = new SiteProfile();
siteProfile.setRecCreateBy(user.getUserId());
siteProfile.setRecCreateDatetime(new Date(System.currentTimeMillis()));
siteDomain.getSiteProfiles().add(siteProfile);
}
SiteProfileClass siteProfileClass = SiteProfileClassDAO.load(Format.getLong(siteProfileForm.getSiteProfileClassId()));
siteProfile.setSiteProfileClass(siteProfileClass);
siteProfile.setSeqNum(Format.getInt(siteProfileForm.getSeqNum()));
siteProfile.setActive(Constants.VALUE_YES);
if (!siteProfileForm.isActive()) {
siteProfile.setActive(Constants.VALUE_NO);
}
siteProfile.setRecUpdateBy(user.getUserId());
siteProfile.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
em.persist(siteProfile);
siteProfileForm.setSiteProfileId(Format.getLong(siteProfile.getSiteProfileId()));
}
SiteCurrencyForm siteCurrencyForms[] = form.getSiteCurrencies();
for (int i = 0; i < siteCurrencyForms.length; i++) {
SiteCurrencyForm siteCurrencyForm = siteCurrencyForms[i];
SiteCurrency siteCurrency = null;
if (!Format.isNullOrEmpty(siteCurrencyForm.getSiteCurrencyId())) {
siteCurrency = (SiteCurrency) em.find(SiteCurrency.class, Format.getLong(siteCurrencyForm.getSiteCurrencyId()));
}
else {
siteCurrency = new SiteCurrency();
siteCurrency.setRecCreateBy(user.getUserId());
siteCurrency.setRecCreateDatetime(new Date(System.currentTimeMillis()));
siteDomain.getSiteCurrencies().add(siteCurrency);
if (i == 0) {
siteDomain.setSiteCurrencyDefault(siteCurrency);
}
}
SiteCurrencyClass siteCurrencyClass = SiteCurrencyClassDAO.load(Format.getLong(siteCurrencyForm.getSiteCurrencyClassId()));
siteCurrency.setSiteCurrencyClass(siteCurrencyClass);
siteCurrency.setSeqNum(Format.getInt(siteCurrencyForm.getSeqNum()));
siteCurrency.setExchangeRate(Format.getFloat(siteCurrencyForm.getExchangeRate()));
siteCurrency.setActive(Constants.VALUE_YES);
if (!siteCurrencyForm.isActive()) {