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 aContentView
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
Fields Modifier and Type Field Description protected ContentTypeExtensionPoint
_contentTypeEP
The content types extension pointprotected ContentTypesHelper
_contentTypesHelper
Helper for content typesprotected Context
_context
Context to get full content type ID from requestprotected DynamicContentTypeDescriptorExtentionPoint
_dynamicContentTypeDescriptorEP
The dynamic content type descriptior extension pointprotected SourceResolver
_resolver
The source resolver-
Fields inherited from interface org.ametys.cms.source.ContentView
ROLE
-
-
Constructor Summary
Constructors Constructor Description DefaultContentView()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<String>
_getDefaultSourceURIs(String pluginName, String formatSuffix, String extension)
Get the URIs of default stylesheetsprotected List<String>
_getDefaultSourceURIsForContentType(ContentTypeDescriptor contentType, String pluginName, String formatSuffix, String extension)
Get the URIs of default stylesheetsprotected 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.protected List<String>
_getSourceURIsForContentType(String contentTypeAlias, String contentTypeId, String view, String formatSuffix, String extension)
get source for a non dynamic content typeprotected List<String>
_getSourceURIsForDynamicContentType(String contentTypeAlias, String view, String formatSuffix, String pluginName, String extension)
get source for a dynamic content typeprotected List<String>
_getSourceURIsForSuperTypes(String contentTypeAlias, String contentTypeId, String view, String formatSuffix, String extension)
Get source for a given content typevoid
contextualize(Context context)
Source
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 Detail
-
_resolver
protected SourceResolver _resolver
The source resolver
-
_contentTypesHelper
protected ContentTypesHelper _contentTypesHelper
Helper for content types
-
_contentTypeEP
protected ContentTypeExtensionPoint _contentTypeEP
The content types extension point
-
_dynamicContentTypeDescriptorEP
protected DynamicContentTypeDescriptorExtentionPoint _dynamicContentTypeDescriptorEP
The dynamic content type descriptior extension point
-
-
Constructor Detail
-
DefaultContentView
public DefaultContentView()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- 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
-
-