Class CmsJsonRendererContainerPage
java.lang.Object
org.opencms.xml.xml2json.renderer.CmsJsonRendererContainerPage
Used for rendering container pages as a JSON structure.
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Tree node wrapper for a container.class
Tree node wrapper around a container element. -
Constructor Summary
ConstructorDescriptionCmsJsonRendererContainerPage
(CmsObject cms, CmsResource page, Predicate<String> propertyFilter) Creates a new renderer instance. -
Method Summary
Modifier and TypeMethodDescriptionbuildTree
(CmsContainerPageBean page, String rootPath) Builds a tree from the given container page bean.Renders the JSON for the container page.
-
Constructor Details
-
CmsJsonRendererContainerPage
public CmsJsonRendererContainerPage(CmsObject cms, CmsResource page, Predicate<String> propertyFilter) Creates a new renderer instance.- Parameters:
cms
- the CMS contextpage
- the container page to renderpropertyFilter
- the property filter
-
-
Method Details
-
buildTree
public CmsJsonRendererContainerPage.ElementNode buildTree(CmsContainerPageBean page, String rootPath) Builds a tree from the given container page bean.The returned tree consists of container nodes (which have children corresponding the container elements) and element nodes (which have children corresponding to the nested containers of the element). The root of the tree is a dummy element node which does not correspond to any element in the page, but just acts as a container for the top-level containers of the page.
- Parameters:
page
- the container page beanrootPath
- the root path of the container page- Returns:
- the dummy root element node
-
renderJson
Renders the JSON for the container page.- Returns:
- the JSON for the container page
- Throws:
Exception
- if something goes wrong
-