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
public class ContentsTreeHelper extends AbstractLogEnabled implements Component, Serviceable
Helper for contents tree
-
-
Field Summary
Fields Modifier and Type Field Description protected AmetysObjectResolver_ametysResolverThe ametys object resolver instanceprotected ContentTypeExtensionPoint_contentTypesEPThe content type EP instanceprotected ContentTypesHelper_contentTypesHelperThe content types helper instanceprotected TreeExtensionPoint_treeExtensionPointThe tree configuration EP instancestatic StringROLEThe Avalon role
-
Constructor Summary
Constructors Constructor Description ContentsTreeHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Content_getParentContent(String parentId)Get the parent content of a treeprotected TreeConfiguration_getTreeConfiguration(String treeId)Get the tree configurationMap<String,Object>childContent2Json(Content content, String attributePath)Get the default JSON representation of a child contentprotected Map<String,Object>content2Json(Content content)Get the default JSON representation of a content of the treeList<String>filterChildrenContentByRegExp(String parentContentId, String treeId, String value)Get the path of children content which match filter regexpMap<String,Object>getChildrenContent(String contentId, String treeId)Get the children contents according the tree configurationMap<String,List<Content>>getChildrenContent(Content parentContent, TreeConfiguration treeConfiguration)Get the children contents according the tree configurationMap<String,Object>getNodeInformations(String contentId)Get the node informationsMap<String,Object>getRootNodeInformations(String contentId)Get the root node informationsbooleanhasChildrenContent(Content content, TreeConfiguration treeConfiguration)Determines if the content has children contents according the tree configurationprotected booleanisContentMatching(Content content, String value)Determines if content matches the filter regexpvoidservice(ServiceManager smanager)-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_ametysResolver
protected AmetysObjectResolver _ametysResolver
The ametys object resolver instance
-
_treeExtensionPoint
protected TreeExtensionPoint _treeExtensionPoint
The tree configuration EP instance
-
_contentTypesEP
protected ContentTypeExtensionPoint _contentTypesEP
The content type EP instance
-
_contentTypesHelper
protected ContentTypesHelper _contentTypesHelper
The content types helper instance
-
-
Constructor Detail
-
ContentsTreeHelper
public ContentsTreeHelper()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
hasChildrenContent
public boolean hasChildrenContent(Content content, TreeConfiguration treeConfiguration)
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
public Map<String,Object> getChildrenContent(String contentId, String treeId)
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
protected boolean isContentMatching(Content content, String value)
Determines if content matches the filter regexp- Parameters:
content- the contentvalue- the value to match- Returns:
- true if the content match
-
getRootNodeInformations
public Map<String,Object> getRootNodeInformations(String contentId)
Get the root node informations- Parameters:
contentId- The content- Returns:
- The informations
-
getNodeInformations
public Map<String,Object> getNodeInformations(String contentId)
Get the node informations- Parameters:
contentId- The content- Returns:
- The informations
-
content2Json
protected Map<String,Object> content2Json(Content content)
Get the default JSON representation of a content of the tree- Parameters:
content- the content- Returns:
- the content as JSON
-
childContent2Json
public Map<String,Object> childContent2Json(Content content, String attributePath)
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
protected TreeConfiguration _getTreeConfiguration(String treeId)
Get the tree configuration- Parameters:
treeId- the tree id- Returns:
- the tree configuration
-
_getParentContent
protected Content _getParentContent(String parentId) throws IllegalArgumentException
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
-
-