Package org.ametys.cms.contenttype
Class AbstractContentTypeDescriptor
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.cms.contenttype.AbstractContentTypeDescriptor
-
- All Implemented Interfaces:
ContentTypeDescriptor
,LogEnabled
,PluginAware
,Configurable
,Serviceable
- Direct Known Subclasses:
DefaultContentType
,DynamicContentTypeDescriptor
public abstract class AbstractContentTypeDescriptor extends AbstractLogEnabled implements ContentTypeDescriptor, Configurable, PluginAware, Serviceable
This abstract class represents a content type descriptor
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,MetadataSet>
_allMetadataSets
Deprecated.UseDefaultContentType._views
insteadprotected I18nizableText
_category
Category.protected ContentTypesHelper
_contentTypesHelper
The content types helperprotected ContentTypesParserHelper
_contentTypesParserHelper
The content types parser helperprotected List<ClientSideElement.ScriptFile>
_cssFiles
The CSS filesprotected ContentTypeExtensionPoint
_cTypeEP
The content type extension point.protected DublinCoreMetadataProvider
_dcProvider
The DublinCore metadata providerprotected I18nizableText
_defaultTitle
Default title.protected I18nizableText
_description
Description.protected String
_iconDecorator
Icon decoratorprotected String
_iconGlyph
Glyph iconprotected String
_id
Content type id.protected I18nizableText
_label
Label.protected String
_largeIcon
Large icon URI 48x48.protected String
_mediumIcon
Medium icon URI 32x32.protected Map<String,MetadataSet>
_metadataSets
Deprecated.UseDefaultContentType._views
insteadprotected String
_pluginName
Plugin name.protected String
_smallIcon
Small icon URI 16x16.protected SourceResolver
_srcResolver
The source resolverprotected String[]
_superTypeIds
This content-type's supertype ids (can be empty).
-
Constructor Summary
Constructors Constructor Description AbstractContentTypeDescriptor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
_configureCSSFiles(Configuration configuration)
Configure the CSS to importprotected void
_configureIcons(Configuration mainConfig)
Configures the iconsprotected void
_configureLabels(Configuration mainConfig)
Configures the labelsprotected void
_configureMetadataSets(Configuration mainConfig)
Deprecated.protected void
_configureSuperTypes(Configuration mainConfig)
Configures the super typesprotected void
_fillMetadataSetDublinCore(AbstractMetadataSetElement metadataSetElement)
Deprecated.UseContentTypeViewParser
insteadprotected void
_fillMetadataSetElement(MetadataSet rootMetadataSet, Configuration metadataSetConfig, AbstractMetadataSetElement metadataSetElement, boolean isEdition, MetadataSet superMetadataSet)
Deprecated.UseContentTypeViewParser
insteadprotected void
_getApplicableMetadataSets(Configuration config, Map<String,Configuration> metadataSetViewConfs, Map<String,Configuration> metadataSetEditConfs, boolean allowOverride)
Deprecated.protected MetadataSet
_parseMetadataSet(Configuration metadataSetConfig, String metadataSetName, boolean isEdition, boolean isInternal, String[] superTypeIds)
Deprecated.UseContentTypeViewParser.parseView(Configuration)
insteadprotected void
_parseMetadataSets(Map<String,Configuration> metadataSetConfs, Map<String,MetadataSet> metadataSets, Map<String,MetadataSet> allMetadataSets, String[] superTypeIds)
Deprecated.void
configure(Configuration configuration)
I18nizableText
getCategory()
Retrieves the category of the content type.List<ClientSideElement.ScriptFile>
getCSSFiles()
Returns the list of CSS files needed to correctly display the content's in BO, such as the content's iconI18nizableText
getDefaultTitle()
Retrieves the default title of the content type.I18nizableText
getDescription()
Retrieves the description of the content type.Set<String>
getEditionMetadataSetNames(boolean includeInternal)
Returns all names of "edition" metadataSets.String
getIconDecorator()
Retrieves the CSS class to use for decorator above the main iconString
getIconGlyph()
Retrieves the CSS class to use for glyph iconString
getId()
Retrieves the id of the content type.I18nizableText
getLabel()
Retrieves the label of the content type.String
getLargeIcon()
Retrieves the URL of the icon without the context path.String
getMediumIcon()
Retrieves the URL of the icon without the context path.MetadataSet
getMetadataSetForEdition(String metadataSetName)
Retrieves the metadata set name for edition.MetadataSet
getMetadataSetForView(String metadataSetName)
Retrieves the metadata set name for view.protected abstract Configuration
getOverridenConfiguration()
Get the overridden configurationString
getPluginName()
Retrieves the name of the plugin declaring this content type.protected abstract Configuration
getRootConfiguration(Configuration configuration)
Get the root configurationString
getSmallIcon()
Retrieves the URL of the icon without the context path.String[]
getSupertypeIds()
Retrieves the super type's ids.Set<String>
getViewMetadataSetNames(boolean includeInternal)
Returns all names of "view" metadataSets.void
service(ServiceManager smanager)
void
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
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, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.cms.contenttype.ContentTypeDescriptor
getDefaultCatalog, getIconPath
-
-
-
-
Field Detail
-
_pluginName
protected String _pluginName
Plugin name.
-
_label
protected I18nizableText _label
Label.
-
_description
protected I18nizableText _description
Description.
-
_defaultTitle
protected I18nizableText _defaultTitle
Default title.
-
_category
protected I18nizableText _category
Category.
-
_iconGlyph
protected String _iconGlyph
Glyph icon
-
_iconDecorator
protected String _iconDecorator
Icon decorator
-
_smallIcon
protected String _smallIcon
Small icon URI 16x16.
-
_mediumIcon
protected String _mediumIcon
Medium icon URI 32x32.
-
_largeIcon
protected String _largeIcon
Large icon URI 48x48.
-
_cssFiles
protected List<ClientSideElement.ScriptFile> _cssFiles
The CSS files
-
_superTypeIds
protected String[] _superTypeIds
This content-type's supertype ids (can be empty).
-
_allMetadataSets
@Deprecated protected Map<String,MetadataSet> _allMetadataSets
Deprecated.UseDefaultContentType._views
insteadAll metadata sets.
-
_metadataSets
@Deprecated protected Map<String,MetadataSet> _metadataSets
Deprecated.UseDefaultContentType._views
insteadNon-internal metadata sets.
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The content type extension point.
-
_contentTypesHelper
protected ContentTypesHelper _contentTypesHelper
The content types helper
-
_contentTypesParserHelper
protected ContentTypesParserHelper _contentTypesParserHelper
The content types parser helper
-
_srcResolver
protected SourceResolver _srcResolver
The source resolver
-
_dcProvider
protected DublinCoreMetadataProvider _dcProvider
The DublinCore metadata provider
-
-
Constructor Detail
-
AbstractContentTypeDescriptor
public AbstractContentTypeDescriptor()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
getRootConfiguration
protected abstract Configuration getRootConfiguration(Configuration configuration)
Get the root configuration- Parameters:
configuration
- The configuration- Returns:
- The main configuration
-
getOverridenConfiguration
protected abstract Configuration getOverridenConfiguration() throws ConfigurationException
Get the overridden configuration- Returns:
- the overridden configuration or null
- Throws:
ConfigurationException
- if an error occurred TODO NEWATTRIBUTEAPI_CONTENT: Remove this abstract method when_configureMetadataSets(Configuration)
is removed. This method will now only be used inDefaultContentType
to configure attributes and views
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
_configureSuperTypes
protected void _configureSuperTypes(Configuration mainConfig)
Configures the super types- Parameters:
mainConfig
- The main configuration
-
_configureLabels
protected void _configureLabels(Configuration mainConfig) throws ConfigurationException
Configures the labels- Parameters:
mainConfig
- The main configuration- Throws:
ConfigurationException
- if an error occurred
-
_configureIcons
protected void _configureIcons(Configuration mainConfig) throws ConfigurationException
Configures the icons- Parameters:
mainConfig
- The main configuration- Throws:
ConfigurationException
- if an error occurred
-
_configureMetadataSets
@Deprecated protected void _configureMetadataSets(Configuration mainConfig) throws ConfigurationException
Deprecated.Configure metadata sets- Parameters:
mainConfig
- The content type configuration- Throws:
ConfigurationException
- if an error occurred
-
_getApplicableMetadataSets
@Deprecated protected void _getApplicableMetadataSets(Configuration config, Map<String,Configuration> metadataSetViewConfs, Map<String,Configuration> metadataSetEditConfs, boolean allowOverride) throws ConfigurationException
Deprecated.Compute the applicable metadata-sets from their configurations.- Parameters:
config
- The content type configurationmetadataSetViewConfs
- the view metadata-set configurations, indexed by name.metadataSetEditConfs
- the edition metadata-set configurations, indexed by name.allowOverride
- if true, encountering a metadata-set which has already been declared (based on its name) will replace it. Otherwise, an exception will be thrown.- Throws:
ConfigurationException
- if the configuration is invalid
-
_parseMetadataSets
@Deprecated protected void _parseMetadataSets(Map<String,Configuration> metadataSetConfs, Map<String,MetadataSet> metadataSets, Map<String,MetadataSet> allMetadataSets, String[] superTypeIds) throws ConfigurationException
Deprecated.Parse the metadata-set configurations- Parameters:
metadataSetConfs
- the metadata-set configurations, indexed by name.metadataSets
- the Map of "public"MetadataSet
objects to fill, indexed by nameallMetadataSets
- the Map ofMetadataSet
objects to fill (including internal ones), indexed by name.superTypeIds
- the super content-types- Throws:
ConfigurationException
- if the configuration is invalid
-
_parseMetadataSet
@Deprecated protected MetadataSet _parseMetadataSet(Configuration metadataSetConfig, String metadataSetName, boolean isEdition, boolean isInternal, String[] superTypeIds) throws ConfigurationException
Deprecated.UseContentTypeViewParser.parseView(Configuration)
insteadParse a metadata-set configuration to create aMetadataSet
object.- Parameters:
metadataSetConfig
- the metadata set configuration to use.metadataSetName
- the metadata set name.isEdition
- the metadata set edition status.isInternal
- the metadata internal status.superTypeIds
- the super types.- Returns:
- the metadata set
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_fillMetadataSetElement
@Deprecated protected void _fillMetadataSetElement(MetadataSet rootMetadataSet, Configuration metadataSetConfig, AbstractMetadataSetElement metadataSetElement, boolean isEdition, MetadataSet superMetadataSet) throws ConfigurationException
Deprecated.UseContentTypeViewParser
insteadFill child elements for a metadata set element.- Parameters:
rootMetadataSet
- The root metadata setmetadataSetConfig
- the metadata set configuration to use.metadataSetElement
- the metadata set element to fill.isEdition
- true if it is the edition modesuperMetadataSet
- the overridden metadata-set if applicable, null otherwise.- Throws:
ConfigurationException
- if the configuration is not valid.
-
_fillMetadataSetDublinCore
@Deprecated protected void _fillMetadataSetDublinCore(AbstractMetadataSetElement metadataSetElement) throws ConfigurationException
Deprecated.UseContentTypeViewParser
insteadParse the DublinCore metadata set.- Parameters:
metadataSetElement
- the metadata set element to fill.- Throws:
ConfigurationException
- if the configuration is not valid.
-
_configureCSSFiles
protected void _configureCSSFiles(Configuration configuration) throws ConfigurationException
Configure the CSS to import- Parameters:
configuration
- The imports configuration- Throws:
ConfigurationException
- If an error occurs
-
getPluginName
public String getPluginName()
Description copied from interface:ContentTypeDescriptor
Retrieves the name of the plugin declaring this content type.- Specified by:
getPluginName
in interfaceContentTypeDescriptor
- Returns:
- the name of the plugin.
-
getId
public String getId()
Description copied from interface:ContentTypeDescriptor
Retrieves the id of the content type.- Specified by:
getId
in interfaceContentTypeDescriptor
- Returns:
- the id.
-
getLabel
public I18nizableText getLabel()
Description copied from interface:ContentTypeDescriptor
Retrieves the label of the content type.- Specified by:
getLabel
in interfaceContentTypeDescriptor
- Returns:
- the label.
-
getDescription
public I18nizableText getDescription()
Description copied from interface:ContentTypeDescriptor
Retrieves the description of the content type.- Specified by:
getDescription
in interfaceContentTypeDescriptor
- Returns:
- the description.
-
getCategory
public I18nizableText getCategory()
Description copied from interface:ContentTypeDescriptor
Retrieves the category of the content type.- Specified by:
getCategory
in interfaceContentTypeDescriptor
- Returns:
- the category.
-
getDefaultTitle
public I18nizableText getDefaultTitle()
Description copied from interface:ContentTypeDescriptor
Retrieves the default title of the content type.- Specified by:
getDefaultTitle
in interfaceContentTypeDescriptor
- Returns:
- the default title.
-
getIconGlyph
public String getIconGlyph()
Description copied from interface:ContentTypeDescriptor
Retrieves the CSS class to use for glyph icon- Specified by:
getIconGlyph
in interfaceContentTypeDescriptor
- Returns:
- the glyph name.
-
getIconDecorator
public String getIconDecorator()
Description copied from interface:ContentTypeDescriptor
Retrieves the CSS class to use for decorator above the main icon- Specified by:
getIconDecorator
in interfaceContentTypeDescriptor
- Returns:
- the glyph name.
-
getSmallIcon
public String getSmallIcon()
Description copied from interface:ContentTypeDescriptor
Retrieves the URL of the icon without the context path.- Specified by:
getSmallIcon
in interfaceContentTypeDescriptor
- Returns:
- the icon URL for the small image 16x16.
-
getMediumIcon
public String getMediumIcon()
Description copied from interface:ContentTypeDescriptor
Retrieves the URL of the icon without the context path.- Specified by:
getMediumIcon
in interfaceContentTypeDescriptor
- Returns:
- the icon URL for the medium sized image 32x32.
-
getLargeIcon
public String getLargeIcon()
Description copied from interface:ContentTypeDescriptor
Retrieves the URL of the icon without the context path.- Specified by:
getLargeIcon
in interfaceContentTypeDescriptor
- Returns:
- the icon URL for the large image 48x48.
-
getSupertypeIds
public String[] getSupertypeIds()
Description copied from interface:ContentTypeDescriptor
Retrieves the super type's ids.- Specified by:
getSupertypeIds
in interfaceContentTypeDescriptor
- Returns:
- the super type's ids, or empty if this content type doesn't extend a specific content type.
-
getCSSFiles
public List<ClientSideElement.ScriptFile> getCSSFiles()
Description copied from interface:ContentTypeDescriptor
Returns the list of CSS files needed to correctly display the content's in BO, such as the content's icon- Specified by:
getCSSFiles
in interfaceContentTypeDescriptor
- Returns:
- The list of CSS files needed. Must not be null.
-
getEditionMetadataSetNames
public Set<String> getEditionMetadataSetNames(boolean includeInternal)
Description copied from interface:ContentTypeDescriptor
Returns all names of "edition" metadataSets.- Specified by:
getEditionMetadataSetNames
in interfaceContentTypeDescriptor
- Parameters:
includeInternal
- if the result should include internal metadataSets.- Returns:
- all names of "edition" metadataSets.
-
getViewMetadataSetNames
public Set<String> getViewMetadataSetNames(boolean includeInternal)
Description copied from interface:ContentTypeDescriptor
Returns all names of "view" metadataSets.- Specified by:
getViewMetadataSetNames
in interfaceContentTypeDescriptor
- Parameters:
includeInternal
- if the result should include internal metadataSets.- Returns:
- all names of "view" metadataSets.
-
getMetadataSetForView
public MetadataSet getMetadataSetForView(String metadataSetName)
Description copied from interface:ContentTypeDescriptor
Retrieves the metadata set name for view.- Specified by:
getMetadataSetForView
in interfaceContentTypeDescriptor
- Parameters:
metadataSetName
- the metadata set name.- Returns:
- the metadata definition.
-
getMetadataSetForEdition
public MetadataSet getMetadataSetForEdition(String metadataSetName)
Description copied from interface:ContentTypeDescriptor
Retrieves the metadata set name for edition.- Specified by:
getMetadataSetForEdition
in interfaceContentTypeDescriptor
- Parameters:
metadataSetName
- the metadata set name.- Returns:
- the metadata set.
-
-