Constructor and Description |
---|
TagPluginApi(TagPlugin plugin,
XWikiContext context)
XWiki Plugin API constructor.
|
Modifier and Type | Method and Description |
---|---|
TagOperationResult |
addTagsToDocument(String tags,
String documentName)
Add a list of tags to a document.
|
TagOperationResult |
addTagToDocument(String tag,
String documentName)
Add a tag to a document.
|
TagOperationResult |
deleteTag(String tag)
Delete a tag from all the documents that contains it.
|
List<String> |
getAllTags()
Get tags within the wiki.
|
List<String> |
getDocumentsWithTag(String tag)
Get all the documents containing the given tag.
|
Map<String,Integer> |
getTagCount()
Get cardinality map of tags within the wiki.
|
Map<String,Integer> |
getTagCount(String space)
Get cardinality map of tags for a specific wiki space.
|
Map<String,Integer> |
getTagCountForQuery(String from,
String where)
Get cardinality map of tags matching an hql query.
|
Map<String,Integer> |
getTagCountForQuery(String from,
String where,
List<?> parameterValues)
Get cardinality map of tags matching an hql query (parameterized version).
|
Map<String,Integer> |
getTagCountForQuery(String from,
String where,
Map<String,?> parameters)
Get cardinality map of tags matching an hql query (parameterized version).
|
Map<String,Integer> |
getTagCountForSpaces(String spaces)
Get cardinality map of tags for list wiki spaces.
|
List<String> |
getTagsFromDocument(String documentName)
Get tags from a document.
|
TagOperationResult |
removeTagFromDocument(String tag,
String documentName)
Remove a tag from a document.
|
TagOperationResult |
renameTag(String tag,
String newTag)
Rename a tag in all the documents that contains it.
|
getInternalPlugin, getProtectedPlugin, setPlugin
convert, convert, convert, convertAttachments, getAuthorizationManager, getContextualAuthorizationManager, getXWikiContext, hasAccess, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights
public TagPluginApi(TagPlugin plugin, XWikiContext context)
plugin
- The wrapped plugin.context
- The current request context.PluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface, XWikiContext)
public List<String> getAllTags() throws XWikiException
XWikiException
- if search query fails (possible failures: DB access problems, etc).public Map<String,Integer> getTagCount() throws XWikiException
XWikiException
- if search query fails (possible failures: DB access problems, etc).public Map<String,Integer> getTagCount(String space) throws XWikiException
space
- the space to get tags inXWikiException
- if search query fails (possible failures: DB access problems, etc).public Map<String,Integer> getTagCountForSpaces(String spaces) throws XWikiException
spaces
- the list of space to get tags in, as a comma separated, quoted stringXWikiException
- if search query fails (possible failures: DB access problems, etc).public Map<String,Integer> getTagCountForQuery(String from, String where) throws XWikiException
$xwiki.tag.getTagCountForQuery("","doc.creator='XWiki.JohnDoe'")
will return the cardinality map of tags for documents created by user XWiki.JohnDoe
$xwiki.tag.getTagCountForQuery(", BaseObject as obj",
"obj.name=doc.fullName and obj.className='Blog.BlogPostClass'")
will return the cardinality map of tags associated to blog post documents
$xwiki.tag.getTagCountForQuery("", "")
will return all tags within the wikifrom
- the from fragment of the querywhere
- the where fragment from the queryXWikiException
- if search query fails (possible failures: DB access problems, incorrect query fragments).getTagCountForQuery(String, String, java.util.List)
public Map<String,Integer> getTagCountForQuery(String from, String where, List<?> parameterValues) throws XWikiException
$xwiki.tag.getTagCountForQuery("", "doc.creator = ?1", ["$!{request.creator}"])
will return the cardinality map of tags for documents created by user-provided creator namefrom
- the from fragment of the querywhere
- the parameterized where fragment from the queryparameterValues
- list of parameter values for the queryXWikiException
- if search query fails (possible failures: DB access problems, incorrect query fragments).public Map<String,Integer> getTagCountForQuery(String from, String where, Map<String,?> parameters) throws XWikiException
$xwiki.tag.getTagCountForQuery("", "doc.creator = :creator", {'creator' : "$!{request.creator}"})
will return the cardinality map of tags for documents created by user-provided creator namefrom
- the from fragment of the querywhere
- the parameterized where fragment from the queryparameters
- map of named parameters for the queryXWikiException
- if search query fails (possible failures: DB access problems, incorrect query fragments).public List<String> getDocumentsWithTag(String tag) throws XWikiException
tag
- tag to match.XWikiException
- if search query fails (possible failures: DB access problems, etc).public List<String> getTagsFromDocument(String documentName) throws XWikiException
documentName
- name of the document.XWikiException
- if document read fails (possible failures: insufficient rights, DB access problems, etc).public TagOperationResult addTagToDocument(String tag, String documentName)
tag
- tag to set.documentName
- name of the document.result
of the operationpublic TagOperationResult addTagsToDocument(String tags, String documentName)
tags
- the comma separated list of tags to set; whitespace around the tags is strippeddocumentName
- the name of the target documentresult
of the operation. TagOperationResult.NO_EFFECT
is returned
only if all the tags were already set on the document, TagOperationResult.OK
is returned even if
only some of the tags are new.public TagOperationResult removeTagFromDocument(String tag, String documentName)
tag
- tag to remove.documentName
- name of the document.result
of the operationpublic TagOperationResult renameTag(String tag, String newTag)
tag
- tag to rename.newTag
- new tag.result
of the operationpublic TagOperationResult deleteTag(String tag)
tag
- tag to delete.result
of the operationCopyright © 2004–2021 XWiki. All rights reserved.