Package org.ametys.cms.tag
Class AbstractTagsDAO
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.cms.tag.AbstractTagsDAO
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
- Direct Known Subclasses:
CategoriesDAO
,KeywordsDAO
,ProjectTagsDAO
,TagsDAO
,ThemesDAO
public abstract class AbstractTagsDAO extends AbstractLogEnabled implements Serviceable, Component
DAO for manipulating tags
-
-
Field Summary
Fields Modifier and Type Field Description protected I18nUtils
_i18nUtils
The I18n utilsprotected AbstractTagProviderExtensionPoint<? extends Tag>
_tagProviderExtPt
The tag provider extension point
-
Constructor Summary
Constructors Constructor Description AbstractTagsDAO()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String
_getFilteredTagName(TagProvider<? extends Tag> tagProvider, String tagName, Map<String,Object> otherParameters, Map<String,Object> contextualParameters)
Get filtered tag nameprivate void
_getMatchingTag(String value, TagProvider<? extends Tag> tagProvider, Tag tag, List<String> matchingPaths)
Get paths of tag which match filter regexpList<String>
checkTags(List<String> tagNames, boolean onlyCustomTags, Map<String,Object> otherParameters, Map<String,Object> contextualParameters)
Test if tags existsList<String>
filterTagsByRegExp(String value, Map<String,Object> contextualParameters)
Get the path of node which match filter regexpList<String>
filterTagsFromListByRegExp(String filter, List<String> tagNames, Map<String,Object> contextualParameters)
Get the path of node which match filter regexpprotected abstract List<TagProvider<? extends Tag>>
getCustomTagProvider()
Get the list of custom tag providerprotected String
getFullPath(String tagName, Map<String,Object> contextualParameters)
Get the full path of a tag, with its providerprotected String
getPath(Tag tag)
Get the path of a tag inside its provider.Tag
getTag(String tagName, Map<String,Object> contextualParameters)
Get a tag by its nameList<String>
getTagPaths(List<String> tagNames, Map<String,Object> contextualParameters)
Get the paths of given tagsabstract String
getTagProviderEPRole()
Get the tag provider extension point roleMap<String,Object>
getTagsTitle(List<String> tagNames, Map<String,Object> contextualParameters)
Get the title of given tagsvoid
service(ServiceManager manager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_tagProviderExtPt
protected AbstractTagProviderExtensionPoint<? extends Tag> _tagProviderExtPt
The tag provider extension point
-
_i18nUtils
protected I18nUtils _i18nUtils
The I18n utils
-
-
Constructor Detail
-
AbstractTagsDAO
public AbstractTagsDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getTagProviderEPRole
public abstract String getTagProviderEPRole()
Get the tag provider extension point role- Returns:
- the tag provider extension point role
-
getTagPaths
public List<String> getTagPaths(List<String> tagNames, Map<String,Object> contextualParameters)
Get the paths of given tags- Parameters:
tagNames
- The name of tagscontextualParameters
- Contextual parameters- Returns:
- {String} path
-
getFullPath
protected String getFullPath(String tagName, Map<String,Object> contextualParameters)
Get the full path of a tag, with its provider- Parameters:
tagName
- The tag namecontextualParameters
- Contextual parameters- Returns:
- the full path of tag or null if not found
-
getTag
public Tag getTag(String tagName, Map<String,Object> contextualParameters)
Get a tag by its name- Parameters:
tagName
- The tag namecontextualParameters
- Contextual parameters- Returns:
- The tag or null if not found
-
getPath
protected String getPath(Tag tag)
Get the path of a tag inside its provider. The path is composed of tags name and '/' as a separator- Parameters:
tag
- The tag- Returns:
- The path
-
getTagsTitle
public Map<String,Object> getTagsTitle(List<String> tagNames, Map<String,Object> contextualParameters)
Get the title of given tags- Parameters:
tagNames
- The name of tagscontextualParameters
- Contextual parameters- Returns:
- the labels
-
filterTagsByRegExp
public List<String> filterTagsByRegExp(String value, Map<String,Object> contextualParameters)
Get the path of node which match filter regexp- Parameters:
value
- the value to matchcontextualParameters
- Contextual parameters- Returns:
- the matching paths
-
filterTagsFromListByRegExp
public List<String> filterTagsFromListByRegExp(String filter, List<String> tagNames, Map<String,Object> contextualParameters)
Get the path of node which match filter regexp- Parameters:
filter
- the value to matchtagNames
- the list of tag's name to search insidecontextualParameters
- Contextual parameters- Returns:
- the matching paths
-
_getMatchingTag
private void _getMatchingTag(String value, TagProvider<? extends Tag> tagProvider, Tag tag, List<String> matchingPaths)
Get paths of tag which match filter regexp- Parameters:
value
- the value to matchtagProvider
- the tag providertag
- the current tagmatchingPaths
- the matching paths
-
checkTags
public List<String> checkTags(List<String> tagNames, boolean onlyCustomTags, Map<String,Object> otherParameters, Map<String,Object> contextualParameters)
Test if tags exists- Parameters:
tagNames
- The tag names to testonlyCustomTags
- If true, return only custom tagsotherParameters
- the other parameterscontextualParameters
- Contextual parameters- Returns:
- The list of tag names without the invalid values.
-
_getFilteredTagName
protected String _getFilteredTagName(TagProvider<? extends Tag> tagProvider, String tagName, Map<String,Object> otherParameters, Map<String,Object> contextualParameters)
Get filtered tag name- Parameters:
tagProvider
- the tag providertagName
- the tag nameotherParameters
- the other parameterscontextualParameters
- the contextual parameters- Returns:
- the tag name if it match
-
getCustomTagProvider
protected abstract List<TagProvider<? extends Tag>> getCustomTagProvider()
Get the list of custom tag provider- Returns:
- the list of custom tag provider
-
-