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
Modifier and TypeFieldDescriptionprotected Context
The contextprotected static final String
The request attribute name with cache informationFields inherited from class org.ametys.cms.tag.AbstractTagProvider
_description, _featureName, _id, _label, _pluginName
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
_fillCache
(TraversableAmetysObject parentTagNode, T parentTag, Map<String, T> cache) Fill cacheGet 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 tagsReturns the provider's tag.Returns the provider's tags.boolean
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 Details
-
CACHE_REQUEST_ATTRIBUTE
The request attribute name with cache information -
_context
The context
-
-
Constructor Details
-
AbstractJCRTagProvider
public AbstractJCRTagProvider()
-
-
Method Details
-
configure
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractTagProvider<T extends Tag>
- Throws:
ConfigurationException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
_getCache
protected Map<String,T> _getCache(Map<String, Object> contextualParameters) throws RepositoryExceptionGet 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
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
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
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 RepositoryExceptionFill 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 RepositoryExceptionGet 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
-