use of org.xwiki.model.reference.EntityReferenceTree in project xwiki-platform by xwiki.
the class DefaultInstanceModel method getSpaceReferences.
@Override
public EntityReferenceTreeNode getSpaceReferences(WikiReference wikiReference) throws FilterException {
// Get the spaces
List<String> spaceReferenceStrings;
try {
spaceReferenceStrings = this.queryManager.getNamedQuery("getSpaces").setWiki(wikiReference.getName()).execute();
} catch (QueryException e) {
throw new FilterException(String.format("Failed to get the list of spaces in wiki [%s]", wikiReference), e);
}
// Get references
List<SpaceReference> spaceReferences = new ArrayList<>(spaceReferenceStrings.size());
for (String spaceReferenceString : spaceReferenceStrings) {
spaceReferences.add(this.spaceResolver.resolve(spaceReferenceString, wikiReference));
}
// Create the tree
EntityReferenceTree tree = new EntityReferenceTree(spaceReferences);
return tree.getChildren().iterator().next();
}
Aggregations