Interface TaggingService

All Known Implementing Classes:
TaggingServiceImpl

@AlfrescoPublicApi public interface TaggingService
Tagging Service Interface
Author:
Roy Wetherall
  • Field Details

    • TAG_ROOT_NODE_REF

      static final NodeRef TAG_ROOT_NODE_REF
  • Method Details

    • isTag

      @NotAuditable boolean isTag(StoreRef storeRef, String tag)
      Indicates whether the tag already exists
      Parameters:
      storeRef - store reference
      tag - tag name
      Returns:
      boolean true if the tag exists, false otherwise
    • getTagName

      String getTagName(NodeRef nodeRef)
    • getTags

      @NotAuditable List<String> getTags(StoreRef storeRef)
      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 - StoreRef
      pagingRequest - 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 - StoreRef
      pagingRequest - PagingRequest
      exactNamesFilter - PagingRequest
      alikeNamesFilter - 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

      @NotAuditable List<String> getTags(StoreRef storeRef, String filter)
      Get all the tags currently available that match the provided filter.
      Parameters:
      storeRef - store reference
      filter - tag filter
      Returns:
      list of tags
    • createTag

      @Auditable(parameters="tag") NodeRef createTag(StoreRef storeRef, String tag)
      Create a new tag
      Parameters:
      storeRef - store reference
      tag - tag name
    • deleteTag

      @Auditable(parameters="tag") void deleteTag(StoreRef storeRef, String tag)
      Delete an existing tag and any references to it(cascade delete).
      Parameters:
      storeRef - store reference
      tag - tag name
    • changeTag

      @Auditable(parameters={"existingTag","newTag"}) NodeRef changeTag(StoreRef storeRef, String existingTag, String newTag)
    • hasTag

      @Auditable(parameters="tag") boolean hasTag(NodeRef nodeRef, String tag)
      Indicates whether a node has the specified tag or not.
      Parameters:
      nodeRef - node reference
      tag - tag name
      Returns:
      boolean true if the node has the tag, false otherwise
    • addTag

      @Auditable(parameters="tag") NodeRef addTag(NodeRef nodeRef, String tag)
      Add a tag to a node. Creating the tag if it does not already exist.
      Parameters:
      nodeRef - node reference
      tag - tag name
    • getTagNodeRef

      @NotAuditable NodeRef getTagNodeRef(StoreRef storeRef, String tag)
      Gets the node reference for a given tag.

      Returns null if tag is not present.

      Parameters:
      storeRef - store reference
      tag - 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 reference
      tags - list of tags
    • removeTag

      @Auditable(parameters="tag") void removeTag(NodeRef nodeRef, String tag)
      Remove a tag from a node.
      Parameters:
      nodeRef - node reference
      tag - tag name
    • removeTags

      @Auditable(parameters="tags") void removeTags(NodeRef nodeRef, List<String> tags)
      Removes a list of tags from a node.
      Parameters:
      nodeRef - node reference
      tags - list of tags
    • getTags

      @NotAuditable List<String> getTags(NodeRef nodeRef)
      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

      @Auditable(parameters="tags") void setTags(NodeRef nodeRef, List<String> tags)
      Sets the list of tags that are applied to a node, replaces any existing tags with those provided.
      Parameters:
      nodeRef - node reference
      tags - list of tags
    • clearTags

      @Auditable void clearTags(NodeRef nodeRef)
      Clears all tags from an already tagged node.
      Parameters:
      nodeRef - node reference
    • isTagScope

      @NotAuditable boolean isTagScope(NodeRef nodeRef)
      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

      @Auditable void addTagScope(NodeRef nodeRef)
      Adds a tag scope to the specified node
      Parameters:
      nodeRef - node reference
    • refreshTagScope

      @Auditable void refreshTagScope(NodeRef nodeRef, boolean async)
      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 reference
      async - indicates whether the tag scope refresh should happen asynchronously or not
    • removeTagScope

      @Auditable void removeTagScope(NodeRef nodeRef)
      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

      @NotAuditable TagScope findTagScope(NodeRef nodeRef)
      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

      @NotAuditable List<TagScope> findAllTagScopes(NodeRef nodeRef)
      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

      @NotAuditable List<NodeRef> findTaggedNodes(StoreRef storeRef, String tag)
      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

      @NotAuditable List<NodeRef> 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.
      Parameters:
      tag - tag name
      nodeRef - node providing context for the search
      Returns:
      list of nodes tagged in the context specified, empty if none found
    • getPagedTags

      @NotAuditable Pair<List<String>,Integer> getPagedTags(StoreRef storeRef, int fromTag, int pageSize)
      Get page of the tags currently available
      Parameters:
      storeRef - node reference
      fromTag - offset
      pageSize - 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 reference
      filter - tag filter
      fromTag - page offset
      pageSize - page size
      Returns:
      pair of tag names and total count
    • findTaggedNodesAndCountByTagName

      @NotAuditable List<Pair<String,Integer>> findTaggedNodesAndCountByTagName(StoreRef storeRef)
      Get tagged nodes and count of nodes group by tag name
      Parameters:
      storeRef -
      Returns:
    • findCountByTagName

      @NotAuditable long findCountByTagName(StoreRef storeRef, String name)
      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:
      List of Pairs of tag names and node references.
      Throws:
      DuplicateChildNodeNameException - if tag already exists.
    • calculateCount

      Map<String,Long> calculateCount(StoreRef storeRef)
      Parameters:
      storeRef -
      Returns:
      a map with each tag name and its usage count