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 void
_addChildren
(Content content, TreeConfiguration treeConfiguration, Map<String, Object> infos) Add the json info to list the children of a contentprotected 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, String treeId) Get the root node informationsprotected boolean
hasAutoExpandTargets
(TreeConfiguration treeConfiguration) Should auto expand until some kind of node?boolean
hasChildrenContent
(Content content, TreeConfiguration treeConfiguration) Determines if the content has children contents according the tree configurationprotected boolean
isAnAutoExpandTarget
(TreeConfiguration treeConfiguration, Content content) Should auto expand until some kind of node?protected 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
-
_addChildren
protected void _addChildren(Content content, TreeConfiguration treeConfiguration, Map<String, Object> infos) Add the json info to list the children of a content- Parameters:
content
- The contenttreeConfiguration
- The current tree configurationinfos
- The infos where to add the children key
-
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 contenttreeId
- The contents tree id- 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
-
hasAutoExpandTargets
Should auto expand until some kind of node?- Parameters:
treeConfiguration
- The tree configuration- Returns:
- true if should auto expand
-
isAnAutoExpandTarget
Should auto expand until some kind of node?- Parameters:
treeConfiguration
- The tree configurationcontent
- The content involved- Returns:
- true if should auto expand to it
-