Package org.ametys.cms.contenttype
Interface ContentType
-
- All Superinterfaces:
ContentTypeDescriptor
,MetadataDefinitionHolder
,Model
,ModelItemAccessor
,ModelItemContainer
- All Known Implementing Classes:
AutomaticContentType
,DefaultContentType
,HTMLContentType
,ODFContentType
,PostContentType
,WebContentType
public interface ContentType extends ContentTypeDescriptor, Model, MetadataDefinitionHolder
This class represents a type of content.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTRIBUTE_REF_TAG_NAME_WITH_LEGACY_SYNTAX
Tag name for an attribute reference declaration in a view using the legacy syntaxstatic String
GROUP_TAG_NAME_WITH_LEGACY_SYNTAX
Tag name for a group declaration in a view using legacy syntaxstatic String
TAG_MIXIN
Tag for simple content typestatic String
TAG_PRIVATE
Tag for private content typestatic String
TAG_REFERENCE_TABLE
Tag for reference tablestatic String
TAG_RENDERABLE_FERENCE_TABLE
Tag for renderable reference tablestatic String
VIEW_TAG_NAME
Tag name for a view declarationstatic String
VIEW_TAG_NAME_WITH_LEGACY_SYNTAX
Tag name for a view declaration using the legacy syntax
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description boolean
canRead(Content content, MetadataDefinition metadataDef)
Deprecated.UsecanRead(Content, RestrictedModelItem)
insteaddefault boolean
canRead(Content content, RestrictedModelItem<Content> definition)
Determine whether an attribute can be read at this time.boolean
canWrite(Content content, MetadataDefinition metadataDef)
Deprecated.UsecanWrite(Content, RestrictedModelItem)
insteaddefault boolean
canWrite(Content content, RestrictedModelItem<Content> definition)
Determine whether an attribute can be written at this time.Map<String,Object>
getAdditionalData(Content content)
Get the additional data relative to itsContentType
.Set<String>
getConfiguredDefaultWorkflowNames()
Get the workflow names configured in the content type definition or in its supertypes.Optional<String>
getDefaultWorkflowName()
Get the default workflow name.List<ContentValidator>
getGlobalValidators()
Retrieves the potential global validators.IndexingModel
getIndexingModel()
Get the indexing modelSet<String>
getInheritableTags()
Get the registered and inheritable tags for this content typeMetadataDefinition
getMetadataDefinitionByPath(String metadataPath)
Deprecated.UseModelItemAccessor.getModelItem(String)
API insteadList<String>
getOverriddenAttributes()
Get the overridden attributes listList<String>
getOverriddenViews()
Get the overridden views listOptional<ContentAttributeDefinition>
getParentAttributeDefinition()
Gets the attribute holding the "parent" of the contents of this content type.RichTextUpdater
getRichTextUpdater()
Retrieves the RichText updaterString
getRight()
Get the right needed to create a content of this type.Set<String>
getTags()
Get the registered tags for this content typeView
getView(String viewName)
Retrieves the view with the given nameOptional<Configuration>
getViewConfiguration(String viewName)
Retrieves the optional view's configuration declared by this content typedefault Set<String>
getViewNames()
Retrieves the names of all the content type's viewSet<String>
getViewNames(boolean includeInternals)
Retrieves the names of all the content type's viewboolean
hasMetadataDefinition(String metadataName)
Deprecated.UseModelItem
API insteadboolean
hasTag(String tagName)
Determines if the content type has the given tagboolean
isAbstract()
Get whether the content type is abstract, i.e.boolean
isMixin()
Get whether the content type is a mixin, i.e.boolean
isMultilingual()
Get whether the content type is multilingualboolean
isPrivate()
Get whether the content type is private, i.e.boolean
isReferenceTable()
Get whether the content type is a reference tableboolean
isSimple()
Get whether the content type is simple, i.e.void
postInitialize()
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 view-
Methods 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 Detail
-
TAG_PRIVATE
static final String TAG_PRIVATE
Tag for private content type- See Also:
- Constant Field Values
-
TAG_REFERENCE_TABLE
static final String TAG_REFERENCE_TABLE
Tag for reference table- See Also:
- Constant Field Values
-
TAG_RENDERABLE_FERENCE_TABLE
static final String TAG_RENDERABLE_FERENCE_TABLE
Tag for renderable reference table- See Also:
- Constant Field Values
-
TAG_MIXIN
static final String TAG_MIXIN
Tag for simple content type- See Also:
- Constant Field Values
-
VIEW_TAG_NAME
static final String VIEW_TAG_NAME
Tag name for a view declaration- See Also:
- Constant Field Values
-
VIEW_TAG_NAME_WITH_LEGACY_SYNTAX
static final String VIEW_TAG_NAME_WITH_LEGACY_SYNTAX
Tag name for a view declaration using the legacy syntax- See Also:
- Constant Field Values
-
GROUP_TAG_NAME_WITH_LEGACY_SYNTAX
static final String GROUP_TAG_NAME_WITH_LEGACY_SYNTAX
Tag name for a group declaration in a view using legacy syntax- See Also:
- Constant Field Values
-
ATTRIBUTE_REF_TAG_NAME_WITH_LEGACY_SYNTAX
static final String ATTRIBUTE_REF_TAG_NAME_WITH_LEGACY_SYNTAX
Tag name for an attribute reference declaration in a view using the legacy syntax- See Also:
- Constant Field Values
-
-
Method Detail
-
postInitialize
void postInitialize() throws Exception
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
List<ContentValidator> getGlobalValidators()
Retrieves the potential global validators.- Returns:
- the global validators or an empty List if none.
-
getRichTextUpdater
RichTextUpdater getRichTextUpdater()
Retrieves the RichText updater- Returns:
- the RichText updater or
null
if none.
-
getIndexingModel
IndexingModel getIndexingModel()
Get the indexing model- Returns:
- the indexing model
-
getViewNames
default Set<String> getViewNames()
Retrieves the names of all the content type's view- Returns:
- the views' names
-
getViewNames
Set<String> getViewNames(boolean includeInternals)
Retrieves the names of all the content type's view- Parameters:
includeInternals
- if the result should include internal views.- Returns:
- the views' names
-
getView
View getView(String viewName)
Retrieves the view with the given name- Parameters:
viewName
- the name of the view to retrieve- Returns:
- the view
-
getViewConfiguration
Optional<Configuration> getViewConfiguration(String viewName)
Retrieves the optional view's configuration declared by this content type- Parameters:
viewName
- the name of the view to retrieve- Returns:
- the view's configuration
-
getMetadataDefinitionByPath
@Deprecated MetadataDefinition getMetadataDefinitionByPath(String metadataPath)
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 boolean hasMetadataDefinition(String metadataName)
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.UsecanRead(Content, RestrictedModelItem)
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.UsecanWrite(Content, RestrictedModelItem)
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, RestrictedModelItem<Content> 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, RestrictedModelItem<Content> 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.
-
getInheritableTags
Set<String> getInheritableTags()
Get the registered and inheritable tags for this content type- Returns:
- the inheritable tags
-
hasTag
boolean hasTag(String tagName)
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.
-
getConfiguredDefaultWorkflowNames
Set<String> getConfiguredDefaultWorkflowNames()
Get the workflow names configured in the content type definition or in its supertypes.- Returns:
- A
Set
of workflow names
-
getDefaultWorkflowName
Optional<String> getDefaultWorkflowName()
Get the default workflow name.- Returns:
- The default workflow name
-
getRight
String 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
Map<String,Object> getAdditionalData(Content content)
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
Optional<ContentAttributeDefinition> 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
List<String> getOverriddenAttributes()
Get the overridden attributes list- Returns:
- the overridden attributes list
-
getOverriddenViews
List<String> getOverriddenViews()
Get the overridden views list- Returns:
- the overridden views list
-
-