public class ContentTree extends Object
ContentNode
.
Stores all content that the user has permission to view, in the form of nodes representing
a hierarchy of pages (as they can be nested), and a list of blog posts.Constructor and Description |
---|
ContentTree() |
ContentTree(ContentNode rootNode)
Create a ContentTree with only a single root nodel
|
ContentTree(List<ContentNode> rootContentNodes) |
Modifier and Type | Method and Description |
---|---|
void |
addRootNode(ContentNode contentNode) |
boolean |
equals(Object obj) |
void |
filter(List<String> ids)
Remove all nodes in this tree whose id does not match the list passed in
|
void |
filter(Set<Long> includedIds,
Set<Long> excludedIds)
Filters the tree according to included and excluded ids of content nodes.
|
List<ContentNode> |
getAllContentNodes() |
List<BlogPost> |
getBlogPosts() |
Page |
getPage(long pageId) |
List<Page> |
getPages() |
List<ContentNode> |
getRootNodes() |
int |
hashCode() |
boolean |
isRootNode(ContentNode node) |
void |
removeNode(ContentNode contentNode) |
void |
setBlogPosts(List<BlogPost> blogPosts) |
int |
size() |
public ContentTree()
public ContentTree(ContentNode rootNode)
rootNode
- the only root node in this content treepublic ContentTree(List<ContentNode> rootContentNodes)
public List<ContentNode> getRootNodes()
public boolean isRootNode(ContentNode node)
public void filter(List<String> ids)
ids
- List of String representations of the ids of pagespublic void filter(Set<Long> includedIds, Set<Long> excludedIds)
Any nodes included whose immediate parents are not included are moved to the root.
Any root nodes not mentioned at all are excluded.
If we were to make this handle hidden pages too then we'd add an extra rule:
includedIds
- ids of pages to include (including their descendants except where exclusions apply)excludedIds
- ids of pages to exclude (their descendants are also excluded except where more specific inclusions apply)public void addRootNode(ContentNode contentNode)
public void removeNode(ContentNode contentNode)
public List<ContentNode> getAllContentNodes()
public Page getPage(long pageId)
pageId
- the id of the required pagepublic int size()
Copyright © 2003–2017 Atlassian. All rights reserved.