Package org.ametys.web.repository.page
Class DefaultContentTypesAssignmentHandler
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.web.repository.page.DefaultContentTypesAssignmentHandler
-
- All Implemented Interfaces:
ContentTypesAssignmentHandler
,Initializable
,LogEnabled
,Serviceable
public class DefaultContentTypesAssignmentHandler extends AbstractLogEnabled implements ContentTypesAssignmentHandler, Serviceable, Initializable
This implementation of the content types handler is based on content types declared in the whole application
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DefaultContentTypesAssignmentHandler.Cache
The cache is a HashSet of String + a date
-
Field Summary
Fields Modifier and Type Field Description private static String
__CACHE_ID
protected AbstractCacheManager
_cacheManager
The cache managerprotected ContentTypeExtensionPoint
_cTypeEP
The content types managerprotected SiteTypesExtensionPoint
_siteTypeExtensionPoint
The site type managerprotected SourceResolver
_srcResolver
The source resolver-
Fields inherited from interface org.ametys.web.repository.page.ContentTypesAssignmentHandler
ROLE
-
-
Constructor Summary
Constructors Constructor Description DefaultContentTypesAssignmentHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Set<String>
_getContentTypes(boolean includePrivate, boolean includeReferenceTable, boolean includeMixin, boolean includeAbstract)
Get the public content types.private Set<String>
_getContentTypesForSiteType(String siteType)
private Set<String>
_getContentTypesForSkin(String siteType, String skinName)
private Set<String>
_getContentTypesForTemplate(String siteType, String skinName, String templateName)
private Set<String>
_getContentTypesForZone(String siteType, String skinName, String templateName, String zoneName)
protected DefaultContentTypesAssignmentHandler.Cache
_parseContentTypes(Configuration configuration, long lastModificationDate)
Parses the valid content typesprotected DefaultContentTypesAssignmentHandler.Cache
_parseContentTypes(Source configFile)
Parses the valid content types for the site typeprotected DefaultContentTypesAssignmentHandler.Cache
_parseTemplateContentTypes(Source configFile)
Parses the valid content types for a templateprotected DefaultContentTypesAssignmentHandler.Cache
_parseZoneContentTypes(Source configFile, String zoneName)
Parses the valid content types for the given zone.Set<String>
getAvailableContentTypes(Page page, String zoneName)
Returns the list of available content types for a givenPage
and zone name.Set<String>
getAvailableContentTypes(Page page, String zoneName, boolean includePrivate)
Returns the list of available content types for a givenPage
and zone name.Set<String>
getAvailableContentTypes(Site site)
Returns the list of available content types for a givenSite
Set<String>
getAvailableContentTypes(Site site, boolean includePrivate)
Returns the list of available content types for a givenSite
private Cache<String,DefaultContentTypesAssignmentHandler.Cache>
getCache()
void
initialize()
void
service(ServiceManager manager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
__CACHE_ID
private static final String __CACHE_ID
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The content types manager
-
_siteTypeExtensionPoint
protected SiteTypesExtensionPoint _siteTypeExtensionPoint
The site type manager
-
_srcResolver
protected SourceResolver _srcResolver
The source resolver
-
_cacheManager
protected AbstractCacheManager _cacheManager
The cache manager
-
-
Constructor Detail
-
DefaultContentTypesAssignmentHandler
public DefaultContentTypesAssignmentHandler()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getAvailableContentTypes
public Set<String> getAvailableContentTypes(Site site)
Description copied from interface:ContentTypesAssignmentHandler
Returns the list of available content types for a givenSite
- Specified by:
getAvailableContentTypes
in interfaceContentTypesAssignmentHandler
- Parameters:
site
- the site to consider- Returns:
- the list of available content types id
-
getAvailableContentTypes
public Set<String> getAvailableContentTypes(Site site, boolean includePrivate)
Description copied from interface:ContentTypesAssignmentHandler
Returns the list of available content types for a givenSite
- Specified by:
getAvailableContentTypes
in interfaceContentTypesAssignmentHandler
- Parameters:
site
- the site to considerincludePrivate
- true to include private content types- Returns:
- the list of available content types id
-
getAvailableContentTypes
public Set<String> getAvailableContentTypes(Page page, String zoneName, boolean includePrivate)
Description copied from interface:ContentTypesAssignmentHandler
Returns the list of available content types for a givenPage
and zone name.- Specified by:
getAvailableContentTypes
in interfaceContentTypesAssignmentHandler
- Parameters:
page
- the Page to considerzoneName
- the zone name to considerincludePrivate
- true to include private content types- Returns:
- the list of available content types id
-
getAvailableContentTypes
public Set<String> getAvailableContentTypes(Page page, String zoneName)
Description copied from interface:ContentTypesAssignmentHandler
Returns the list of available content types for a givenPage
and zone name.- Specified by:
getAvailableContentTypes
in interfaceContentTypesAssignmentHandler
- Parameters:
page
- the Page to considerzoneName
- the zone name to consider- Returns:
- the list of available content types id
-
_getContentTypesForZone
private Set<String> _getContentTypesForZone(String siteType, String skinName, String templateName, String zoneName)
-
_getContentTypesForTemplate
private Set<String> _getContentTypesForTemplate(String siteType, String skinName, String templateName)
-
_getContentTypesForSkin
private Set<String> _getContentTypesForSkin(String siteType, String skinName)
-
_getContentTypesForSiteType
private Set<String> _getContentTypesForSiteType(String siteType)
-
_getContentTypes
protected Set<String> _getContentTypes(boolean includePrivate, boolean includeReferenceTable, boolean includeMixin, boolean includeAbstract)
Get the public content types.- Parameters:
includePrivate
-true
to include private content typesincludeReferenceTable
-true
to include simple content typesincludeMixin
-true
to include mixinsincludeAbstract
-true
to include abstract content types- Returns:
- the public content types.
-
_parseTemplateContentTypes
protected DefaultContentTypesAssignmentHandler.Cache _parseTemplateContentTypes(Source configFile)
Parses the valid content types for a template- Parameters:
configFile
- the template configuration file.- Returns:
- the content types' id in a Set
-
_parseZoneContentTypes
protected DefaultContentTypesAssignmentHandler.Cache _parseZoneContentTypes(Source configFile, String zoneName) throws IOException
Parses the valid content types for the given zone.- Parameters:
configFile
- the template configuration file.zoneName
- the zone name.- Returns:
- the content types' id in a Set
- Throws:
IOException
- If an error occured while reading the file
-
_parseContentTypes
protected DefaultContentTypesAssignmentHandler.Cache _parseContentTypes(Source configFile)
Parses the valid content types for the site type- Parameters:
configFile
- the configuration file.- Returns:
- the content types' id in a Set
-
_parseContentTypes
protected DefaultContentTypesAssignmentHandler.Cache _parseContentTypes(Configuration configuration, long lastModificationDate) throws ConfigurationException
Parses the valid content types- Parameters:
configuration
- the configuration.lastModificationDate
- the date the configuration was lastly modified- Returns:
- the content types' id in a Set
- Throws:
ConfigurationException
- if configuration is invalid
-
getCache
private Cache<String,DefaultContentTypesAssignmentHandler.Cache> getCache()
-
-