public Vector getAssociatedLevelLists() { Vector levelLists = new Vector(); Vector endPts = CollectionHelper.makeVector("Keyword"); Hashtable keywordParents = oncotcap.Oncotcap.getDataSource() .getParentTree( "Keyword", endPts, CollectionHelper.makeVector(this), TreeDisplayModePanel.ROOT); // Take each of the parents and get the associated level lists if (keywordParents.size() <= 0) return levelLists; Hashtable levelListsHashtable = oncotcap.Oncotcap.getDataSource() .getInstanceTree( "EnumLevelList", new Vector(), makeLevelListFilter(keywordParents), TreeDisplayModePanel.ROOT); for (Enumeration e = keywordParents.keys(); e.hasMoreElements(); ) { System.out.println("Keyword.getAssociatedLevelLists: " + e.nextElement()); } // Collect all the level lists from the hashtable Vector selectedItems = CollectionHelper.makeVector(keyword); for (Enumeration e = levelListsHashtable.keys(); e.hasMoreElements(); ) { Object obj = e.nextElement(); if (obj instanceof EnumLevelList) { levelLists.addElement(obj); } } return levelLists; }
private OncFilter makeLevelListFilter(Hashtable keywords) { // Create a filter OncFilter filter = new OncFilter(false); OncTreeNode rootNode = filter.getRootNode(); OncTreeNode orNode = new OncTreeNode(TcapLogicalOperator.OR, Persistible.DO_NOT_SAVE); OncTreeNode keywordNode; for (Enumeration e = keywords.keys(); e.hasMoreElements(); ) { Object obj = e.nextElement(); if (obj instanceof Keyword) orNode.add(new OncTreeNode(obj, (Persistible.DO_NOT_SAVE))); } rootNode.add(orNode); return filter; }