Package com.xpn.xwiki.plugin.tag
Class TagQueryUtils
- java.lang.Object
-
- com.xpn.xwiki.plugin.tag.TagQueryUtils
-
public final class TagQueryUtils extends Object
TagQueryUtils handles queries allowing to search and count tags within the wiki.- Since:
- 5.0M1
- Version:
- $Id: be454e07781d8fdbf9074c47ea4c887e209dd41c $
-
-
Field Summary
Fields Modifier and Type Field Description static StringHIDDEN_QUERYFILTER_HINTHint of the "hidden" QueryFilter.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<String>getAllTags(XWikiContext context)Get all tags within the wiki.static List<String>getDocumentsWithTag(String tag, boolean includeHiddenDocuments, XWikiContext context)Get documents with the passed tags with the result depending on whether the caller decides to include hidden documents or not.static List<String>getDocumentsWithTag(String tag, XWikiContext context)Get non-hidden documents with the passed tags.static Map<String,Integer>getTagCountForQuery(String fromHql, String whereHql, List<?> parameterValues, XWikiContext context)Get cardinality map of tags matching a parameterized hql query.static Map<String,Integer>getTagCountForQuery(String fromHql, String whereHql, Map<String,?> parameters, XWikiContext context)Get cardinality map of tags matching a parameterized hql query.
-
-
-
Field Detail
-
HIDDEN_QUERYFILTER_HINT
public static final String HIDDEN_QUERYFILTER_HINT
Hint of the "hidden" QueryFilter.- See Also:
- Constant Field Values
-
-
Method Detail
-
getAllTags
public static List<String> getAllTags(XWikiContext context) throws XWikiException
Get all tags within the wiki.- Parameters:
context- XWiki context.- Returns:
- list of tags (alphabetical order).
- Throws:
XWikiException- if search query fails (possible failures: DB access problems, etc).
-
getTagCountForQuery
public static Map<String,Integer> getTagCountForQuery(String fromHql, String whereHql, List<?> parameterValues, XWikiContext context) throws XWikiException
Get cardinality map of tags matching a parameterized hql query.- Parameters:
fromHql- thefromfragment of the hql querywhereHql- thewherefragment of the hql queryparameterValues- list of parameter values for the querycontext- XWiki context.- Returns:
- map of tags (alphabetical order) with their occurrences counts.
- Throws:
XWikiException- if search query fails (possible failures: DB access problems, etc).- Since:
- 1.18
- See Also:
TagPluginApi.getTagCountForQuery(String, String, java.util.List)
-
getTagCountForQuery
public static Map<String,Integer> getTagCountForQuery(String fromHql, String whereHql, Map<String,?> parameters, XWikiContext context) throws XWikiException
Get cardinality map of tags matching a parameterized hql query.- Parameters:
fromHql- thefromfragment of the hql querywhereHql- thewherefragment of the hql queryparameters- map of named parameters for the querycontext- XWiki context.- Returns:
- map of tags (alphabetical order) with their occurrences counts.
- Throws:
XWikiException- if search query fails (possible failures: DB access problems, etc).- Since:
- 11.7RC1
- See Also:
TagPluginApi.getTagCountForQuery(String, String, java.util.List)
-
getDocumentsWithTag
public static List<String> getDocumentsWithTag(String tag, XWikiContext context) throws XWikiException
Get non-hidden documents with the passed tags.- Parameters:
tag- a list of tags to match.context- XWiki context.- Returns:
- list of docNames.
- Throws:
XWikiException- if search query fails (possible failures: DB access problems, etc).
-
getDocumentsWithTag
public static List<String> getDocumentsWithTag(String tag, boolean includeHiddenDocuments, XWikiContext context) throws XWikiException
Get documents with the passed tags with the result depending on whether the caller decides to include hidden documents or not.- Parameters:
tag- a list of tags to match.includeHiddenDocuments- if true then include hidden documentscontext- XWiki context.- Returns:
- list of docNames.
- Throws:
XWikiException- if search query fails (possible failures: DB access problems, etc).- Since:
- 6.2M1
-
-