Package org.ametys.cms.tag.jcr
Class AbstractJCRTagProvider<T extends Tag>
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.cms.tag.AbstractTagProvider<T>
-
- org.ametys.cms.tag.jcr.AbstractJCRTagProvider<T>
-
- Type Parameters:
T
- the tag class
- All Implemented Interfaces:
TagProvider<T>
,PluginAware
,Configurable
,Contextualizable
,LogEnabled
- Direct Known Subclasses:
CategoryJCRProvider
,CMSJCRTagProvider
,JCRThemeProvider
,KeywordJCRProvider
,ProjectJCRTagProvider
public abstract class AbstractJCRTagProvider<T extends Tag> extends AbstractTagProvider<T> implements Contextualizable
Abstract class representing a jcr tag provider.
-
-
Field Summary
Fields Modifier and Type Field Description protected Context
_context
The contextprotected static String
CACHE_REQUEST_ATTRIBUTE
The request attribute name with cache information-
Fields inherited from class org.ametys.cms.tag.AbstractTagProvider
_description, _featureName, _id, _label, _pluginName
-
-
Constructor Summary
Constructors Constructor Description AbstractJCRTagProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
_fillCache(TraversableAmetysObject parentTagNode, T parentTag, Map<String,T> cache)
Fill cacheprotected Map<String,T>
_getCache(Map<String,Object> contextualParameters)
Get the Map of tags by their unique nameprotected ModifiableTraversableAmetysObject
_getOrCreateNode(ModifiableTraversableAmetysObject parentNode, String nodeName, String nodeType)
Get a node or create it if not exist.void
configure(Configuration configuration)
void
contextualize(Context context)
abstract ModifiableTraversableAmetysObject
getRootNode(Map<String,Object> contextualParameters)
Get the root node for tagsT
getTag(String tagName, Map<String,Object> contextualParameters)
Returns the provider's tag.Map<String,T>
getTags(Map<String,Object> contextualParameters)
Returns the provider's tags.boolean
hasTag(String tagName, Map<String,Object> contextualParameters)
Determines if the tag exists.-
Methods inherited from class org.ametys.cms.tag.AbstractTagProvider
configureDescription, configureLabel, getDescription, getId, getLabel, getPluginName, setPluginInfo
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.cms.tag.TagProvider
getTags
-
-
-
-
Field Detail
-
CACHE_REQUEST_ATTRIBUTE
protected static final String CACHE_REQUEST_ATTRIBUTE
The request attribute name with cache information
-
-
Constructor Detail
-
AbstractJCRTagProvider
public AbstractJCRTagProvider()
-
-
Method Detail
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractTagProvider<T extends Tag>
- Throws:
ConfigurationException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
_getCache
protected Map<String,T> _getCache(Map<String,Object> contextualParameters) throws RepositoryException
Get the Map of tags by their unique name- Parameters:
contextualParameters
- The contextual parameters- Returns:
- The non null cache
- Throws:
RepositoryException
- If the cache cannot be filled
-
getTags
public Map<String,T> getTags(Map<String,Object> contextualParameters)
Description copied from interface:TagProvider
Returns the provider's tags.- Specified by:
getTags
in interfaceTagProvider<T extends Tag>
- Parameters:
contextualParameters
- contextual parameters- Returns:
- the provider's tags.
-
getTag
public T getTag(String tagName, Map<String,Object> contextualParameters)
Description copied from interface:TagProvider
Returns the provider's tag.- Specified by:
getTag
in interfaceTagProvider<T extends Tag>
- Parameters:
tagName
- The tag namecontextualParameters
- contextual parameters- Returns:
- the provider's tag.
-
hasTag
public boolean hasTag(String tagName, Map<String,Object> contextualParameters)
Description copied from interface:TagProvider
Determines if the tag exists.- Specified by:
hasTag
in interfaceTagProvider<T extends Tag>
- Parameters:
tagName
- The tag unique namecontextualParameters
- contextual parameters- Returns:
- true if the tag exists.
-
_fillCache
protected abstract void _fillCache(TraversableAmetysObject parentTagNode, T parentTag, Map<String,T> cache) throws RepositoryException
Fill cache- Parameters:
parentTagNode
- The parent tag nodeparentTag
- The parent tagcache
- The cache- Throws:
RepositoryException
- If an error occurred
-
getRootNode
public abstract ModifiableTraversableAmetysObject getRootNode(Map<String,Object> contextualParameters) throws RepositoryException
Get the root node for tags- Parameters:
contextualParameters
- The contextual parameters- Returns:
- The root node
- Throws:
RepositoryException
- if an error occurred
-
_getOrCreateNode
protected ModifiableTraversableAmetysObject _getOrCreateNode(ModifiableTraversableAmetysObject parentNode, String nodeName, String nodeType) throws AmetysRepositoryException
Get a node or create it if not exist.- Parameters:
parentNode
- the parent nodenodeName
- the node namenodeType
- the node type- Returns:
- the node
- Throws:
AmetysRepositoryException
- if an error occurred
-
-