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
DAO for manipulating tags
-
Field Summary
Modifier and TypeFieldDescriptionprotected I18nUtils
The I18n utilsprotected AbstractTagProviderExtensionPoint<? extends Tag>
The tag provider extension point -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
_getFilteredTagName
(TagProvider<? extends Tag> tagProvider, String tagName, Map<String, Object> otherParameters, Map<String, Object> contextualParameters) Get filtered tag nameprotected abstract AbstractJCRTagsDAO
Get the tag JCR DAO_tagsToJSON
(Collection<? extends Tag> tags) Get tags to json_tagToJSON
(JCRTag tag) JCR tag to jsonAdd tags from FOcheckTags
(List<String> tagNames, boolean onlyCustomTags, Map<String, Object> otherParameters, Map<String, Object> contextualParameters) Test if tags existsfilterTagsByRegExp
(String value, Map<String, Object> contextualParameters) Get the path of node which match filter regexpfilterTagsFromListByRegExp
(String filter, List<String> tagNames, Map<String, Object> contextualParameters) Get the path of node which match filter regexpprotected abstract List<TagProvider<? extends Tag>>
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
Get the path of a tag inside its provider.Get a tag by its nameGet the paths of given tagsabstract String
Get the tag provider extension point roleGet the title of given tagsvoid
service
(ServiceManager manager) Tag to jsonMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_tagProviderExtPt
The tag provider extension point -
_i18nUtils
The I18n utils
-
-
Constructor Details
-
AbstractTagsDAO
public AbstractTagsDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getTagProviderEPRole
Get the tag provider extension point role- Returns:
- the tag provider extension point role
-
getTagPaths
Get the paths of given tags- Parameters:
tagNames
- The name of tagscontextualParameters
- Contextual parameters- Returns:
- {String} path
-
getFullPath
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
Get a tag by its name- Parameters:
tagName
- The tag namecontextualParameters
- Contextual parameters- Returns:
- The tag or null if not found
-
getPath
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
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
-
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
Get the list of custom tag provider- Returns:
- the list of custom tag provider
-
addTags
Add tags from FO- Parameters:
tagNames
- The name of tags to add- Returns:
- The new tags descriptions
-
_getTagJCRDAO
Get the tag JCR DAO- Returns:
- the tag JCR DAO
-
_tagsToJSON
Get tags to json- Parameters:
tags
- the tags- Returns:
- the tags to json
-
_tagToJSON
JCR tag to json- Parameters:
tag
- the jcr tag- Returns:
- the jcr tag to json
-
tagToJSON
Tag to json- Parameters:
tag
- the tag- Returns:
- the tag to json
-