private void initPages() { List<PageEntity> roots = getDao().getPageDao().getByParent(""); if (roots.size() == 0) { TemplateEntity template = getDao().getTemplateDao().getByUrl("simple"); addPage("Home page", "/", HOME_PAGE_FILE, template.getId(), 0, true, true); getBusiness() .getContentPermissionBusiness() .setPermission("/", guests, ContentPermissionType.READ); addPage("Site user Login", "/login", LOGIN_PAGE_FILE, template.getId(), 0, true, false); addPage("Search", "/search", SEARCH_PAGE_FILE, template.getId(), 1, false, false); } }
@Override public List<String> validateBeforeUpdate(final TemplateEntity template) { List<String> errors = new ArrayList<String>(); if (template.getId() == null) { TemplateEntity myTemplate = getDao().getTemplateDao().getByUrl(template.getUrl()); if (myTemplate != null) { errors.add(Messages.get("template.already_exists")); } } if (StringUtil.isEmpty(template.getUrl())) { errors.add(Messages.get("url_is_empty")); } if (StringUtil.isEmpty(template.getTitle())) { errors.add(Messages.get("title_is_empty")); } if (StringUtil.isEmpty(template.getContent())) { errors.add(Messages.get("content_is_empty")); } return errors; }