Package org.alfresco.service.cmr.tagging
Interface TaggingService
- All Known Implementing Classes:
TaggingServiceImpl
@AlfrescoPublicApi
public interface TaggingService
Tagging Service Interface
- Author:
- Roy Wetherall
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionAdd a tag to a node.Adds a list of tags to a node.voidaddTagScope(NodeRef nodeRef) Adds a tag scope to the specified nodecalculateCount(StoreRef storeRef) voidClears all tags from an already tagged node.Create a new tagcreateTags(StoreRef storeRef, List<String> tagNames) Creates orphan tags.voidDelete an existing tag and any references to it(cascade delete).findAllTagScopes(NodeRef nodeRef) Finds all the tag scopes for the specified node.longfindCountByTagName(StoreRef storeRef, String name) Get the number of tagged nodes for a given tag.findTaggedNodes(StoreRef storeRef, String tag) Find all nodes that have been tagged with the specified tag.findTaggedNodes(StoreRef storeRef, String tag, NodeRef nodeRef) Find all nodes that have been tagged with the specified tag and reside within the context of the node reference provided.findTaggedNodesAndCountByTagName(StoreRef storeRef) Get tagged nodes and count of nodes group by tag namefindTagScope(NodeRef nodeRef) Finds the 'nearest' tag scope for the specified node.getPagedTags(StoreRef storeRef, int fromTag, int pageSize) Get page of the tags currently availablegetPagedTags(StoreRef storeRef, String filter, int fromTag, int pageSize) getTagName(NodeRef nodeRef) getTagNodeRef(StoreRef storeRef, String tag) Gets the node reference for a given tag.Get all the tags on a nodeGet a paged list of all the tags on a nodeGet all the tags currently availableGet all the tags currently available that match the provided filter.getTags(StoreRef storeRef, List<String> parameterIncludes, Pair<String, Boolean> sorting, Collection<String> exactNamesFilter, Collection<String> alikeNamesFilter) Get a map of tag NodeRefs and their respective usage count filtered by name and sorted by tag name or countGet a paged list of all the tags currently availablegetTags(StoreRef storeRef, org.alfresco.query.PagingRequest pagingRequest, Collection<String> exactNamesFilter, Collection<String> alikeNamesFilter) Get a paged list of tags filtered by namebooleanIndicates whether a node has the specified tag or not.booleanIndicates whether the tag already existsbooleanisTagScope(NodeRef nodeRef) Indicates whether the node reference is a tag scopevoidrefreshTagScope(NodeRef nodeRef, boolean async) Refreshes the tag count of the passed tag scope by recounting all the tags of the children of the scope.voidRemove a tag from a node.voidremoveTags(NodeRef nodeRef, List<String> tags) Removes a list of tags from a node.voidremoveTagScope(NodeRef nodeRef) Removes a tag scope from a specified node.voidSets the list of tags that are applied to a node, replaces any existing tags with those provided.
-
Field Details
-
TAG_ROOT_NODE_REF
-
-
Method Details
-
isTag
Indicates whether the tag already exists- Parameters:
storeRef- store referencetag- tag name- Returns:
- boolean true if the tag exists, false otherwise
-
getTagName
-
getTags
Get all the tags currently available- Returns:
- list of tags
-
getTags
@NotAuditable org.alfresco.query.PagingResults<Pair<NodeRef,String>> getTags(StoreRef storeRef, org.alfresco.query.PagingRequest pagingRequest) Get a paged list of all the tags currently available- Parameters:
storeRef- StoreRefpagingRequest- PagingRequest- Returns:
- PagingResults
-
getTags
@NotAuditable default org.alfresco.query.PagingResults<Pair<NodeRef,String>> getTags(StoreRef storeRef, org.alfresco.query.PagingRequest pagingRequest, Collection<String> exactNamesFilter, Collection<String> alikeNamesFilter) Get a paged list of tags filtered by name- Parameters:
storeRef- StoreRefpagingRequest- PagingRequestexactNamesFilter- PagingRequestalikeNamesFilter- PagingRequest- Returns:
- PagingResults
-
getTags
Map<NodeRef,Long> getTags(StoreRef storeRef, List<String> parameterIncludes, Pair<String, Boolean> sorting, Collection<String> exactNamesFilter, Collection<String> alikeNamesFilter) Get a map of tag NodeRefs and their respective usage count filtered by name and sorted by tag name or count- Parameters:
storeRef-parameterIncludes-sorting-exactNamesFilter-alikeNamesFilter-- Returns:
-
getTags
Get all the tags currently available that match the provided filter.- Parameters:
storeRef- store referencefilter- tag filter- Returns:
- list of tags
-
createTag
Create a new tag- Parameters:
storeRef- store referencetag- tag name
-
deleteTag
Delete an existing tag and any references to it(cascade delete).- Parameters:
storeRef- store referencetag- tag name
-
changeTag
@Auditable(parameters={"existingTag","newTag"}) NodeRef changeTag(StoreRef storeRef, String existingTag, String newTag) -
hasTag
Indicates whether a node has the specified tag or not.- Parameters:
nodeRef- node referencetag- tag name- Returns:
- boolean true if the node has the tag, false otherwise
-
addTag
Add a tag to a node. Creating the tag if it does not already exist.- Parameters:
nodeRef- node referencetag- tag name
-
getTagNodeRef
Gets the node reference for a given tag.Returns null if tag is not present.
- Parameters:
storeRef- store referencetag- tag- Returns:
- NodeRef tag node reference or null not exist
-
addTags
@Auditable(parameters="tags") List<Pair<String,NodeRef>> addTags(NodeRef nodeRef, List<String> tags) Adds a list of tags to a node.Tags are created if they do not exist.
- Parameters:
nodeRef- node referencetags- list of tags
-
removeTag
Remove a tag from a node.- Parameters:
nodeRef- node referencetag- tag name
-
removeTags
Removes a list of tags from a node.- Parameters:
nodeRef- node referencetags- list of tags
-
getTags
Get all the tags on a node- Parameters:
nodeRef- node reference- Returns:
- list of tags on the node
-
getTags
@NotAuditable org.alfresco.query.PagingResults<Pair<NodeRef,String>> getTags(NodeRef nodeRef, org.alfresco.query.PagingRequest pagingRequest) Get a paged list of all the tags on a node- Parameters:
nodeRef- node reference- Returns:
- list of tags on the node
-
setTags
Sets the list of tags that are applied to a node, replaces any existing tags with those provided.- Parameters:
nodeRef- node referencetags- list of tags
-
clearTags
Clears all tags from an already tagged node.- Parameters:
nodeRef- node reference
-
isTagScope
Indicates whether the node reference is a tag scope- Parameters:
nodeRef- node reference- Returns:
- boolean true if node is a tag scope, false otherwise
-
addTagScope
Adds a tag scope to the specified node- Parameters:
nodeRef- node reference
-
refreshTagScope
Refreshes the tag count of the passed tag scope by recounting all the tags of the children of the scope.- Parameters:
nodeRef- tag scope node referenceasync- indicates whether the tag scope refresh should happen asynchronously or not
-
removeTagScope
Removes a tag scope from a specified node. Note that any tag count information will be lost when the scope if removed.- Parameters:
nodeRef- node reference
-
findTagScope
Finds the 'nearest' tag scope for the specified node.The 'nearest' tag scope is discovered by walking up the primary parent path until a tag scope is found or the root node is reached.
If no tag scope if found then a null value is returned.
- Parameters:
nodeRef- node reference- Returns:
- the 'nearest' tag scope or null if none found
-
findAllTagScopes
Finds all the tag scopes for the specified node.The resulting list of tag scopes is ordered with the 'nearest' at the bedining of the list.
If no tag scopes are found an empty list is returned.
- Parameters:
nodeRef- node reference- Returns:
- list of tag scopes
-
findTaggedNodes
Find all nodes that have been tagged with the specified tag.- Parameters:
tag- tag name- Returns:
- list of nodes tagged with specified tag, empty of none found
-
findTaggedNodes
Find all nodes that have been tagged with the specified tag and reside within the context of the node reference provided.- Parameters:
tag- tag namenodeRef- node providing context for the search- Returns:
- list of nodes tagged in the context specified, empty if none found
-
getPagedTags
Get page of the tags currently available- Parameters:
storeRef- node referencefromTag- offsetpageSize- page size- Returns:
- pair of tag names and total count
-
getPagedTags
@NotAuditable Pair<List<String>,Integer> getPagedTags(StoreRef storeRef, String filter, int fromTag, int pageSize) - Parameters:
storeRef- node referencefilter- tag filterfromTag- page offsetpageSize- page size- Returns:
- pair of tag names and total count
-
findTaggedNodesAndCountByTagName
Get tagged nodes and count of nodes group by tag name- Parameters:
storeRef-- Returns:
-
findCountByTagName
Get the number of tagged nodes for a given tag.- Parameters:
storeRef- The store containing the nodes.name- The name of the tag.- Returns:
- The number of nodes tagged with the specified tag.
-
createTags
@Auditable(parameters="tagNames") default List<Pair<String,NodeRef>> createTags(StoreRef storeRef, List<String> tagNames) Creates orphan tags. Tag names case will be lowered.- Parameters:
storeRef- Reference to node store.tagNames- List of tag names.- Returns:
ListofPairs of tag names and node references.- Throws:
DuplicateChildNodeNameException- if tag already exists.
-
calculateCount
- Parameters:
storeRef-- Returns:
- a map with each tag name and its usage count
-