protected ElementTreeNode calculateChildren(String parentId) throws BrowseException { ElementTreeNode currentElement = new ElementTreeNode(parentId); currentElement.setElementText("TODO"); currentElement.setElementLevelExtId("TODO"); currentElement.setChildren(getChildrenFromRelation(currentElement)); return currentElement; }
private boolean hasChildren(final ElementTreeNode childrenPartData) { if (childrenPartData != null) { for (final Set<ElementTreeNode> childrenOfHierarchy : childrenPartData.getChildren().values()) { if (!childrenOfHierarchy.isEmpty()) { return true; } } } return false; }
protected Map<String, Set<ElementTreeNode>> getChildrenFromRelation( ElementTreeNode parent) throws BrowseException { Map<String, Set<ElementTreeNode>> result = new HashMap<String, Set<ElementTreeNode>>(); Relation relation = browserFacade.relation(ElementView.ELEMENT_VIEW_NAME) .withPageSize(BROWSE_PAGE_SIZE); Selection selection = Query.fields(ElementView.FIELD_PARENT_EXTID, ElementView.FIELD_EXTID, ElementView.FIELD_LEVEL_EXTID, ElementView.FIELD_TEXT, ElementView.FIELD_HIERARCHY) .where(Condition.eq(ElementView.FIELD_PARENT_EXTID, parent.getElementExtId())); FetcherIterator fi = new FetcherIterator(relation.select(selection), BROWSE_PAGE_SIZE); while (fi.hasNext()) { Serializable[] row = fi.next(); String hierarchyId = (String) row[4]; if (result.get(hierarchyId) == null) { result.put(hierarchyId, new HashSet<ElementTreeNode>()); } ElementTreeNode child = new ElementTreeNode(row[1].toString()); child.setParentExtId(parent.getElementExtId()); child.setParentLevelExtId(parent.getElementLevelExtId()); child.setParentText(parent.getElementText()); child.setElementLevelExtId(row[2].toString()); child.setElementText(row[3].toString()); result.get(hierarchyId).add(child); } return result; }
protected List<String> getChildrenIds(CatalogElement e) throws Exception { List<String> childrenIds = new LinkedList<String>(); if (e.getChildren() != null && !e.getChildren().isEmpty()) { for (ElementTreeNode child : e.getChildren()) { childrenIds.add(child.getElementExtId()); } } // Fetcher f = browserFacade.relation(ElementView.ELEMENT_VIEW_NAME).select( // Query.fields(ElementView.FIELD_PARENT_EXTID). // where(Condition.eq(ElementView.FIELD_EXTID, e.getExtId()))); // // int PAGE_SIZE = 5; // // for (f.fetchFirst(PAGE_SIZE); f.getPage().size() > 0; f.fetchNext(PAGE_SIZE)) { // for (Serializable[] row : f.getPage().getData()) { // childrenIds.add(row[0].toString()); // } // } return childrenIds; }
protected List<String> getChildrenIds(CatalogElement e) throws Exception { List<String> childrenIds = new LinkedList<String>(); if (e.getChildren() != null && !e.getChildren().isEmpty()) { for (ElementTreeNode child : e.getChildren()) { childrenIds.add(child.getElementExtId()); } } // Fetcher f = browserFacade.relation(ElementView.ELEMENT_VIEW_NAME).select( // Query.fields(ElementView.FIELD_PARENT_EXTID). // where(Condition.eq(ElementView.FIELD_EXTID, e.getExtId()))); // // int PAGE_SIZE = 5; // // for (f.fetchFirst(PAGE_SIZE); f.getPage().size() > 0; f.fetchNext(PAGE_SIZE)) { // for (Serializable[] row : f.getPage().getData()) { // childrenIds.add(row[0].toString()); // } // } return childrenIds; }
protected List<String> getChildrenIds(CatalogElement e) throws Exception { List<String> childrenIds = new LinkedList<String>(); if (e.getChildren() != null && !e.getChildren().isEmpty()) { for (ElementTreeNode child : e.getChildren()) { childrenIds.add(child.getElementExtId()); } } // Fetcher f = browserFacade.relation(ElementView.ELEMENT_VIEW_NAME).select( // Query.fields(ElementView.FIELD_PARENT_EXTID). // where(Condition.eq(ElementView.FIELD_EXTID, e.getExtId()))); // // int PAGE_SIZE = 5; // // for (f.fetchFirst(PAGE_SIZE); f.getPage().size() > 0; f.fetchNext(PAGE_SIZE)) { // for (Serializable[] row : f.getPage().getData()) { // childrenIds.add(row[0].toString()); // } // } return childrenIds; }