private boolean dumpFilters(JrdsJSONWriter w, Set<Filter> filterSet) { for(Filter filter: filterSet) { String filterName = filter.getName(); Map<String, String> href = new HashMap<String, String>(); href.put("filter", filterName); doTree(w, filterName, filter.hashCode(), "filter", null, href); } return true; }
String childid = sub(params, w, e.getValue(), "node", f, subpath, base); if(childid != null) { hasChild = true; if(getPropertiesManager().security && !child.getACL().check(params)) continue; String leafName = leaf.getKey(); String graphid = base + "." + child.hashCode(); childsref.add(graphid); doTree(w, leafName, graphid, "graph", null); doTree(w, gt.getName(), id, type, childsref);
if(fset != null && fset.size() != 0) { logger.trace("Filters tab"); return dumpFilters(w, fset); if(tabtree != null) { logger.trace("Tree tab"); return evaluateTree(params, w, root, tabtree); if(tree == null) return false; return evaluateTree(params, w, root, tree); } else if(ParamsBean.TREECHOICE.equals(params.getChoiceType())) { GraphTree tree = params.getTree(); if(tree == null) return false; return evaluateTree(params, w, root, tree); } else if(ParamsBean.FILTERCHOICE.equals(params.getChoiceType())) { Filter filter = params.getFilter(); if(filter == null) return false; return evaluateFilter(params, w, root, filter);
private boolean evaluateFilter(ParamsBean params, JrdsJSONWriter w, HostsList root, Filter f) throws IOException { Collection<GraphTree> level = root.getTrees(); // We construct the graph tree root to use // The tree is parsed twice, that's not optimal Collection<GraphTree> rootToDo = new HashSet<GraphTree>(level.size()); for(GraphTree tree: level) { GraphTree testTree = f.setRoot(tree); if(testTree != null && !rootToDo.contains(testTree) && testTree.enumerateChildsGraph(f).size() > 0) { rootToDo.add(testTree); } } for(GraphTree tree: findRoot(rootToDo)) { sub(params, w, tree, "tree", f, "", tree.getPath().hashCode()); } return true; }