Package org.ametys.plugins.contentstree
Class ContentsTreeHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.contentstree.ContentsTreeHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
- Direct Known Subclasses:
ODFContentsTreeHelper
Helper for contents tree
-
Field Summary
Modifier and TypeFieldDescriptionprotected AmetysObjectResolver
The ametys object resolver instanceprotected ContentTypeExtensionPoint
The content type EP instanceprotected ContentTypesHelper
The content types helper instanceprotected TreeExtensionPoint
The tree configuration EP instancestatic final String
The Avalon role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Content
_getParentContent
(String parentId) Get the parent content of a treeprotected TreeConfiguration
_getTreeConfiguration
(String treeId) Get the tree configurationchildContent2Json
(Content content, String attributePath) Get the default JSON representation of a child contentcontent2Json
(Content content) Get the default JSON representation of a content of the treefilterChildrenContentByRegExp
(String parentContentId, String treeId, String value) Get the path of children content which match filter regexpgetChildrenContent
(String contentId, String treeId) Get the children contents according the tree configurationgetChildrenContent
(Content parentContent, TreeConfiguration treeConfiguration) Get the children contents according the tree configurationgetNodeInformations
(String contentId) Get the node informationsgetRootNodeInformations
(String contentId) Get the root node informationsboolean
hasChildrenContent
(Content content, TreeConfiguration treeConfiguration) Determines if the content has children contents according the tree configurationprotected boolean
isContentMatching
(Content content, String value) Determines if content matches the filter regexpvoid
service
(ServiceManager smanager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role -
_ametysResolver
The ametys object resolver instance -
_treeExtensionPoint
The tree configuration EP instance -
_contentTypesEP
The content type EP instance -
_contentTypesHelper
The content types helper instance
-
-
Constructor Details
-
ContentsTreeHelper
public ContentsTreeHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
hasChildrenContent
Determines if the content has children contents according the tree configuration- Parameters:
content
- the root contenttreeConfiguration
- the tree configuration- Returns:
- true if the content has children contents
-
getChildrenContent
public Map<String,List<Content>> getChildrenContent(Content parentContent, TreeConfiguration treeConfiguration) Get the children contents according the tree configuration- Parameters:
parentContent
- the root contenttreeConfiguration
- the tree configuration- Returns:
- the children content for each child attributes
-
getChildrenContent
Get the children contents according the tree configuration- Parameters:
contentId
- the parent contenttreeId
- the tree configuration- Returns:
- the children content
-
filterChildrenContentByRegExp
public List<String> filterChildrenContentByRegExp(String parentContentId, String treeId, String value) Get the path of children content which match filter regexp- Parameters:
parentContentId
- The id of content to start searchtreeId
- The id of tree configurationvalue
- the value to match- Returns:
- the matching paths composed by contents id separated by ';'
-
isContentMatching
Determines if content matches the filter regexp- Parameters:
content
- the contentvalue
- the value to match- Returns:
- true if the content match
-
getRootNodeInformations
Get the root node informations- Parameters:
contentId
- The content- Returns:
- The informations
-
getNodeInformations
Get the node informations- Parameters:
contentId
- The content- Returns:
- The informations
-
content2Json
Get the default JSON representation of a content of the tree- Parameters:
content
- the content- Returns:
- the content as JSON
-
childContent2Json
Get the default JSON representation of a child content- Parameters:
content
- the contentattributePath
- the path of attribute holding this content- Returns:
- the content as JSON
-
_getTreeConfiguration
Get the tree configuration- Parameters:
treeId
- the tree id- Returns:
- the tree configuration
-
_getParentContent
Get the parent content of a tree- Parameters:
parentId
- the parent id- Returns:
- the parent content of a tree
- Throws:
IllegalArgumentException
- if an exception occurred
-