Package org.ametys.cms.contenttype
Class ContentTypeExtensionPoint
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.runtime.plugin.component.AbstractThreadSafeComponentExtensionPoint<ContentType>
-
- org.ametys.cms.contenttype.ContentTypeExtensionPoint
-
- All Implemented Interfaces:
LogEnabled
,ExtensionPoint<ContentType>
,Disposable
,Initializable
,Component
,Contextualizable
,Serviceable
,ThreadSafe
public class ContentTypeExtensionPoint extends AbstractThreadSafeComponentExtensionPoint<ContentType>
This class is in charge of handling content type extension point.
This point handles the pool of available content types.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Map<String,Map<String,List<String>>>>
_indexingReferences
The indexing references, as a Map of Referenced ContentType -> referencing ContentType -> local IndexingField name -> path to impacted content.protected HashMultimap<String,String>
_subTypes
A registry of all the content type's sub types.static String
ROLE
Avalon Role-
Fields inherited from class org.ametys.runtime.plugin.component.AbstractThreadSafeComponentExtensionPoint
_cocoonManager, _context, _manager
-
-
Constructor Summary
Constructors Constructor Description ContentTypeExtensionPoint()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentTypeOrMixinExpression
createHierarchicalContentTypeOrMixinExpression(String... contentIds)
Create a hierarchicalContentTypeExpression
which returns all contents of the specified type or mixin and all its descendant types.ContentTypeExpression
createHierarchicalCTExpression(String... contentTypeIds)
Create a hierarchicalContentTypeExpression
which returns all contents of the specified type and all its descendant types.MixinTypeExpression
createHierarchicalMixinExpression(String... mixinIds)
Create a hierarchicalContentTypeExpression
which returns all contents of the specified mixin and all its descendant types.Set<String>
getDirectSubTypes(String contentTypeId)
Get the immediate children types of a givenContentType
.Map<String,Map<String,List<String>>>
getIndexingReferences(String referencedContentType)
Get the content types referencing this content type as an indexing field.Set<String>
getSubTypes(String contentTypeId)
Get all the descendant types of a givenContentType
.boolean
hasIndexingReferences(String contentTypeId)
Test if the given content type has indexing references, i.e.protected void
initializeContentTypeHierarchy()
Initialize the content type hierarchy.protected void
initializeContentTypeIndexingReferences()
Initialize the indexing references on all content types.void
initializeExtensions()
Finalize the initialization of the extensions.
This method is called after alladdExtension()
calls.
This is the last step before the actual startup of the application.boolean
isDescendant(String contentTypeId, String parentTypeId)
Get all the descendant types of a givenContentType
.boolean
isSameOrDescendant(String contentTypeId, String parentTypeId)
Get all the descendant types of a givenContentType
.protected void
postInitialize()
The content type hierarchy has been computed: call postInitialize on each ContentType.-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractThreadSafeComponentExtensionPoint
addComponent, addExtension, contextualize, dispose, getExtension, getExtensionsIds, hasExtension, initialize, service
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_subTypes
protected HashMultimap<String,String> _subTypes
A registry of all the content type's sub types.
-
-
Constructor Detail
-
ContentTypeExtensionPoint
public ContentTypeExtensionPoint()
-
-
Method Detail
-
initializeExtensions
public void initializeExtensions() throws Exception
Description copied from interface:ExtensionPoint
Finalize the initialization of the extensions.
This method is called after alladdExtension()
calls.
This is the last step before the actual startup of the application.- Specified by:
initializeExtensions
in interfaceExtensionPoint<ContentType>
- Overrides:
initializeExtensions
in classAbstractThreadSafeComponentExtensionPoint<ContentType>
- Throws:
Exception
- if something wrong occurs
-
createHierarchicalCTExpression
public ContentTypeExpression createHierarchicalCTExpression(String... contentTypeIds)
Create a hierarchicalContentTypeExpression
which returns all contents of the specified type and all its descendant types.- Parameters:
contentTypeIds
- the content type id.- Returns:
- the hierarchical content type expression.
-
createHierarchicalMixinExpression
public MixinTypeExpression createHierarchicalMixinExpression(String... mixinIds)
Create a hierarchicalContentTypeExpression
which returns all contents of the specified mixin and all its descendant types.- Parameters:
mixinIds
- the mixin ids- Returns:
- the hierarchical content type expression.
-
createHierarchicalContentTypeOrMixinExpression
public ContentTypeOrMixinExpression createHierarchicalContentTypeOrMixinExpression(String... contentIds)
Create a hierarchicalContentTypeExpression
which returns all contents of the specified type or mixin and all its descendant types.- Parameters:
contentIds
- the mixin ids- Returns:
- the hierarchical content type expression.
-
getSubTypes
public Set<String> getSubTypes(String contentTypeId)
Get all the descendant types of a givenContentType
.- Parameters:
contentTypeId
- the content type id.- Returns:
- a collection of the ids of all the ContentType's descendants.
-
isDescendant
public boolean isDescendant(String contentTypeId, String parentTypeId)
Get all the descendant types of a givenContentType
.- Parameters:
contentTypeId
- the content type id to testparentTypeId
- the content type that should be the parent content type- Returns:
- a collection of the ids of all the ContentType's descendants.
-
isSameOrDescendant
public boolean isSameOrDescendant(String contentTypeId, String parentTypeId)
Get all the descendant types of a givenContentType
.- Parameters:
contentTypeId
- the content type id to testparentTypeId
- the content type that should be the parent content type- Returns:
- a collection of the ids of all the ContentType's descendants.
-
getDirectSubTypes
public Set<String> getDirectSubTypes(String contentTypeId)
Get the immediate children types of a givenContentType
.- Parameters:
contentTypeId
- the content type id.- Returns:
- a collection of the ids of the immediate ContentType's children.
-
getIndexingReferences
public Map<String,Map<String,List<String>>> getIndexingReferences(String referencedContentType)
Get the content types referencing this content type as an indexing field.- Parameters:
referencedContentType
- the referenced content type.- Returns:
- the
ContentType
s referencing the givenContentType
as an indexing field, as a Map of referencing ContentType -> local IndexingField name -> path to impacted content.
null
is returned if the ContentType isn't referenced in any indexing field.
-
hasIndexingReferences
public boolean hasIndexingReferences(String contentTypeId)
Test if the given content type has indexing references, i.e. if other content types reference this one in an indexing field chain.- Parameters:
contentTypeId
- the referenced content type ID.- Returns:
true
if the given content type has indexing references,false
otherwise.
-
initializeContentTypeHierarchy
protected void initializeContentTypeHierarchy()
Initialize the content type hierarchy.
-
postInitialize
protected void postInitialize() throws Exception
The content type hierarchy has been computed: call postInitialize on each ContentType.- Throws:
Exception
- if an error occurs.
-
initializeContentTypeIndexingReferences
protected void initializeContentTypeIndexingReferences()
Initialize the indexing references on all content types.
-
-