}
}
private void saveLanguage(CustomAttribute customAttribute, CustomAttributeMaintActionForm form, AdminBean adminBean) throws Exception {
EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
CustomAttributeLanguage customAttribLanguage = null;
User user = adminBean.getUser();
Long siteProfileClassId = form.getSiteProfileClassId();
boolean found = false;
Iterator<?> iterator = customAttribute.getCustomAttributeLanguages().iterator();
while (iterator.hasNext()) {
customAttribLanguage = (CustomAttributeLanguage) iterator.next();
if (customAttribLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
found = true;
break;
}
}
if (!found) {
customAttribLanguage = new CustomAttributeLanguage();
customAttribLanguage.setRecCreateBy(user.getUserId());
customAttribLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
SiteProfileClass siteProfileClass = (SiteProfileClass) em.find(SiteProfileClass.class, siteProfileClassId);
customAttribLanguage.setSiteProfileClass(siteProfileClass);
customAttribLanguage.setCustomAttribute(customAttribute);
customAttribute.getCustomAttributeLanguages().add(customAttribLanguage);
}
if (form.isCustomAttribDescLangFlag()) {
customAttribLanguage.setCustomAttribDesc(form.getCustomAttribDescLang());
}
else {
customAttribLanguage.setCustomAttribDesc(null);
}
customAttribLanguage.setRecUpdateBy(user.getUserId());
customAttribLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
em.persist(customAttribLanguage);
for (int i = 0; i < form.getCustomAttribOptions().length; i++) {
CustomAttributeOptionDisplayForm optionForm = form.getCustomAttribOptions()[i];
CustomAttributeOption customAttributeOption = null;