Package org.ametys.cms.source
Class DefaultContentView
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.cms.source.DefaultContentView
- All Implemented Interfaces:
ContentView
,Contextualizable
,LogEnabled
,Serviceable
- Direct Known Subclasses:
WebContentView
public class DefaultContentView
extends AbstractLogEnabled
implements ContentView, Serviceable, Contextualizable
Default implementation of a
ContentView
Will first look in directory context://WEB-INF/stylesheets/content/article/article-[view].[extension]
And if the file does not exist will search in plugin:[currentPluginName]://stylesheets/content/article/article-[view].[extension]-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentTypeExtensionPoint
The content types extension pointprotected ContentTypesHelper
Helper for content typesprotected Context
Context to get full content type ID from requestThe dynamic content type descriptior extension pointprotected SourceResolver
The source resolverFields inherited from interface org.ametys.cms.source.ContentView
ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_getDefaultSourceURIs
(String pluginName, String formatSuffix, String extension) Get the URIs of default stylesheets_getDefaultSourceURIsForContentType
(ContentTypeDescriptor contentType, String pluginName, String formatSuffix, String extension) Get the URIs of default stylesheets_getSourceURIs
(String contentTypeAlias, String contentTypeId, String view, String format, String pluginName, String extension) Returns the ordered list of URI to be tested to find a stylesheet to render the Content._getSourceURIsForContentType
(String contentTypeAlias, String contentTypeId, String view, String formatSuffix, String extension) get source for a non dynamic content type_getSourceURIsForContentTypeWithPlugin
(String pluginName, String contentTypeId, String view, String formatSuffix, String extension) Get source for a non dynamic content type, call _getSourceURIsForContentType() which call this method twice if necessary (with the alias and the real content type id)._getSourceURIsForDynamicContentType
(String contentTypeAlias, String view, String formatSuffix, String pluginName, String extension) get source for a dynamic content type_getSourceURIsForSuperTypes
(String contentTypeAlias, String contentTypeId, String view, String formatSuffix, String extension) Get source for a given content typevoid
contextualize
(Context context) getSource
(String location, String contentType, String view, String format, String pluginName, String extension) Get the file source for rendering a contentvoid
service
(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_resolver
The source resolver -
_contentTypesHelper
Helper for content types -
_contentTypeEP
The content types extension point -
_dynamicContentTypeDescriptorEP
The dynamic content type descriptior extension point -
_context
Context to get full content type ID from request
-
-
Constructor Details
-
DefaultContentView
public DefaultContentView()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getSource
public Source getSource(String location, String contentType, String view, String format, String pluginName, String extension) throws IOException Description copied from interface:ContentView
Get the file source for rendering a content- Specified by:
getSource
in interfaceContentView
- Parameters:
location
- the requested locationcontentType
- the type of the current Contentview
- the content viewformat
- the format of the output (html, pdf, ...)pluginName
- the current plugin nameextension
- the extension (xsl, xml, ...)- Returns:
- the file source
- Throws:
IOException
- if the Source cannot be resolved
-
_getSourceURIs
protected List<String> _getSourceURIs(String contentTypeAlias, String contentTypeId, String view, String format, String pluginName, String extension) Returns the ordered list of URI to be tested to find a stylesheet to render the Content.- Parameters:
contentTypeAlias
- the content type alias for renderingcontentTypeId
- the content type full IDview
- the content viewformat
- the format of the output (html, pdf, ...)pluginName
- the current plugin nameextension
- the extension (xsl, xml, ...)- Returns:
- a list of URIs
-
_getDefaultSourceURIsForContentType
protected List<String> _getDefaultSourceURIsForContentType(ContentTypeDescriptor contentType, String pluginName, String formatSuffix, String extension) Get the URIs of default stylesheets- Parameters:
contentType
- The content typepluginName
- The current plugin nameformatSuffix
- the format of the output (html, pdf, ...)extension
- the extension (xsl, xml, ...)- Returns:
- a list of URIs
-
_getDefaultSourceURIs
protected List<String> _getDefaultSourceURIs(String pluginName, String formatSuffix, String extension) Get the URIs of default stylesheets- Parameters:
pluginName
- The current plugin nameformatSuffix
- the format of the output (html, pdf, ...)extension
- the extension (xsl, xml, ...)- Returns:
- a list of URIs
-
_getSourceURIsForSuperTypes
protected List<String> _getSourceURIsForSuperTypes(String contentTypeAlias, String contentTypeId, String view, String formatSuffix, String extension) Get source for a given content type- Parameters:
contentTypeAlias
- the content type alias for renderingcontentTypeId
- the content type full IDview
- the content viewformatSuffix
- the format of the output (html, pdf, ...)extension
- the extension (xsl, xml, ...)- Returns:
- the list
-
_getSourceURIsForDynamicContentType
protected List<String> _getSourceURIsForDynamicContentType(String contentTypeAlias, String view, String formatSuffix, String pluginName, String extension) get source for a dynamic content type- Parameters:
contentTypeAlias
- the content type alias for renderingview
- the content viewformatSuffix
- the format of the output (html, pdf, ...)pluginName
- the plugin nameextension
- the extension (xsl, xml, ...)- Returns:
- the list
-
_getSourceURIsForContentType
protected List<String> _getSourceURIsForContentType(String contentTypeAlias, String contentTypeId, String view, String formatSuffix, String extension) get source for a non dynamic content type- Parameters:
contentTypeAlias
- the content type alias for renderingcontentTypeId
- the content type full IDview
- the content viewformatSuffix
- the format of the output (html, pdf, ...)extension
- the extension (xsl, xml, ...)- Returns:
- the list
-
_getSourceURIsForContentTypeWithPlugin
protected List<String> _getSourceURIsForContentTypeWithPlugin(String pluginName, String contentTypeId, String view, String formatSuffix, String extension) Get source for a non dynamic content type, call _getSourceURIsForContentType() which call this method twice if necessary (with the alias and the real content type id).- Parameters:
pluginName
- the plugin name of the content typecontentTypeId
- the content type id used to build the URIsview
- the content viewformatSuffix
- the format of the output (html, pdf, ...)extension
- the extension (xsl, xml, ...)- Returns:
- the list
-