Class CmsJsonRendererContainerPage
- java.lang.Object
-
- org.opencms.xml.xml2json.renderer.CmsJsonRendererContainerPage
-
public class CmsJsonRendererContainerPage extends java.lang.Object
Used for rendering container pages as a JSON structure.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CmsJsonRendererContainerPage.ContainerNode
Tree node wrapper for a container.class
CmsJsonRendererContainerPage.ElementNode
Tree node wrapper around a container element.
-
Constructor Summary
Constructors Constructor Description CmsJsonRendererContainerPage(CmsObject cms, CmsResource page, java.util.function.Predicate<java.lang.String> propertyFilter)
Creates a new renderer instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CmsJsonRendererContainerPage.ElementNode
buildTree(CmsContainerPageBean page, java.lang.String rootPath)
Builds a tree from the given container page bean.java.lang.Object
renderJson()
Renders the JSON for the container page.
-
-
-
Constructor Detail
-
CmsJsonRendererContainerPage
public CmsJsonRendererContainerPage(CmsObject cms, CmsResource page, java.util.function.Predicate<java.lang.String> propertyFilter)
Creates a new renderer instance.- Parameters:
cms
- the CMS contextpage
- the container page to renderpropertyFilter
- the property filter
-
-
Method Detail
-
buildTree
public CmsJsonRendererContainerPage.ElementNode buildTree(CmsContainerPageBean page, java.lang.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
public java.lang.Object renderJson() throws java.lang.Exception
Renders the JSON for the container page.- Returns:
- the JSON for the container page
- Throws:
java.lang.Exception
- if something goes wrong
-
-