Long siteProfileClassDefaultId = null;
SiteProfileClass siteProfileClassDefault = site.getSiteProfileClassDefault();
if (siteProfileClassDefault != null) {
siteProfileClassDefaultId = siteProfileClassDefault.getSiteProfileClassId();
form.setSiteProfileClassDefaultId(siteProfileClassDefaultId);
vector.add(new LabelValueBean(siteProfileClassDefault.getSiteProfileClassName(),
siteProfileClassDefault.getSiteProfileClassId().toString()));
}
String sql = "from SiteProfileClass siteProfileClass " +
"where siteProfileClass.site.siteId = :siteId " +
"order by siteProfileClassName ";
Query query = em.createQuery(sql);
query.setParameter("siteId", site.getSiteId());
Iterator<?> iterator = query.getResultList().iterator();
while (iterator.hasNext()) {
SiteProfileClass siteProfileClass = (SiteProfileClass) iterator.next();
if (siteProfileClassDefault != null) {
if (siteProfileClass.getSiteProfileClassId().equals(siteProfileClassDefaultId)) {
continue;
}
}
vector.add(new LabelValueBean(siteProfileClass.getSiteProfileClassName(),
siteProfileClass.getSiteProfileClassId().toString()));
}
LabelValueBean siteProfileClassBeans[] = new LabelValueBean[vector.size()];
vector.copyInto(siteProfileClassBeans);
form.setSiteProfileClassBeans(siteProfileClassBeans);
if (form.getSiteProfileClassId() != null) {
boolean found = false;
for (LabelValueBean bean : siteProfileClassBeans) {
if (bean.getValue().equals(form.getSiteProfileClassId().toString())) {
found = true;
break;
}
}
if (!found) {
form.setSiteProfileClassId(null);
}
}
if (form.getSiteProfileClassId() == null) {
if (siteProfileClassDefault != null) {
form.setSiteProfileClassId(siteProfileClassDefaultId);
}
form.setSiteProfileClassDefault(true);
}
else {
if (siteProfileClassDefault == null || form.getSiteProfileClassId().equals(siteProfileClassDefaultId)) {
form.setSiteProfileClassDefault(true);
}
else {
form.setSiteProfileClassDefault(false);
}
form.setTranslationEnable(false);
String fromLocale = "";
String toLocale = "";
fromLocale = siteProfileClassDefault.getLanguage().getGoogleTranslateLocale();
SiteProfileClass siteProfileClass = (SiteProfileClass) em.find(SiteProfileClass.class, form.getSiteProfileClassId());
toLocale = siteProfileClass.getLanguage().getGoogleTranslateLocale();
if (!Format.isNullOrEmpty(fromLocale) && !Format.isNullOrEmpty(toLocale) && !fromLocale.equals(toLocale)) {
form.setTranslationEnable(true);
form.setFromLocale(fromLocale);
form.setToLocale(toLocale);
}
}
vector = new Vector<LabelValueBean>();
Long siteCurrencyClassDefaultId = null;
SiteCurrencyClass siteCurrencyClassDefault = site.getSiteCurrencyClassDefault();
if (siteCurrencyClassDefault != null) {
siteCurrencyClassDefaultId = siteCurrencyClassDefault.getSiteCurrencyClassId();
form.setSiteCurrencyClassDefaultId(siteCurrencyClassDefaultId);
vector.add(new LabelValueBean(siteCurrencyClassDefault.getSiteCurrencyClassName(),
siteCurrencyClassDefault.getSiteCurrencyClassId().toString()));
}
sql = "from SiteCurrencyClass siteCurrencyClass " +
"where siteCurrencyClass.site.siteId = :siteId " +
"order by siteCurrencyClassName ";
query = em.createQuery(sql);
query.setParameter("siteId", site.getSiteId());
iterator = query.getResultList().iterator();
while (iterator.hasNext()) {
SiteCurrencyClass siteCurrencyClass = (SiteCurrencyClass) iterator.next();
if (siteProfileClassDefault != null) {
if (siteCurrencyClass.getSiteCurrencyClassId().equals(siteCurrencyClassDefaultId)) {
continue;
}
}
vector.add(new LabelValueBean(siteCurrencyClass.getSiteCurrencyClassName(),
siteCurrencyClass.getSiteCurrencyClassId().toString()));
}
LabelValueBean siteCurrencyClassBeans[] = new LabelValueBean[vector.size()];
vector.copyInto(siteCurrencyClassBeans);
form.setSiteCurrencyClassBeans(siteCurrencyClassBeans);
if (form.getSiteCurrencyClassId() == null) {
if (siteCurrencyClassDefault != null) {