Package org.ametys.cms.contenttype
Interface ContentType
- All Superinterfaces:
ContentTypeDescriptor
,MetadataDefinitionHolder
,Model
,ModelItemAccessor
,ModelItemContainer
- All Known Implementing Classes:
AutomaticContentType
,DefaultContentType
,HTMLContentType
,ODFContentType
,PostContentType
,WebContentType
This class represents a type of content.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canRead
(Content content, AttributeDefinition definition) Determine whether an attribute can be read at this time.boolean
canRead
(Content content, MetadataDefinition metadataDef) Deprecated.default boolean
canWrite
(Content content, AttributeDefinition definition) Determine whether an attribute can be written at this time.boolean
canWrite
(Content content, MetadataDefinition metadataDef) Deprecated.UseAttributeDefinition.canWrite(Content)
insteadgetAdditionalData
(Content content) Get the additional data relative to itsContentType
.Get the default workflow name.Retrieves the potential global validators.Get the indexing modelgetMetadataDefinitionByPath
(String metadataPath) Deprecated.UseModelItemAccessor.getModelItem(String)
API insteadGet the overridden attributes listGet the overridden views listGets the attribute holding the "parent" of the contents of this content type.Retrieves the RichText updatergetRight()
Get the right needed to create a content of this type.getTags()
Get the registered tags for this content typesRetrieves the view with the given nameRetrieves the names of all the content type's viewgetViewNames
(boolean includeInternals) Retrieves the names of all the content type's viewboolean
hasMetadataDefinition
(String metadataName) Deprecated.UseModelItem
API insteadboolean
Determines if the content type has the given tagboolean
Get whether the content type is abstract, i.e.boolean
isMixin()
Get whether the content type is a mixin, i.e.boolean
Get whether the content type is multilingualboolean
Get whether the content type is private, i.e.boolean
Get whether the content type is a reference tableboolean
isSimple()
Get whether the content type is simple, i.e.void
Called by the extension point when the content type hierarchy has been computed.void
saxContentTypeAdditionalData
(ContentHandler contentHandler, Content content) SAX the additional content data linked to itsContentType
These additional data will be available in content viewMethods inherited from interface org.ametys.cms.contenttype.ContentTypeDescriptor
getCategory, getCSSFiles, getDefaultCatalog, getDefaultTitle, getDescription, getEditionMetadataSetNames, getIconDecorator, getIconGlyph, getIconPath, getId, getLabel, getLargeIcon, getMediumIcon, getMetadataSetForEdition, getMetadataSetForView, getPluginName, getSmallIcon, getSupertypeIds, getViewMetadataSetNames
Methods inherited from interface org.ametys.cms.contenttype.MetadataDefinitionHolder
getMetadataDefinition, getMetadataNames
Methods inherited from interface org.ametys.runtime.model.Model
getFamilyId, getId
Methods inherited from interface org.ametys.runtime.model.ModelItemAccessor
getChild, getModelItem, getModelItems, hasModelItem
-
Field Details
-
TAG_PRIVATE
Tag for private content type- See Also:
-
TAG_REFERENCE_TABLE
Tag for reference table- See Also:
-
TAG_RENDERABLE_FERENCE_TABLE
Tag for renderable reference table- See Also:
-
TAG_MIXIN
Tag for simple content type- See Also:
-
-
Method Details
-
postInitialize
Called by the extension point when the content type hierarchy has been computed. Can be used to do more initialization, checks, ...- Throws:
Exception
- if an error occurs of if an additional check fails.
-
getGlobalValidators
Retrieves the potential global validators.- Returns:
- the global validators or an empty List if none.
-
getRichTextUpdater
Retrieves the RichText updater- Returns:
- the RichText updater or
null
if none.
-
getIndexingModel
Get the indexing model- Returns:
- the indexing model
-
getViewNames
Retrieves the names of all the content type's view- Returns:
- the views' names
-
getViewNames
Retrieves the names of all the content type's view- Parameters:
includeInternals
- if the result should include internal views.- Returns:
- the views' names
-
getView
Retrieves the view with the given name- Parameters:
viewName
- the name of the view to retrieve- Returns:
- the view
-
getMetadataDefinitionByPath
Deprecated.UseModelItemAccessor.getModelItem(String)
API insteadRetrieves the definition of a given metadata by its path.- Parameters:
metadataPath
- the metadata path, separated by '/'- Returns:
- the metadata definition or
null
if not found
-
hasMetadataDefinition
Deprecated.UseModelItem
API insteadDetermines if the definition of a given metadata exists.- Parameters:
metadataName
- the metadata name.- Returns:
true
if the metadata definition exists
-
canRead
@Deprecated boolean canRead(Content content, MetadataDefinition metadataDef) throws AmetysRepositoryException Deprecated.UseAttributeDefinition.canRead(Content)
insteadDetermine whether a metadata can be read at this time.- Parameters:
metadataDef
- the metadata definitioncontent
- The content where metadata is to be read on. Can be null, on content creation.- Returns:
true
if the current user is allowed to read the metadata of this content.- Throws:
AmetysRepositoryException
- if an error occurs while accessing the content.
-
canWrite
@Deprecated boolean canWrite(Content content, MetadataDefinition metadataDef) throws AmetysRepositoryException Deprecated.UseAttributeDefinition.canWrite(Content)
insteadDetermine whether a metadata can be written at this time.- Parameters:
metadataDef
- the metadata definitioncontent
- The content where metadata is to be written on. Can be null, on content creation.- Returns:
true
if the current user is allowed to write the metadata of this content.- Throws:
AmetysRepositoryException
- if an error occurs while accessing the content.
-
canRead
default boolean canRead(Content content, AttributeDefinition definition) throws AmetysRepositoryException Determine whether an attribute can be read at this time. Method called byAttributeDefinition.canRead(Content)
to do some other checks, depending on the content type- Parameters:
definition
- the attribute definitioncontent
- The content where attribute is to be read on. Can be null, on content creation.- Returns:
true
if the current user is allowed to read the attribute of this content.- Throws:
AmetysRepositoryException
- if an error occurs while accessing the content.
-
canWrite
default boolean canWrite(Content content, AttributeDefinition definition) throws AmetysRepositoryException Determine whether an attribute can be written at this time. Method called byAttributeDefinition.canWrite(Content)
to do some other checks, depending on the content type- Parameters:
definition
- the attribute definitioncontent
- The content where attribute is to be written on. Can be null, on content creation.- Returns:
true
if the current user is allowed to write the attribute of this content.- Throws:
AmetysRepositoryException
- if an error occurs while accessing the content.
-
getTags
Get the registered tags for this content types- Returns:
- the tags
-
hasTag
Determines if the content type has the given tag- Parameters:
tagName
- The tag name- Returns:
- true if the content type is tagged with the given tag name
-
isPrivate
boolean isPrivate()Get whether the content type is private, i.e. should not be created by the regular content interface.- Returns:
- true if the content is private, false if it is public.
-
isSimple
boolean isSimple()Get whether the content type is simple, i.e. should contains only simple metadata type to be edited in a grid.- Returns:
- true if the content is simple, false otherwise
-
isReferenceTable
boolean isReferenceTable()Get whether the content type is a reference table- Returns:
- true if the content type is a reference table
-
isMultilingual
boolean isMultilingual()Get whether the content type is multilingual- Returns:
- true if the content is multilingual, false otherwise
-
isAbstract
boolean isAbstract()Get whether the content type is abstract, i.e. should not be created by the regular content interface.- Returns:
- true if the content is abstract, false otherwise.
-
isMixin
boolean isMixin()Get whether the content type is a mixin, i.e. should used to add metadata to a existing content.- Returns:
- true if the content is mixin, false otherwise.
-
getDefaultWorkflowName
Get the default workflow name.- Returns:
- The default workflow name
-
getRight
Get the right needed to create a content of this type.- Returns:
- the right needed to create a content of this type. If null is returned, no right is needed.
-
saxContentTypeAdditionalData
void saxContentTypeAdditionalData(ContentHandler contentHandler, Content content) throws AmetysRepositoryException, SAXException SAX the additional content data linked to itsContentType
These additional data will be available in content view- Parameters:
contentHandler
- The handler to SAX intocontent
- The content- Throws:
AmetysRepositoryException
- if an error occurs while accessing the content.SAXException
- if an error occurs while SAXing
-
getAdditionalData
Get the additional data relative to itsContentType
. These additional data are delivered to client side.- Parameters:
content
- The content- Returns:
- the additional properties in a Map
-
getParentAttributeDefinition
Gets the attribute holding the "parent" of the contents of this content type. Must be of typeModelItemTypeConstants.CONTENT_ELEMENT_TYPE_ID
and must reference a private and simple content type.- Returns:
- the attribute holding the "parent" of the contents of this content type
-
getOverriddenAttributes
Get the overridden attributes list- Returns:
- the overridden attributes list
-
getOverriddenViews
Get the overridden views list- Returns:
- the overridden views list
-
AttributeDefinition.canRead(Content)
instead