public String tree() throws SQLException, SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { treeValue = new ArrayList<AsyncTree>(); if (!Util.notEmptyString(id)) { DetachedCriteria dc = DetachedCriteria.forClass(Bean.class); List<Bean> bl = baseDao.find(dc); List<String> sl = new ArrayList<String>(); for (Bean b : bl) { if (!sl.contains(b.getPkg())) { sl.add(b.getPkg()); } } for (String s : sl) { AsyncTree at = new AsyncTree(); at.setId("pkg:" + s); at.setText(s); at.setState("closed"); treeValue.add(at); } } else if (id.startsWith("pkg:")) { DetachedCriteria dc = DetachedCriteria.forClass(Bean.class); dc.add(Restrictions.eq("pkg", id.replace("pkg:", ""))); List<Bean> bl = baseDao.find(dc); for (Bean b : bl) { AsyncTree at = new AsyncTree(); at.setId("bean:" + String.valueOf(b.getId())); at.setText(b.getBean() + ":" + b.getDescr()); at.setState("closed"); treeValue.add(at); } } else if (id.startsWith("bean:")) { DetachedCriteria dc = DetachedCriteria.forClass(Property.class); String beanId = id.replace("bean:", ""); Bean b = baseDao.get(Bean.class, Integer.valueOf(beanId)); dc.add(Restrictions.eq("bean", b)); List<Property> bl = baseDao.find(dc); for (Property bx : bl) { AsyncTree at = new AsyncTree(); at.setId(String.valueOf(bx.getId())); at.setText(bx.getProperty() + ":" + bx.getDescr()); at.setState("open"); treeValue.add(at); } } return SUCCESS; }