private Collection<Classification> getChildren( Classification nodo, Collection<Classification> lista) { for (Classification classif : lista) { if (nodo.getClassificationCod() != null && classif.getClassificationCod() != null && nodo.getClassificationCod().equals(classif.getClassificationCod())) { return classif.getClassificationList(); } } return null; }
private TreeNode createTree(Classification raiz, Collection<Classification> lista) { TreeNode node = new DefaultTreeNode(raiz, null); TreeNode child = null; Collection<Classification> hijos = getChildren(raiz, lista); for (Classification hijo : hijos) { if (hijo.getClassificationList() != null) { child = createTree(hijo, lista); child.setParent(node); } else { child = new DefaultTreeNode(hijo, node); child.setParent(node); } // node.addChild(child); } return node; }