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.
This point handles the pool of available content types.
-
Field Summary
Modifier and TypeFieldDescriptionThe indexing references, as a Map of Referenced ContentType -> referencing ContentType -> local IndexingField name -> path to impacted content.protected HashMultimap<String,
String> A registry of all the content type's sub types.static final String
Avalon RoleFields inherited from class org.ametys.runtime.plugin.component.AbstractThreadSafeComponentExtensionPoint
_cocoonManager, _context, _manager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateHierarchicalContentTypeOrMixinExpression
(String... contentIds) Create a hierarchicalContentTypeExpression
which returns all contents of the specified type or mixin and all its descendant types.createHierarchicalCTExpression
(String... contentTypeIds) Create a hierarchicalContentTypeExpression
which returns all contents of the specified type and all its descendant types.createHierarchicalMixinExpression
(String... mixinIds) Create a hierarchicalContentTypeExpression
which returns all contents of the specified mixin and all its descendant types.getDirectSubTypes
(String contentTypeId) Get the immediate children types of a givenContentType
.getIndexingReferences
(String referencedContentType) Get the content types referencing this content type as an indexing field.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
Initialize the content type hierarchy.protected void
Initialize the indexing references on all content types.void
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
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 Details
-
ROLE
Avalon Role -
_subTypes
A registry of all the content type's sub types. -
_indexingReferences
The indexing references, as a Map of Referenced ContentType -> referencing ContentType -> local IndexingField name -> path to impacted content.
-
-
Constructor Details
-
ContentTypeExtensionPoint
public ContentTypeExtensionPoint()
-
-
Method Details
-
initializeExtensions
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
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
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
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
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
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
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
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
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
Initialize the content type hierarchy. -
postInitialize
The content type hierarchy has been computed: call postInitialize on each ContentType.- Throws:
Exception
- if an error occurs.
-
initializeContentTypeIndexingReferences
Initialize the indexing references on all content types.
-