Package com.atlassian.confluence.pages
Class ContentTree
java.lang.Object
com.atlassian.confluence.pages.ContentTree
A graph of
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 Summary
ConstructorsConstructorDescriptionContentTree
(ContentNode rootNode) Create a ContentTree with only a single root nodelContentTree
(List<ContentNode> rootContentNodes) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRootNode
(ContentNode contentNode) boolean
void
Remove all nodes in this tree whose id does not match the list passed invoid
Filters the tree according to included and excluded ids of content nodes.getPage
(long pageId) getPages()
int
hashCode()
boolean
isRootNode
(ContentNode node) void
removeNode
(ContentNode contentNode) void
setBlogPosts
(List<BlogPost> blogPosts) int
size()
-
Constructor Details
-
ContentTree
public ContentTree() -
ContentTree
Create a ContentTree with only a single root nodel- Parameters:
rootNode
- the only root node in this content tree
-
ContentTree
-
-
Method Details
-
getRootNodes
-
isRootNode
-
filter
Remove all nodes in this tree whose id does not match the list passed in- Parameters:
ids
- List of String representations of the ids of pages
-
filter
Filters the tree according to included and excluded ids of content nodes. Nodes are removed if:- no ancestor is included in includedIds
- their closest ancestor mentioned in either list is in excludedIds
- they are in 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:
- they are not visible to the current user and any of their siblings are in excludedIds
- Parameters:
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)
-
addRootNode
-
removeNode
-
getAllContentNodes
-
getPage
- Parameters:
pageId
- the id of the required page- Returns:
- the Page from the ContentTree or null if there is no page with that id in the ContentTree
-
getPages
- Returns:
- all the pages associated with the nodes in this tree
-
getBlogPosts
-
setBlogPosts
-
size
public int size()- Returns:
- the number of nodes in this tree
-
equals
-
hashCode
public int hashCode()
-