Package org.ametys.cms.contenttype
Class DefaultContentType
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.contenttype.AbstractContentTypeDescriptor
org.ametys.cms.contenttype.DefaultContentType
- All Implemented Interfaces:
ContentType
,ContentTypeDescriptor
,MetadataDefinitionHolder
,Model
,ModelItemAccessor
,ModelItemContainer
,LogEnabled
,PluginAware
,Disposable
,Configurable
,Contextualizable
,Serviceable
,ThreadSafe
- Direct Known Subclasses:
AutomaticContentType
,HTMLContentType
,ODFContentType
,WebContentType
public class DefaultContentType
extends AbstractContentTypeDescriptor
implements ContentType, Contextualizable, ThreadSafe, Disposable
Type of content which is retrieved from a XML configuration.
TODO document xml configuration
...
Provides access based on rights and current workflow steps.
It used a configuration file with the following format:
<restrict-to>
[<right type="read|write" id="RIGHT_ID"/>]*
<!-- logical OR between several right id of the same type -->
[<workflow type="read|write" step="3"/>]*
<!-- logical OR between several workflow step of the same type -->
[<cannot type="read|write"/>]*
</restrict-to>
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static interface
Definition with semantic annotationsprotected class
Deprecated.protected static interface
Deprecated.useRestrictedModelItem
insteadprotected static class
Deprecated.UseAttributeDefinition
insteadprotected static class
Deprecated.UseContentRestrictedRepeaterDefinition
insteadprotected static class
Deprecated.UseRichTextAttributeDefinition
instead -
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
Suffix for global validator role.protected boolean
The abstract propertyprotected ContentAttributeDefinitionParser
The parser for content attribute's definitionsprotected Context
Cocoon ContextThe parser for content compisite's definitionsConfigured workflow names of the content type or its supertypes, can be emptyprotected Context
Avalon Context.Default workflow name.protected DublinCoreAttributeDefinitionParser
The parser for dublin core attribute's definitionsprotected List<ContentValidator>
Potential global validators.protected HierarchicalReferenceTablesHelper
The helper component for hierarchical simple contentsprotected IndexingModel
Indexing modelThe inheritable tagsprotected ServiceManager
Service manager.protected Map<String,
MetadataDefinition> Deprecated.Model itemsList of overridden attributesList of overridden viewsprotected ContentAttributeDefinition
The parent attribute definitionThe parser for content repeater's definitionsprotected ContentRestrictedModelItemHelper
The restrictions helperprotected RichTextOutgoingReferencesExtractor
Docbook (rich text) outgoing references extractor.protected RichTextTransformer
Default rich text transformer.protected RichTextUpdater
Potentiel richtext updaterprotected String
The right needed to create a content of this type, or null if no right is needed.The tagsprotected Map<String,
Configuration> All configurations of content type's viewsAll content type's viewsFields inherited from class org.ametys.cms.contenttype.AbstractContentTypeDescriptor
_allMetadataSets, _category, _contentTypesHelper, _contentTypesParserHelper, _cssFiles, _cTypeEP, _dcProvider, _defaultTitle, _description, _iconDecorator, _iconGlyph, _id, _label, _largeIcon, _mediumIcon, _metadataSets, _pluginName, _smallIcon, _srcResolver, _superTypeIds
Fields inherited from interface org.ametys.cms.contenttype.ContentType
ATTRIBUTE_REF_TAG_NAME_WITH_LEGACY_SYNTAX, GROUP_TAG_NAME_WITH_LEGACY_SYNTAX, TAG_MIXIN, TAG_PRIVATE, TAG_REFERENCE_TABLE, TAG_RENDERABLE_FERENCE_TABLE, VIEW_TAG_NAME, VIEW_TAG_NAME_WITH_LEGACY_SYNTAX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_addSemanticAnnotations
(Configuration indexConf, MetadataDefinitionHolder holder) Add semantic annotations as indexing fields to the indexing model.protected void
_checkAttributeTypes
(ModelItem item1, ModelItem item2) Check if all attribute types defined in first model item are equals to those defined in second model itemprotected void
_checkAttributeTypes
(Configuration metadataConf1, Configuration metadataConf2) Check if all metadata's types defined in first configuration are equals to those defined in second configurationprotected void
_checkContentAttributes
(ModelItemContainer modelItemContainer, int repeaterLevel) Check for each content attribute: the content type id, the mutual references and the default valuesprotected void
_checkContentTypeId
(ContentAttributeDefinition definition) Check the content type id of the given content attribute definitionprotected void
_checkContentTypeSimplicity
(ModelItem modelItem) Checks the given model item to determine if this content type is multilingual and/or simple All items of a simple content-type have to be a simple type (string, long, date, ..) A multilingual content type should contain at least an attribute of type MULTILINGUAL-STRINGprotected boolean
_checkMetadataDefinition
(MetadataDefinition metadataDefinition) Deprecated.Use_checkContentTypeSimplicity(ModelItem)
insteadprotected void
_checkMetadataTypes
(MetadataDefinition metaDef1, MetadataDefinition metaDef2) Deprecated.Use_checkAttributeTypes(ModelItem, ModelItem)
insteadprotected void
_checkMutualReferences
(ContentAttributeDefinition definition, int repeaterLevel) Check the mutual reference declaration of the given content attribute definitionprotected void
Browse the indexing model and compute indexing field references.protected void
_configureAttributeDefinitions
(Configuration mainConfig) Configure attribute definitionsprotected void
_configureCustomIndexingFields
(Configuration indexConf) Configure the custom indexing fields.protected void
Configure the custom metadata indexing fields.protected void
_configureDefaultWorkflowName
(Configuration mainConfig) Configure the default workflow name from the XML configuration.protected void
Configure the global validators for content typeprotected void
_configureIndexingModel
(Configuration config) Configure the indexing modelprotected void
_configureLocalTags
(Configuration configuration) Parse the tags and add it to tags listprotected void
_configureMetadataIndexingFields
(Configuration indexConf) Configure the metadata indexing fields.protected void
_configureParentContentType
(Configuration mainConfig) Configures the "parent" content type.protected void
_configureViews
(Configuration mainConfig) Configure the content type viewsprotected void
_getApplicableAttributes
(Configuration config, Map<String, Configuration> attributeConfigurations, boolean allowOverride) Fill a map of the applicable attribute configurations.protected Map<String,
Configuration> _getApplicableViews
(Configuration configuration, String viewTagName, boolean allowOverride) Compute the applicable views from their configurations.Get the ContentTypeReservedAttributeNameExtensionPoint instanceprotected Restrictions
_getRestrictionsForPath
(MetadataDefinition metadataDef) Retrieves the restrictions for a given path.protected void
_getSemanticAnnotations
(MetadataDefinitionHolder holder, Multimap<SemanticAnnotation, String> annotations, String prefix) Get the semantic annotations and their paths from the given metadata definition holder's sub-tree.protected void
_parseAllAttributes
(Map<String, Configuration> attributeConfigurations) Parse all attribute configurations.protected void
_parseAllMetadatas
(Map<String, Configuration> metadataConfigurations, DefaultContentType.MetadataAndRepeaterDefinitionParser defParser) Deprecated.use_parseAllAttributes(Map)
insteadprotected void
Parse DublinCore attributesprotected void
Deprecated.Use_parseDublinCoreAttributes()
instead_parseGlobalValidators
(Configuration config, boolean includeSuperTypeValidators) Parse the global validatorsprotected MetadataDefinition
_parseMetadata
(Configuration metadataConfiguration, DefaultContentType.MetadataAndRepeaterDefinitionParser defParser) Deprecated.use_parseModelItem(Configuration, ModelItemGroup)
insteadprotected ModelItem
_parseModelItem
(Configuration itemConfiguration, ModelItemGroup parent) Parses a model itemprotected void
Resolve the temporary view referencesprotected void
_resolveViewReferences
(ViewItemAccessor viewItemAccessor, String currentViewName) Resolve the temporary view references in the givenViewItemAccessor
boolean
canRead
(Content content, MetadataDefinition metadataDef) Determine whether a metadata can be read at this time.boolean
canWrite
(Content content, MetadataDefinition metadataDef) Determine whether a metadata can be written at this time.void
configure
(Configuration configuration) void
contextualize
(Context context) void
dispose()
getAdditionalData
(Content content) Get the additional data relative to itsContentType
.Get the workflow names configured in the content type definition or in its supertypes.Get the default workflow name.Retrieves the Family Id (for example the extension point) Each model Id have to be unique in it's family IdRetrieves the potential global validators.protected List<MetadataDefinition>
getIndexingFieldDefinitions
(ContentType initialContentType, String metadataPath) Get the list of metadata definitions "traversed" from the initial content type to the given metadata.Get the indexing modelGet the registered and inheritable tags for this content typegetMetadataDefinition
(String metadataName) Retrieves the definition of a given metadata.getMetadataDefinitionByPath
(String metadataPath) Retrieves the definition of a given metadata by its path.Retrieves the metadata names.Retrieves all the model items of this accessorGet the overridden attributes listGet the overridden views listprotected Configuration
Get the overridden configurationGets 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.protected Configuration
getRootConfiguration
(Configuration configuration) Get the root configurationgetTags()
Get the registered tags for this content typeRetrieves the view with the given namegetViewConfiguration
(String viewName) Retrieves the optional view's configuration declared by this content typegetViewNames
(boolean includeInternals) Retrieves the names of all the content type's viewboolean
hasMetadataDefinition
(String metadataName) Determines if the definition of a given metadata exists.boolean
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 viewvoid
service
(ServiceManager manager) toString()
Methods inherited from class org.ametys.cms.contenttype.AbstractContentTypeDescriptor
_configureCSSFiles, _configureIcons, _configureLabels, _configureMetadataSets, _configureSuperTypes, _fillMetadataSetDublinCore, _fillMetadataSetElement, _getApplicableMetadataSets, _parseMetadataSet, _parseMetadataSets, getCategory, getCSSFiles, getDefaultTitle, getDescription, getEditionMetadataSetNames, getIconDecorator, getIconGlyph, getId, getLabel, getLargeIcon, getMediumIcon, getMetadataSetForEdition, getMetadataSetForView, getPluginName, getSmallIcon, getSupertypeIds, getViewMetadataSetNames, setPluginInfo
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ametys.cms.contenttype.ContentType
canRead, canWrite, getViewNames
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.runtime.model.ModelItemAccessor
getChild, getModelItem, hasModelItem
-
Field Details
-
__GLOBAL_VALIDATOR_ROLE_PREFIX
Suffix for global validator role.- See Also:
-
_metadata
Deprecated.Metadata definitions. -
_modelItems
Model items -
_right
The right needed to create a content of this type, or null if no right is needed. -
_abstract
The abstract property -
_configuredWorkflowNames
Configured workflow names of the content type or its supertypes, can be empty -
_defaultWorkflowName
Default workflow name. -
_tags
The tags -
_inheritableTags
The inheritable tags -
_parentAttributeDefinition
The parent attribute definition -
_manager
Service manager. -
_context
Avalon Context. -
_cocoonContext
Cocoon Context -
_restrictedModelItemHelper
The restrictions helper -
_richTextTransformer
Default rich text transformer. -
_richTextOutgoingReferencesExtractor
Docbook (rich text) outgoing references extractor. -
_globalValidators
Potential global validators. -
_richTextUpdater
Potentiel richtext updater -
_indexingModel
Indexing model -
_hierarchicalSimpleContentsHelper
The helper component for hierarchical simple contents -
_overriddenAttributes
List of overridden attributes -
_overriddenViews
List of overridden views -
_views
All content type's views -
_viewConfigurations
All configurations of content type's views -
_attributeDefinitionParser
The parser for content attribute's definitions -
_compositeDefinitionParser
The parser for content compisite's definitions -
_repeaterDefinitionParser
The parser for content repeater's definitions -
_dublinCoreAttributeDefinitionParser
The parser for dublin core attribute's definitions
-
-
Constructor Details
-
DefaultContentType
public DefaultContentType()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractContentTypeDescriptor
- Throws:
ServiceException
-
_getContentTypeReservedAttributeNameExtensionPoint
protected ContentTypeReservedAttributeNameExtensionPoint _getContentTypeReservedAttributeNameExtensionPoint()Get the ContentTypeReservedAttributeNameExtensionPoint instance- Returns:
- the instance
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
dispose
- Specified by:
dispose
in interfaceDisposable
-
getRootConfiguration
Description copied from class:AbstractContentTypeDescriptor
Get the root configuration- Specified by:
getRootConfiguration
in classAbstractContentTypeDescriptor
- Parameters:
configuration
- The configuration- Returns:
- The main configuration
-
getOverridenConfiguration
Description copied from class:AbstractContentTypeDescriptor
Get the overridden configuration- Specified by:
getOverridenConfiguration
in classAbstractContentTypeDescriptor
- Returns:
- the overridden configuration or null
- Throws:
ConfigurationException
- if an error occurred TODO NEWATTRIBUTEAPI_CONTENT: Remove this abstract method whenAbstractContentTypeDescriptor._configureMetadataSets(Configuration)
is removed. This method will now only be used inDefaultContentType
to configure attributes and views
-
configure
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractContentTypeDescriptor
- Throws:
ConfigurationException
-
_configureAttributeDefinitions
protected void _configureAttributeDefinitions(Configuration mainConfig) throws ConfigurationException Configure attribute definitions- Parameters:
mainConfig
- The content type configuration- Throws:
ConfigurationException
- if an error occurred
-
_getApplicableAttributes
protected void _getApplicableAttributes(Configuration config, Map<String, Configuration> attributeConfigurations, boolean allowOverride) throws ConfigurationExceptionFill a map of the applicable attribute configurations.- Parameters:
config
- the content type configuration.attributeConfigurations
- the Map of attributesConfiguration
, indexed by name.allowOverride
- if true, encountering an attribute which has already been declared (based on its name) will replace it. Otherwise, an exception will be thrown.- Throws:
ConfigurationException
- if an error occurs.
-
getOverriddenAttributes
Get the overridden attributes list- Specified by:
getOverriddenAttributes
in interfaceContentType
- Returns:
- the overridden attributes list
-
_checkAttributeTypes
protected void _checkAttributeTypes(Configuration metadataConf1, Configuration metadataConf2) throws ConfigurationException Check if all metadata's types defined in first configuration are equals to those defined in second configuration- Parameters:
metadataConf1
- The first configuration to comparemetadataConf2
- The second configuration to compare- Throws:
ConfigurationException
- if the types are not equals
-
_parseAllAttributes
protected void _parseAllAttributes(Map<String, Configuration> attributeConfigurations) throws ConfigurationExceptionParse all attribute configurations.- Parameters:
attributeConfigurations
- the attribute configurations.- Throws:
ConfigurationException
- if the configuration is invalid.
-
_parseModelItem
protected ModelItem _parseModelItem(Configuration itemConfiguration, ModelItemGroup parent) throws ConfigurationException Parses a model item- Parameters:
itemConfiguration
- configuration of the model item to parseparent
- the parent of the model item to parse. Can benull
if the item has no parent.- Returns:
- the parsed model item
- Throws:
ConfigurationException
- if an error occurs while the model item is parsed
-
_checkAttributeTypes
Check if all attribute types defined in first model item are equals to those defined in second model item- Parameters:
item1
- The first item to compareitem2
- The second item to compare- Throws:
ConfigurationException
- if the types are not equals
-
_checkContentTypeSimplicity
Checks the given model item to determine if this content type is multilingual and/or simple All items of a simple content-type have to be a simple type (string, long, date, ..) A multilingual content type should contain at least an attribute of type MULTILINGUAL-STRING- Parameters:
modelItem
- The model item to check
-
_parseDublinCoreAttributes
Parse DublinCore attributes- Throws:
ConfigurationException
- if the configuration is invalid
-
_parseAllMetadatas
@Deprecated protected void _parseAllMetadatas(Map<String, Configuration> metadataConfigurations, DefaultContentType.MetadataAndRepeaterDefinitionParser defParser) throws ConfigurationExceptionDeprecated.use_parseAllAttributes(Map)
insteadParse all metadata configurations.- Parameters:
metadataConfigurations
- the metadata configurations.defParser
- the metadata definition parser.- Throws:
ConfigurationException
- if the configuration is invalid.
-
_parseMetadata
@Deprecated protected MetadataDefinition _parseMetadata(Configuration metadataConfiguration, DefaultContentType.MetadataAndRepeaterDefinitionParser defParser) throws ConfigurationException Deprecated.use_parseModelItem(Configuration, ModelItemGroup)
insteadParse a metadata configuration.- Parameters:
metadataConfiguration
- the metadata configuration.defParser
- the metadata definition parser.- Returns:
- the created MetadataDefinition.
- Throws:
ConfigurationException
- if the configuration is invalid
-
_checkMetadataTypes
@Deprecated protected void _checkMetadataTypes(MetadataDefinition metaDef1, MetadataDefinition metaDef2) throws ConfigurationException Deprecated.Use_checkAttributeTypes(ModelItem, ModelItem)
insteadCheck if all metadata's types defined in first metadata definition are equals to those defined in second metadata definition- Parameters:
metaDef1
- The first metadata definition to comparemetaDef2
- The second metadata definition to compare- Throws:
ConfigurationException
- if the types are not equals
-
_checkMetadataDefinition
Deprecated.Use_checkContentTypeSimplicity(ModelItem)
insteadCheck the medatata definition to determines if this content type is multilingual and/or simple All medatata of a simple content-type have to be a simple type (string, long, date, ..) A multilingual content type should contain at least a metadata of type MULTILINGUAL_STRING- Parameters:
metadataDefinition
- The metadata definition- Returns:
- false if the medatata definition is not a valid medatata definition for a simple content-type
-
_parseDublinCoreMetadata
@Deprecated protected void _parseDublinCoreMetadata(DefaultContentType.MetadataAndRepeaterDefinitionParser defParser) throws ConfigurationException Deprecated.Use_parseDublinCoreAttributes()
insteadParse DublinCore metadata- Parameters:
defParser
- The parser definition- Throws:
ConfigurationException
- if the configuration is invalid
-
_configureDefaultWorkflowName
protected void _configureDefaultWorkflowName(Configuration mainConfig) throws ConfigurationException Configure the default workflow name from the XML configuration. - From the overriden configuration - If not, from the current configuration - If not, from the supertypes - If it cannot be determined and the content type is a reference table, then "reference-table" - Otherwise "content"- Parameters:
mainConfig
- The configuration- Throws:
ConfigurationException
- if an exception occurs
-
_configureParentContentType
Configures the "parent" content type. This must not be confounded with the super types. (SeeAbstractContentTypeDescriptor._configureSuperTypes(Configuration)
)- Parameters:
mainConfig
- The main configuration- Throws:
ConfigurationException
- if an error occurred
-
_configureViews
Configure the content type views- Parameters:
mainConfig
- The content type configuration- Throws:
ConfigurationException
- if an error occurred
-
getOverriddenViews
Get the overridden views list- Specified by:
getOverriddenViews
in interfaceContentType
- Returns:
- the overridden views list
-
_getApplicableViews
protected Map<String,Configuration> _getApplicableViews(Configuration configuration, String viewTagName, boolean allowOverride) throws ConfigurationException Compute the applicable views from their configurations.- Parameters:
configuration
- The content type configurationviewTagName
- The name of the tag containing the viewallowOverride
- iftrue
, encountering a view which has already been declared (based on its name) will replace it. Otherwise, an exception will be thrown.- Returns:
- the applicable views, indexed by their names. For each view, indicates if the view is configured
- Throws:
ConfigurationException
- if the configuration is invalid
-
_configureGlobalValidators
Configure the global validators for content type- Parameters:
config
- The content type configuration- Throws:
ConfigurationException
- if an error occurs
-
_parseGlobalValidators
protected List<String> _parseGlobalValidators(Configuration config, boolean includeSuperTypeValidators) throws ConfigurationException Parse the global validators- Parameters:
config
- the configurationincludeSuperTypeValidators
- true to include validators of super types- Returns:
- the role of global validators to be lookuped
- Throws:
ConfigurationException
- if configuration is incorrect
-
_configureIndexingModel
Configure the indexing model- Parameters:
config
- The main configuration- Throws:
ConfigurationException
- if an error occurred
-
_addSemanticAnnotations
Add semantic annotations as indexing fields to the indexing model.- Parameters:
indexConf
- the indexing model configuration.holder
- the metadata holder (ContentType or MetadataDefinition) to scan for annotable metadata.
-
_getSemanticAnnotations
protected void _getSemanticAnnotations(MetadataDefinitionHolder holder, Multimap<SemanticAnnotation, String> annotations, String prefix) Get the semantic annotations and their paths from the given metadata definition holder's sub-tree.- Parameters:
holder
- The current metadata definition holder.annotations
- The map of semantic annotations and the corresponding metadata paths.prefix
- The current prefix in the metadata tree (with a trailing slash, if applicable).
-
_configureMetadataIndexingFields
protected void _configureMetadataIndexingFields(Configuration indexConf) throws ConfigurationException Configure the metadata indexing fields.- Parameters:
indexConf
- the indexing model configuration.- Throws:
ConfigurationException
- if an error occurs.
-
_configureCustomIndexingFields
protected void _configureCustomIndexingFields(Configuration indexConf) throws ConfigurationException Configure the custom indexing fields.- Parameters:
indexConf
- the indexing model configuration.- Throws:
ConfigurationException
- if an error occurs.
-
_configureCustomMetadataIndexingFields
protected void _configureCustomMetadataIndexingFields(Configuration indexConf) throws ConfigurationException Configure the custom metadata indexing fields.- Parameters:
indexConf
- the indexing model configuration.- Throws:
ConfigurationException
- if an error occurs.
-
_configureLocalTags
Parse the tags and add it to tags list- Parameters:
configuration
- the configuration to use- Throws:
ConfigurationException
- if the configuration is not valid.
-
postInitialize
Description copied from interface:ContentType
Called by the extension point when the content type hierarchy has been computed. Can be used to do more initialization, checks, ...- Specified by:
postInitialize
in interfaceContentType
- Throws:
Exception
- if an error occurs of if an additional check fails.
-
_checkContentAttributes
protected void _checkContentAttributes(ModelItemContainer modelItemContainer, int repeaterLevel) throws ConfigurationException Check for each content attribute: the content type id, the mutual references and the default values- Parameters:
modelItemContainer
- theModelItemContainer
to checkrepeaterLevel
- the current nested level of repeaters, 0 if the current attribute isn't in a repeater.- Throws:
ConfigurationException
- if a content attribute has an invalid configuration
-
_checkContentTypeId
protected void _checkContentTypeId(ContentAttributeDefinition definition) throws ConfigurationException Check the content type id of the given content attribute definition- Parameters:
definition
- the definition to check- Throws:
ConfigurationException
- if the given content attribute references an invalid or non-existing content type.
-
_checkMutualReferences
protected void _checkMutualReferences(ContentAttributeDefinition definition, int repeaterLevel) throws ConfigurationException Check the mutual reference declaration of the given content attribute definition- Parameters:
definition
- the definition to checkrepeaterLevel
- the current nested level of repeaters, 0 if the current attribute isn't in a repeater.- Throws:
ConfigurationException
- if there is a problem with mutual reference declaration
-
_resolveViewReferences
Resolve the temporary view references- Throws:
ConfigurationException
- if a view reference has a configuration error (the content attribute nesting the reference does not specify any content type, the view does not exist, ...)
-
_resolveViewReferences
protected void _resolveViewReferences(ViewItemAccessor viewItemAccessor, String currentViewName) throws ConfigurationException Resolve the temporary view references in the givenViewItemAccessor
- Parameters:
viewItemAccessor
- theViewItemAccessor
currentViewName
- the name of the current view (to avoid views referencing themselves)- Throws:
ConfigurationException
- if a view reference has a configuration error (the content attribute nesting the reference does not specify any content type, the view does not exist, ...)
-
_computeIndexingModelReferences
Browse the indexing model and compute indexing field references. -
getIndexingFieldDefinitions
protected List<MetadataDefinition> getIndexingFieldDefinitions(ContentType initialContentType, String metadataPath) Get the list of metadata definitions "traversed" from the initial content type to the given metadata.- Parameters:
initialContentType
- the initial content type.metadataPath
- the compound metadata path.- Returns:
- the list of metadata definitions.
-
getGlobalValidators
Description copied from interface:ContentType
Retrieves the potential global validators.- Specified by:
getGlobalValidators
in interfaceContentType
- Returns:
- the global validators or an empty List if none.
-
getRichTextUpdater
Description copied from interface:ContentType
Retrieves the RichText updater- Specified by:
getRichTextUpdater
in interfaceContentType
- Returns:
- the RichText updater or
null
if none.
-
getMetadataNames
Description copied from interface:MetadataDefinitionHolder
Retrieves the metadata names.- Specified by:
getMetadataNames
in interfaceMetadataDefinitionHolder
- Returns:
- the metadata names.
-
getMetadataDefinition
Description copied from interface:MetadataDefinitionHolder
Retrieves the definition of a given metadata.- Specified by:
getMetadataDefinition
in interfaceMetadataDefinitionHolder
- Parameters:
metadataName
- the metadata name.- Returns:
- the metadata definition.
-
hasMetadataDefinition
Description copied from interface:ContentType
Determines if the definition of a given metadata exists.- Specified by:
hasMetadataDefinition
in interfaceContentType
- Parameters:
metadataName
- the metadata name.- Returns:
true
if the metadata definition exists
-
getMetadataDefinitionByPath
Description copied from interface:ContentType
Retrieves the definition of a given metadata by its path.- Specified by:
getMetadataDefinitionByPath
in interfaceContentType
- Parameters:
metadataPath
- the metadata path, separated by '/'- Returns:
- the metadata definition or
null
if not found
-
getIndexingModel
Description copied from interface:ContentType
Get the indexing model- Specified by:
getIndexingModel
in interfaceContentType
- Returns:
- the indexing model
-
canRead
public boolean canRead(Content content, MetadataDefinition metadataDef) throws AmetysRepositoryException Description copied from interface:ContentType
Determine whether a metadata can be read at this time.- Specified by:
canRead
in interfaceContentType
- Parameters:
content
- The content where metadata is to be read on. Can be null, on content creation.metadataDef
- the metadata definition- 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
public boolean canWrite(Content content, MetadataDefinition metadataDef) throws AmetysRepositoryException Description copied from interface:ContentType
Determine whether a metadata can be written at this time.- Specified by:
canWrite
in interfaceContentType
- Parameters:
content
- The content where metadata is to be written on. Can be null, on content creation.metadataDef
- the metadata definition- 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.
-
getTags
Description copied from interface:ContentType
Get the registered tags for this content type- Specified by:
getTags
in interfaceContentType
- Returns:
- the tags
-
getInheritableTags
Description copied from interface:ContentType
Get the registered and inheritable tags for this content type- Specified by:
getInheritableTags
in interfaceContentType
- Returns:
- the inheritable tags
-
hasTag
Description copied from interface:ContentType
Determines if the content type has the given tag- Specified by:
hasTag
in interfaceContentType
- Parameters:
tagName
- The tag name- Returns:
- true if the content type is tagged with the given tag name
-
isPrivate
Description copied from interface:ContentType
Get whether the content type is private, i.e. should not be created by the regular content interface.- Specified by:
isPrivate
in interfaceContentType
- Returns:
- true if the content is private, false if it is public.
-
isAbstract
Description copied from interface:ContentType
Get whether the content type is abstract, i.e. should not be created by the regular content interface.- Specified by:
isAbstract
in interfaceContentType
- Returns:
- true if the content is abstract, false otherwise.
-
isSimple
Description copied from interface:ContentType
Get whether the content type is simple, i.e. should contains only simple metadata type to be edited in a grid.- Specified by:
isSimple
in interfaceContentType
- Returns:
- true if the content is simple, false otherwise
-
isReferenceTable
Description copied from interface:ContentType
Get whether the content type is a reference table- Specified by:
isReferenceTable
in interfaceContentType
- Returns:
- true if the content type is a reference table
-
isMultilingual
Description copied from interface:ContentType
Get whether the content type is multilingual- Specified by:
isMultilingual
in interfaceContentType
- Returns:
- true if the content is multilingual, false otherwise
-
isMixin
Description copied from interface:ContentType
Get whether the content type is a mixin, i.e. should used to add metadata to a existing content.- Specified by:
isMixin
in interfaceContentType
- Returns:
- true if the content is mixin, false otherwise.
-
getConfiguredDefaultWorkflowNames
Description copied from interface:ContentType
Get the workflow names configured in the content type definition or in its supertypes.- Specified by:
getConfiguredDefaultWorkflowNames
in interfaceContentType
- Returns:
- A
Set
of workflow names
-
getDefaultWorkflowName
Description copied from interface:ContentType
Get the default workflow name.- Specified by:
getDefaultWorkflowName
in interfaceContentType
- Returns:
- The default workflow name
-
getRight
Description copied from interface:ContentType
Get the right needed to create a content of this type.- Specified by:
getRight
in interfaceContentType
- Returns:
- the right needed to create a content of this type. If null is returned, no right is needed.
-
saxContentTypeAdditionalData
public void saxContentTypeAdditionalData(ContentHandler contentHandler, Content content) throws AmetysRepositoryException, SAXException Description copied from interface:ContentType
SAX the additional content data linked to itsContentType
These additional data will be available in content view- Specified by:
saxContentTypeAdditionalData
in interfaceContentType
- 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
Description copied from interface:ContentType
Get the additional data relative to itsContentType
. These additional data are delivered to client side.- Specified by:
getAdditionalData
in interfaceContentType
- Parameters:
content
- The content- Returns:
- the additional properties in a Map
-
_getRestrictionsForPath
Retrieves the restrictions for a given path.- Parameters:
metadataDef
- the metadata definition.- Returns:
- the restrictions or
null
if not found.
-
toString
-
getParentAttributeDefinition
Description copied from interface:ContentType
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.- Specified by:
getParentAttributeDefinition
in interfaceContentType
- Returns:
- the attribute holding the "parent" of the contents of this content type
-
getModelItems
Description copied from interface:ModelItemAccessor
Retrieves all the model items of this accessor- Specified by:
getModelItems
in interfaceModelItemAccessor
- Returns:
- the model items
-
getViewNames
Description copied from interface:ContentType
Retrieves the names of all the content type's view- Specified by:
getViewNames
in interfaceContentType
- Parameters:
includeInternals
- if the result should include internal views.- Returns:
- the views' names
-
getView
Description copied from interface:ContentType
Retrieves the view with the given name- Specified by:
getView
in interfaceContentType
- Parameters:
viewName
- the name of the view to retrieve- Returns:
- the view
-
getViewConfiguration
Description copied from interface:ContentType
Retrieves the optional view's configuration declared by this content type- Specified by:
getViewConfiguration
in interfaceContentType
- Parameters:
viewName
- the name of the view to retrieve- Returns:
- the view's configuration
-
getFamilyId
Description copied from interface:Model
Retrieves the Family Id (for example the extension point) Each model Id have to be unique in it's family Id- Specified by:
getFamilyId
in interfaceModel
- Returns:
- content point (for example "org.ametys.cms.contenttype.ContentTypeExtensionPoint" for a content)
-
ContentAttributeDefinitionParser
instead