category.setRecCreateBy(adminBean.getUser().getUserId());
category.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
category.setRecCreateDatetime(new Date(System.currentTimeMillis()));
parent.getCategoryChildren().add(category);
CategoryLanguage categoryLanguage = new CategoryLanguage();
categoryLanguage.setCatShortTitle(catShortTitle);
categoryLanguage.setCatTitle("");
categoryLanguage.setCatDesc("");
categoryLanguage.setMetaKeywords("");
categoryLanguage.setMetaDescription("");
categoryLanguage.setCategory(category);
categoryLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
categoryLanguage.setRecCreateBy(adminBean.getUser().getUserId());
categoryLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
categoryLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
categoryLanguage.setSiteProfileClass(site.getSiteProfileClassDefault());
category.getCategoryLanguages().add(categoryLanguage);
category.setCategoryLanguage(categoryLanguage);
em.persist(categoryLanguage);
String fullCategoryPath = getFullCategoryPath(category, site.getSiteId(), form.getSiteProfileClassDefaultId());
category.setCatNaturalKey(Utility.encode(fullCategoryPath));
em.persist(category);
form.setCatId(Format.getLong(category.getCatId()));
form.setCategoryParentId(category.getCategoryParent().getCatId().toString());
form.setCatTitle("");
form.setMetaKeywords("");
form.setMetaDescription("");
form.setCatShortTitle(categoryLanguage.getCatShortTitle());
form.setCatDesc("");
form.setPublished(category.getPublished() == Constants.PUBLISHED_YES ? true : false);
form.setMode(Constants.MODE_UPDATE);
String jsonCategoryTree = Utility.makeJSONCategoryTree(site.getSiteId(), form.getSiteProfileClassId(), form.isSiteProfileClassDefault()).toHtmlString();
form.setJsonCategoryTree(jsonCategoryTree);