Package org.ametys.web.repository.site
Class DefaultSiteType
- java.lang.Object
-
- org.ametys.web.repository.site.DefaultSiteType
-
- All Implemented Interfaces:
Model
,ModelItemAccessor
,ModelItemContainer
,PluginAware
,SiteType
,Configurable
,Serviceable
,ThreadSafe
- Direct Known Subclasses:
ProjectWorkspaceSiteType
public class DefaultSiteType extends Object implements SiteType, Configurable, PluginAware, ThreadSafe, Serviceable
Type of site which is retrieved from a XML configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
DefaultSiteType.I18nizableTextTranslationComparator
I18nizableText comparator for site parameters General information category is the first one, then sort the I18nizableText with their translation(package private) class
DefaultSiteType.SiteConfigurationParametersComparator
Comparator for the site parameter wrappers using their position If no position is set, keep the order of arrival in the configuration
-
Field Summary
Fields Modifier and Type Field Description private static String
__FAMILY_ID
private static String
__GENERAL_INFORMATIONS_I18N_KEY
protected I18nizableText
_description
Description.protected I18nUtils
_i18nUtils
Component gathering utility methods for internationalizable text translationI18nUtils
protected String
_iconGlyph
Glyph iconprotected String
_id
Site type id.protected I18nizableText
_label
Label.protected String
_largeIcon
Large icon URI 48x48.protected String
_mediumIcon
Medium icon URI 32x32.protected String
_name
Site type name.protected List<ElementDefinition>
_parameters
The model items of this site typeprivate Collection<SiteParameterWrapper>
_parameterWrappers
The parameter wrappers available for this site typeprotected String
_pluginName
Plugin name.protected SiteConfigurationExtensionPoint
_siteConfigurationExtensionPoint
The site configuration extension pointprotected String
_smallIcon
Small icon URI 16x16.protected SourceResolver
_srcResolver
The source resolverprotected View
_view
The site type view, built from site parameter categories and groups-
Fields inherited from interface org.ametys.web.repository.site.SiteType
DEFAULT_SITE_TYPE_ID
-
-
Constructor Summary
Constructors Constructor Description DefaultSiteType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Stream<SiteParameterWrapper>
_getParameterWrappers()
protected I18nizableText
_parseI18nizableText(Configuration config, String name)
Parse an i18n text.protected String
_parseIcon(Configuration configuration, String name)
Parse an icon pathvoid
configure(Configuration configuration)
I18nizableText
getDescription()
Retrieves the description of the site type.String
getFamilyId()
Retrieves the Family Id (for example the extension point) Each model Id have to be unique in it's family IdString
getIconGlyph()
Retrieves the CSS class to use for glyph iconString
getId()
Retrieves the model id (an id must be unique in the familyModel.getFamilyId()
I18nizableText
getLabel()
Retrieves the label of the site 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.Collection<ElementDefinition>
getModelItems()
Retrieves all the model items of this accessorString
getName()
Retrieves the name of the site type.String
getPluginName()
Retrieves the name of the plugin declaring this site type.String
getSmallIcon()
Retrieves the URL of the icon without the context path.View
getView()
Retrieves the site type view, built from site parameter categories and groupsvoid
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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.runtime.model.ModelItemAccessor
getChild, hasModelItem
-
Methods inherited from interface org.ametys.web.repository.site.SiteType
getModelItem, isPrivateType, siteInitiallyRestricted
-
-
-
-
Field Detail
-
__FAMILY_ID
private static final String __FAMILY_ID
- See Also:
- Constant Field Values
-
__GENERAL_INFORMATIONS_I18N_KEY
private static final String __GENERAL_INFORMATIONS_I18N_KEY
- See Also:
- Constant Field Values
-
_pluginName
protected String _pluginName
Plugin name.
-
_label
protected I18nizableText _label
Label.
-
_description
protected I18nizableText _description
Description.
-
_iconGlyph
protected String _iconGlyph
Glyph icon
-
_smallIcon
protected String _smallIcon
Small icon URI 16x16.
-
_mediumIcon
protected String _mediumIcon
Medium icon URI 32x32.
-
_largeIcon
protected String _largeIcon
Large icon URI 48x48.
-
_parameters
protected List<ElementDefinition> _parameters
The model items of this site type
-
_srcResolver
protected SourceResolver _srcResolver
The source resolver
-
_siteConfigurationExtensionPoint
protected SiteConfigurationExtensionPoint _siteConfigurationExtensionPoint
The site configuration extension point
-
_i18nUtils
protected I18nUtils _i18nUtils
Component gathering utility methods for internationalizable text translationI18nUtils
-
_parameterWrappers
private Collection<SiteParameterWrapper> _parameterWrappers
The parameter wrappers available for this site type
-
-
Constructor Detail
-
DefaultSiteType
public DefaultSiteType()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
getId
public String getId()
Description copied from interface:Model
Retrieves the model id (an id must be unique in the familyModel.getFamilyId()
-
getFamilyId
public String 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)
-
getName
public String getName()
Description copied from interface:SiteType
Retrieves the name of the site type.
-
getLabel
public I18nizableText getLabel()
Description copied from interface:SiteType
Retrieves the label of the site type.
-
getDescription
public I18nizableText getDescription()
Description copied from interface:SiteType
Retrieves the description of the site type.- Specified by:
getDescription
in interfaceSiteType
- Returns:
- the description.
-
getIconGlyph
public String getIconGlyph()
Description copied from interface:SiteType
Retrieves the CSS class to use for glyph icon- Specified by:
getIconGlyph
in interfaceSiteType
- Returns:
- the glyph name.
-
getLargeIcon
public String getLargeIcon()
Description copied from interface:SiteType
Retrieves the URL of the icon without the context path.- Specified by:
getLargeIcon
in interfaceSiteType
- Returns:
- the icon URL for the large image 48x48.
-
getMediumIcon
public String getMediumIcon()
Description copied from interface:SiteType
Retrieves the URL of the icon without the context path.- Specified by:
getMediumIcon
in interfaceSiteType
- Returns:
- the icon URL for the medium sized image 32x32.
-
getSmallIcon
public String getSmallIcon()
Description copied from interface:SiteType
Retrieves the URL of the icon without the context path.- Specified by:
getSmallIcon
in interfaceSiteType
- Returns:
- the icon URL for the small image 16x16.
-
getPluginName
public String getPluginName()
Description copied from interface:SiteType
Retrieves the name of the plugin declaring this site type.- Specified by:
getPluginName
in interfaceSiteType
- Returns:
- the name of the plugin.
-
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
-
getModelItems
public Collection<ElementDefinition> getModelItems()
Description copied from interface:ModelItemAccessor
Retrieves all the model items of this accessor- Specified by:
getModelItems
in interfaceModelItemAccessor
- Specified by:
getModelItems
in interfaceSiteType
- Returns:
- the model items
-
getView
public View getView()
Description copied from interface:SiteType
Retrieves the site type view, built from site parameter categories and groups
-
_getParameterWrappers
private Stream<SiteParameterWrapper> _getParameterWrappers()
-
_parseI18nizableText
protected I18nizableText _parseI18nizableText(Configuration config, String name) throws ConfigurationException
Parse an i18n text.- Parameters:
config
- the configuration to use.name
- the child name.- Returns:
- the i18n text.
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_parseIcon
protected String _parseIcon(Configuration configuration, String name) throws ConfigurationException
Parse an icon path- Parameters:
configuration
- the configuration to usename
- the child name.- Returns:
- The icon path
- Throws:
ConfigurationException
- if the configuration is not valid.
-
-