org.alfresco.repo.tagging
Class TaggingServiceImpl

java.lang.Object
  extended by org.alfresco.repo.tagging.TaggingServiceImpl
All Implemented Interfaces:
NodeServicePolicies.BeforeDeleteNodePolicy, ClassPolicy, Policy, TransactionListener, TaggingService

public class TaggingServiceImpl
extends java.lang.Object
implements TaggingService, TransactionListener, NodeServicePolicies.BeforeDeleteNodePolicy

Tagging service implementation


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg
 
Field Summary
static java.lang.String TAG_UPDATES
           
 
Fields inherited from interface org.alfresco.repo.policy.Policy
NAMESPACE
 
Constructor Summary
TaggingServiceImpl()
           
 
Method Summary
 void addTag(NodeRef nodeRef, java.lang.String tagName)
          Add a tag to a node.
 void addTags(NodeRef nodeRef, java.util.List tags)
          Adds a list of tags to a node.
 void addTagScope(NodeRef nodeRef)
          Adds a tag scope to the specified node
 void afterCommit()
          Invoked after transaction commit.
 void afterRollback()
          Invoked after transaction rollback.
 void beforeCommit(boolean readOnly)
          Called before a transaction is committed.
 void beforeCompletion()
          Invoked before transaction commit/rollback.
 void beforeDeleteNode(NodeRef nodeRef)
          Called before a node is deleted.
 void clearTags(NodeRef nodeRef)
          Clears all tags from an already tagged node.
 void createTag(StoreRef storeRef, java.lang.String tag)
          Create a new tag
 void deleteTag(StoreRef storeRef, java.lang.String tag)
          Delete an existing tag
 java.util.List findAllTagScopes(NodeRef nodeRef)
          Finds all the tag scopes for the specified node.
 java.util.List findTaggedNodes(StoreRef storeRef, java.lang.String tag)
          Find all nodes that have been tagged with the specified tag.
 java.util.List findTaggedNodes(StoreRef storeRef, java.lang.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.
 TagScope findTagScope(NodeRef nodeRef)
          Finds the 'nearest' tag scope for the specified node.
 void flush()
           
 java.util.List getTags(NodeRef nodeRef)
          Get all the tags on a node
 java.util.List getTags(StoreRef storeRef)
          Get all the tags currently available
 java.util.List getTags(StoreRef storeRef, java.lang.String filter)
          Get all the tags currently available that match the provided filter.
 void init()
          Init method
 boolean isTag(StoreRef storeRef, java.lang.String tag)
          Indicates whether the tag already exists
 boolean isTagScope(NodeRef nodeRef)
          Indicates whether the node reference is a tag scope
 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.
 void removeTag(NodeRef nodeRef, java.lang.String tag)
          Remove a tag from a node.
 void removeTags(NodeRef nodeRef, java.util.List tags)
          Removes a list of tags from a node.
 void removeTagScope(NodeRef nodeRef)
          Removes a tag scope from a specified node.
 void setActionService(ActionService actionService)
          Set the action service
 void setCategoryService(CategoryService categoryService)
          Set the cateogry service
 void setContentService(ContentService contentService)
          Set the content service
 void setNamespaceService(NamespaceService namespaceService)
          Set the namespace service
 void setNodeService(NodeService nodeService)
          Set the node service
 void setPolicyComponent(PolicyComponent policyComponent)
          Policy component
 void setSearchService(SearchService searchService)
          Set the search service
 void setTags(NodeRef nodeRef, java.util.List tags)
          Sets the list of tags that are applied to a node, replaces any existing tags with those provided.
 void setTransactionService(TransactionService transactionService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG_UPDATES

public static final java.lang.String TAG_UPDATES
See Also:
Constant Field Values
Constructor Detail

TaggingServiceImpl

public TaggingServiceImpl()
Method Detail

setCategoryService

public void setCategoryService(CategoryService categoryService)
Set the cateogry service

Parameters:
categoryService - trhe category service

setNodeService

public void setNodeService(NodeService nodeService)
Set the node service

Parameters:
nodeService - the node service

setSearchService

public void setSearchService(SearchService searchService)
Set the search service

Parameters:
searchService - the search service

setActionService

public void setActionService(ActionService actionService)
Set the action service


setContentService

public void setContentService(ContentService contentService)
Set the content service

Parameters:
contentService - content service

setNamespaceService

public void setNamespaceService(NamespaceService namespaceService)
Set the namespace service

Parameters:
namespaceService - namespace service

setPolicyComponent

public void setPolicyComponent(PolicyComponent policyComponent)
Policy component

Parameters:
policyComponent -

setTransactionService

public void setTransactionService(TransactionService transactionService)

init

public void init()
Init method


beforeDeleteNode

public void beforeDeleteNode(NodeRef nodeRef)
Description copied from interface: NodeServicePolicies.BeforeDeleteNodePolicy
Called before a node is deleted.

Specified by:
beforeDeleteNode in interface NodeServicePolicies.BeforeDeleteNodePolicy
Parameters:
nodeRef - the node reference
See Also:
NodeServicePolicies.BeforeDeleteNodePolicy.beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)

isTag

public boolean isTag(StoreRef storeRef,
                     java.lang.String tag)
Description copied from interface: TaggingService
Indicates whether the tag already exists

Specified by:
isTag in interface TaggingService
Parameters:
storeRef - store reference
tag - tag name
Returns:
boolean true if the tag exists, false otherwise
See Also:
org.alfresco.service.cmr.tagging.TaggingService#isTag(java.lang.String)

createTag

public void createTag(StoreRef storeRef,
                      java.lang.String tag)
Description copied from interface: TaggingService
Create a new tag

Specified by:
createTag in interface TaggingService
Parameters:
storeRef - store reference
tag - tag name
See Also:
org.alfresco.service.cmr.tagging.TaggingService#createTag(java.lang.String)

deleteTag

public void deleteTag(StoreRef storeRef,
                      java.lang.String tag)
Description copied from interface: TaggingService
Delete an existing tag

Specified by:
deleteTag in interface TaggingService
Parameters:
storeRef - store reference
tag - tag name
See Also:
TaggingService.deleteTag(org.alfresco.service.cmr.repository.StoreRef, java.lang.String)

getTags

public java.util.List getTags(StoreRef storeRef)
Description copied from interface: TaggingService
Get all the tags currently available

Specified by:
getTags in interface TaggingService
Returns:
List list of tags
See Also:
org.alfresco.service.cmr.tagging.TaggingService#getTags()

getTags

public java.util.List getTags(StoreRef storeRef,
                              java.lang.String filter)
Description copied from interface: TaggingService
Get all the tags currently available that match the provided filter.

Specified by:
getTags in interface TaggingService
Parameters:
storeRef - store reference
filter - tag filter
Returns:
List list of tags
See Also:
TaggingService.getTags(org.alfresco.service.cmr.repository.StoreRef, java.lang.String)

addTag

public void addTag(NodeRef nodeRef,
                   java.lang.String tagName)
Description copied from interface: TaggingService
Add a tag to a node. Creating the tag if it does not already exist.

Specified by:
addTag in interface TaggingService
Parameters:
nodeRef - node reference
tagName - tag name
See Also:
TaggingService.addTag(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)

addTags

public void addTags(NodeRef nodeRef,
                    java.util.List tags)
Description copied from interface: TaggingService
Adds a list of tags to a node.

Tags are created if they do not exist.

Specified by:
addTags in interface TaggingService
Parameters:
nodeRef - node reference
tags - list of tags
See Also:
TaggingService.addTags(org.alfresco.service.cmr.repository.NodeRef, java.util.List)

removeTag

public void removeTag(NodeRef nodeRef,
                      java.lang.String tag)
Description copied from interface: TaggingService
Remove a tag from a node.

Specified by:
removeTag in interface TaggingService
Parameters:
nodeRef - node reference
tag - tag name
See Also:
TaggingService.removeTag(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)

removeTags

public void removeTags(NodeRef nodeRef,
                       java.util.List tags)
Description copied from interface: TaggingService
Removes a list of tags from a node.

Specified by:
removeTags in interface TaggingService
Parameters:
nodeRef - node reference
tags - list of tags
See Also:
TaggingService.removeTags(org.alfresco.service.cmr.repository.NodeRef, java.util.List)

getTags

public java.util.List getTags(NodeRef nodeRef)
Description copied from interface: TaggingService
Get all the tags on a node

Specified by:
getTags in interface TaggingService
Parameters:
nodeRef - node reference
Returns:
List list of tags on the node
See Also:
TaggingService.getTags(org.alfresco.service.cmr.repository.NodeRef)

setTags

public void setTags(NodeRef nodeRef,
                    java.util.List tags)
Description copied from interface: TaggingService
Sets the list of tags that are applied to a node, replaces any existing tags with those provided.

Specified by:
setTags in interface TaggingService
Parameters:
nodeRef - node reference
tags - list of tags
See Also:
TaggingService.setTags(org.alfresco.service.cmr.repository.NodeRef, java.util.List)

clearTags

public void clearTags(NodeRef nodeRef)
Description copied from interface: TaggingService
Clears all tags from an already tagged node.

Specified by:
clearTags in interface TaggingService
Parameters:
nodeRef - node reference
See Also:
TaggingService.clearTags(org.alfresco.service.cmr.repository.NodeRef)

isTagScope

public boolean isTagScope(NodeRef nodeRef)
Description copied from interface: TaggingService
Indicates whether the node reference is a tag scope

Specified by:
isTagScope in interface TaggingService
Parameters:
nodeRef - node reference
Returns:
boolean true if node is a tag scope, false otherwise
See Also:
TaggingService.isTagScope(org.alfresco.service.cmr.repository.NodeRef)

addTagScope

public void addTagScope(NodeRef nodeRef)
Description copied from interface: TaggingService
Adds a tag scope to the specified node

Specified by:
addTagScope in interface TaggingService
Parameters:
nodeRef - node reference
See Also:
TaggingService.addTagScope(org.alfresco.service.cmr.repository.NodeRef)

refreshTagScope

public void refreshTagScope(NodeRef nodeRef,
                            boolean async)
Description copied from interface: TaggingService
Refreshes the tag count of the passed tag scope by recounting all the tags of the children of the scope.

Specified by:
refreshTagScope in interface TaggingService
Parameters:
nodeRef - tag scope node reference
async - indicates whether the tag scope refresh should happen asynchronously or not
See Also:
org.alfresco.service.cmr.tagging.TaggingService#refreshTagScopt(org.alfresco.service.cmr.repository.NodeRef, boolean)

removeTagScope

public void removeTagScope(NodeRef nodeRef)
Description copied from interface: TaggingService
Removes a tag scope from a specified node. Note that any tag count information will be lost when the scope if removed.

Specified by:
removeTagScope in interface TaggingService
Parameters:
nodeRef - node reference
See Also:
TaggingService.removeTagScope(org.alfresco.service.cmr.repository.NodeRef)

findTagScope

public TagScope findTagScope(NodeRef nodeRef)
Description copied from interface: TaggingService
Finds the 'nearest' tag scope for the specified node.

The 'nearest' tag scope is discovered by walking up the primary parent path untill a tag scope is found or the root node is reached.

If no tag scope if found then a null value is returned.

Specified by:
findTagScope in interface TaggingService
Parameters:
nodeRef - node reference
Returns:
the 'nearest' tag scope or null if none found
See Also:
TaggingService.findTagScope(org.alfresco.service.cmr.repository.NodeRef)

findAllTagScopes

public java.util.List findAllTagScopes(NodeRef nodeRef)
Description copied from interface: TaggingService
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.

Specified by:
findAllTagScopes in interface TaggingService
Parameters:
nodeRef - node reference
Returns:
List list of tag scopes
See Also:
TaggingService.findAllTagScopes(org.alfresco.service.cmr.repository.NodeRef)

findTaggedNodes

public java.util.List findTaggedNodes(StoreRef storeRef,
                                      java.lang.String tag)
Description copied from interface: TaggingService
Find all nodes that have been tagged with the specified tag.

Specified by:
findTaggedNodes in interface TaggingService
tag - tag name
Returns:
List list of nodes tagged with specified tag, empty of none found
See Also:
org.alfresco.service.cmr.tagging.TaggingService#findTaggedNodes(java.lang.String)

findTaggedNodes

public java.util.List findTaggedNodes(StoreRef storeRef,
                                      java.lang.String tag,
                                      NodeRef nodeRef)
Description copied from interface: TaggingService
Find all nodes that have been tagged with the specified tag and reside within the context of the node reference provided.

Specified by:
findTaggedNodes in interface TaggingService
tag - tag name
nodeRef - node providing context for the search
Returns:
List list of nodes tagged in the context specified, empty if none found
See Also:
org.alfresco.service.cmr.tagging.TaggingService#findTaggedNodes(java.lang.String, org.alfresco.service.cmr.repository.NodeRef)

afterCommit

public void afterCommit()
Description copied from interface: TransactionListener
Invoked after transaction commit.

Any exceptions generated here will cause the transaction to rollback.

Although all transaction resources are still available, this method should be used only for cleaning up resources after a commit has occured.

Specified by:
afterCommit in interface TransactionListener
See Also:
TransactionListener.afterCommit()

afterRollback

public void afterRollback()
Description copied from interface: TransactionListener
Invoked after transaction rollback.

Although all transaction resources are still available, this method should be used only for cleaning up resources after a rollback has occured.

Specified by:
afterRollback in interface TransactionListener
See Also:
TransactionListener.afterRollback()

beforeCommit

public void beforeCommit(boolean readOnly)
Description copied from interface: TransactionListener
Called before a transaction is committed.

All transaction resources are still available.

Specified by:
beforeCommit in interface TransactionListener
Parameters:
readOnly - true if the transaction is read-only
See Also:
TransactionListener.beforeCommit(boolean)

beforeCompletion

public void beforeCompletion()
Description copied from interface: TransactionListener
Invoked before transaction commit/rollback. Will be called after TransactionListener.beforeCommit(boolean) even if TransactionListener.beforeCommit(boolean) failed.

Any exceptions generated here will only be logged and will have no effect on the state of the transaction.

All transaction resources are still available.

Specified by:
beforeCompletion in interface TransactionListener
See Also:
TransactionListener.beforeCompletion()

flush

public void flush()
Specified by:
flush in interface TransactionListener
See Also:
TransactionListener.flush()


Copyright © 2005 - 2008 Alfresco Software, Inc. All Rights Reserved.