public abstract class AbstractContentTypeDescriptor extends AbstractLogEnabled implements ContentTypeDescriptor, Configurable, PluginAware, Serviceable
Modifier and Type | Field and Description |
---|---|
protected Map<String,MetadataSet> |
_allMetadataSetsForEdition
All metadata sets for edition.
|
protected Map<String,MetadataSet> |
_allMetadataSetsForView
All metadata sets for view.
|
protected I18nizableText |
_category
Category.
|
protected ContentTypesHelper |
_contentTypesHelper
The content types helper
|
protected List<ClientSideElement.ScriptFile> |
_cssFiles
The CSS files
|
protected ContentTypeExtensionPoint |
_cTypeEP
The content type extension point.
|
protected DublinCoreMetadataProvider |
_dcProvider
The DublinCore metadata provider
|
protected I18nizableText |
_defaultTitle
Default title.
|
protected I18nizableText |
_description
Description.
|
protected String |
_iconDecorator
Icon decorator
|
protected String |
_iconGlyph
Glyph icon
|
protected 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> |
_metadataSetsForEdition
Non-internal metadata sets for edition.
|
protected Map<String,MetadataSet> |
_metadataSetsForView
Non-internal metadata sets for view.
|
protected String |
_pluginName
Plugin name.
|
protected String |
_smallIcon
Small icon URI 16x16.
|
protected SourceResolver |
_srcResolver
The source resolver
|
protected String[] |
_superTypeIds
This content-type's supertype ids (can be empty).
|
Constructor and Description |
---|
AbstractContentTypeDescriptor() |
Modifier and Type | Method and Description |
---|---|
protected void |
_configureCSSFiles(Configuration configuration)
Configure the CSS to import
|
protected void |
_configureIcons(Configuration mainConfig)
Configures the icons
|
protected void |
_configureLabels(Configuration mainConfig)
Configures the labels
|
protected void |
_configureMetadataSets(Configuration mainConfig)
Configure metadata sets
|
protected void |
_configureSuperTypes(Configuration mainConfig)
Configures the super types
|
protected void |
_fillMetadataSetDublinCore(AbstractMetadataSetElement metadataSetElement)
Parse the DublinCore metadata set.
|
protected void |
_fillMetadataSetElement(MetadataSet rootMetadataSet,
Configuration metadataSetConfig,
AbstractMetadataSetElement metadataSetElement,
boolean isEdition,
MetadataSet superMetadataSet)
Fill child elements for a metadata set element.
|
protected void |
_getApplicableMetadataSets(Configuration config,
Map<String,Configuration> metadataSetViewConfs,
Map<String,Configuration> metadataSetEditConfs,
boolean allowOverride)
Compute the applicable metadata-sets from their configurations.
|
protected String |
_getDefaultCatalogue()
Returns the default i18n catalogue for this content type.
|
protected String |
_getIconPath(String pluginName)
Returns the path for icons
|
protected I18nizableText |
_parseI18nizableText(Configuration config,
String name)
Parse an i18n text.
|
protected I18nizableText |
_parseI18nizableText(Configuration config,
String name,
String defaultValue)
Parse an i18n text.
|
protected String |
_parseIcon(Configuration configuration,
String name)
Parse an icon path
|
protected String |
_parseIcon(Configuration configuration,
String name,
String defaultValue)
Parse an icon path
|
protected String |
_parseIconGlyph(Configuration configuration,
String metadataSetName,
String defaultGlyph)
Parse the icon glyph.
|
protected MetadataSet |
_parseMetadataSet(Configuration metadataSetConfig,
String metadataSetName,
boolean isEdition,
boolean isInternal,
String[] superTypeIds)
Parse a metadata-set configuration to create a
MetadataSet object. |
protected void |
_parseMetadataSets(Map<String,Configuration> metadataSetConfs,
Map<String,MetadataSet> metadataSets,
Map<String,MetadataSet> allMetadataSets,
String[] superTypeIds)
Parse the metadata-set configurations
|
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 icon
|
I18nizableText |
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 icon
|
String |
getIconGlyph()
Retrieves the CSS class to use for glyph icon
|
String |
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 configuration
|
String |
getPluginName()
Retrieves the name of the plugin declaring this content type.
|
protected abstract Configuration |
getRootConfiguration(Configuration configuration)
Get the root configuration
|
String |
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. |
getLogger, setLogger
protected String _pluginName
protected I18nizableText _label
protected I18nizableText _description
protected I18nizableText _defaultTitle
protected I18nizableText _category
protected String _iconGlyph
protected String _iconDecorator
protected String _smallIcon
protected String _mediumIcon
protected String _largeIcon
protected List<ClientSideElement.ScriptFile> _cssFiles
protected String[] _superTypeIds
protected Map<String,MetadataSet> _allMetadataSetsForView
protected Map<String,MetadataSet> _metadataSetsForView
protected Map<String,MetadataSet> _allMetadataSetsForEdition
protected Map<String,MetadataSet> _metadataSetsForEdition
protected ContentTypeExtensionPoint _cTypeEP
protected ContentTypesHelper _contentTypesHelper
protected SourceResolver _srcResolver
protected DublinCoreMetadataProvider _dcProvider
public AbstractContentTypeDescriptor()
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
ServiceException
public void setPluginInfo(String pluginName, String featureName, String id)
PluginAware
setPluginInfo
in interface PluginAware
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this componentprotected abstract Configuration getRootConfiguration(Configuration configuration)
configuration
- The configurationprotected abstract Configuration getOverridenConfiguration() throws ConfigurationException
ConfigurationException
- if an error occurredpublic void configure(Configuration configuration) throws ConfigurationException
configure
in interface Configurable
ConfigurationException
protected void _configureSuperTypes(Configuration mainConfig)
mainConfig
- The main configurationprotected void _configureLabels(Configuration mainConfig) throws ConfigurationException
mainConfig
- The main configurationConfigurationException
- if an error occurredprotected void _configureIcons(Configuration mainConfig) throws ConfigurationException
mainConfig
- The main configurationConfigurationException
- if an error occurredprotected void _configureMetadataSets(Configuration mainConfig) throws ConfigurationException
mainConfig
- The content type configurationConfigurationException
- if an error occurredprotected void _getApplicableMetadataSets(Configuration config, Map<String,Configuration> metadataSetViewConfs, Map<String,Configuration> metadataSetEditConfs, boolean allowOverride) throws ConfigurationException
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.ConfigurationException
- if the configuration is invalidprotected void _parseMetadataSets(Map<String,Configuration> metadataSetConfs, Map<String,MetadataSet> metadataSets, Map<String,MetadataSet> allMetadataSets, String[] superTypeIds) throws ConfigurationException
metadataSetConfs
- the metadata-set configurations, indexed by name.metadataSets
- the Map of "public" MetadataSet
objects to fill, indexed by nameallMetadataSets
- the Map of MetadataSet
objects to fill (including internal ones), indexed by name.superTypeIds
- the super content-typesConfigurationException
- if the configuration is invalidprotected MetadataSet _parseMetadataSet(Configuration metadataSetConfig, String metadataSetName, boolean isEdition, boolean isInternal, String[] superTypeIds) throws ConfigurationException
MetadataSet
object.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.ConfigurationException
- if the configuration is not valid.protected String _parseIconGlyph(Configuration configuration, String metadataSetName, String defaultGlyph)
configuration
- the configurationmetadataSetName
- The metadata set namedefaultGlyph
- The default glyph to assign if no glyph is defined. Can be null.protected void _fillMetadataSetElement(MetadataSet rootMetadataSet, Configuration metadataSetConfig, AbstractMetadataSetElement metadataSetElement, boolean isEdition, MetadataSet superMetadataSet) throws ConfigurationException
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.ConfigurationException
- if the configuration is not valid.protected void _fillMetadataSetDublinCore(AbstractMetadataSetElement metadataSetElement) throws ConfigurationException
metadataSetElement
- the metadata set element to fill.ConfigurationException
- if the configuration is not valid.protected I18nizableText _parseI18nizableText(Configuration config, String name) throws ConfigurationException
config
- the configuration to use.name
- the child name.ConfigurationException
- if the configuration is not valid.protected I18nizableText _parseI18nizableText(Configuration config, String name, String defaultValue) throws ConfigurationException
config
- the configuration to use.name
- the child name.defaultValue
- the default value if no presentConfigurationException
- if the configuration is not valid.protected String _getDefaultCatalogue()
protected String _parseIcon(Configuration configuration, String name) throws ConfigurationException
configuration
- the configuration to usename
- the child name.ConfigurationException
- if the configuration is not valid.protected String _parseIcon(Configuration configuration, String name, String defaultValue) throws ConfigurationException
configuration
- the configuration to usename
- the child name.defaultValue
- the default value.ConfigurationException
- if the configuration is not valid.protected void _configureCSSFiles(Configuration configuration) throws ConfigurationException
configuration
- The imports configurationConfigurationException
- If an error occursprotected String _getIconPath(String pluginName)
pluginName
- the configured pluginpublic String getPluginName()
ContentTypeDescriptor
getPluginName
in interface ContentTypeDescriptor
public String getId()
ContentTypeDescriptor
getId
in interface ContentTypeDescriptor
public I18nizableText getLabel()
ContentTypeDescriptor
getLabel
in interface ContentTypeDescriptor
public I18nizableText getDescription()
ContentTypeDescriptor
getDescription
in interface ContentTypeDescriptor
public I18nizableText getCategory()
ContentTypeDescriptor
getCategory
in interface ContentTypeDescriptor
public I18nizableText getDefaultTitle()
ContentTypeDescriptor
getDefaultTitle
in interface ContentTypeDescriptor
public String getIconGlyph()
ContentTypeDescriptor
getIconGlyph
in interface ContentTypeDescriptor
public String getIconDecorator()
ContentTypeDescriptor
getIconDecorator
in interface ContentTypeDescriptor
public String getSmallIcon()
ContentTypeDescriptor
getSmallIcon
in interface ContentTypeDescriptor
public String getMediumIcon()
ContentTypeDescriptor
getMediumIcon
in interface ContentTypeDescriptor
public String getLargeIcon()
ContentTypeDescriptor
getLargeIcon
in interface ContentTypeDescriptor
public String[] getSupertypeIds()
ContentTypeDescriptor
getSupertypeIds
in interface ContentTypeDescriptor
public List<ClientSideElement.ScriptFile> getCSSFiles()
ContentTypeDescriptor
getCSSFiles
in interface ContentTypeDescriptor
public Set<String> getEditionMetadataSetNames(boolean includeInternal)
ContentTypeDescriptor
getEditionMetadataSetNames
in interface ContentTypeDescriptor
includeInternal
- if the result should include internal metadataSets.public Set<String> getViewMetadataSetNames(boolean includeInternal)
ContentTypeDescriptor
getViewMetadataSetNames
in interface ContentTypeDescriptor
includeInternal
- if the result should include internal metadataSets.public MetadataSet getMetadataSetForView(String metadataSetName)
ContentTypeDescriptor
getMetadataSetForView
in interface ContentTypeDescriptor
metadataSetName
- the metadata set name.public MetadataSet getMetadataSetForEdition(String metadataSetName)
ContentTypeDescriptor
getMetadataSetForEdition
in interface ContentTypeDescriptor
metadataSetName
- the metadata set name.