org.wso2.carbon.registry.core.dao
Interface TagsDAO

All Known Implementing Classes:
JDBCTagsDAO, JDBCTagsVersionDAO

public interface TagsDAO

Data Access Object for Tags


Method Summary
 void addTagging(String tagName, ResourceImpl resource, String userID)
          Method to persist a tag.
 void addTaggings(ResourceImpl resource, TaggingDO[] taggingDOs)
          Method to persist tags.
 void copyTags(ResourceImpl fromResource, ResourceImpl toResource)
          Method to copy tags.
 List getPathsWithAnyTag(String[] tags)
          Method to obtain the list of paths having any of the given tags.
 ResourceImpl getResourceWithMinimumData(String path)
          Gets the resource with sufficient data to differentiate it from another resource.
 long getTagCount(ResourceImpl resourceImpl, String tag)
          Method to get the number of tags added to the given resource, by the given name.
 List<TaggingDO> getTagDOs(ResourceImpl resourceImpl)
          Method to get the data objects of tags added to the given resource.
 TaggingDO getTagging(long taggingID)
          Method to get a tagging by the given id.
 TaggingDO[] getTagging(ResourceImpl resource)
          Method to get all taggings added to a given resource.
 TaggingDO[] getTagging(ResourceImpl resource, String tag, String userID)
          Method to get a tagging added to a given resource by the given user.
 String[] getTags(ResourceImpl resourceImpl)
          Method to get the names of tags added to the given resource.
 Tag[] getTagsWithCount(ResourceImpl resourceImpl)
          Method to get tags added to the given resource, along with the count.
 void moveTagPaths(ResourceIDImpl source, ResourceIDImpl target)
          Method to move tag paths.
 void moveTags(ResourceIDImpl source, ResourceIDImpl target)
          Method to move tags.
 void removeTags(ResourceImpl resource)
          Removes all tags added to the given resource by user with the given id.
 void removeTags(ResourceImpl resource, String tag)
          Removes a tag by the given name added to the given resource by any user.
 void removeTags(ResourceImpl resource, String tag, String userID)
          Removes a tag by the given name added to the given resource by user with the given id.
 void removeVersionTags(long regVersion)
          Removes all tags added to the given resource of a given version.
 boolean taggingExists(String tagName, ResourceImpl resourceImpl, String userID)
          Method to determine whether the given tag exists.
 

Method Detail

addTagging

void addTagging(String tagName,
                ResourceImpl resource,
                String userID)
                throws RegistryException
Method to persist a tag.

Parameters:
resource - the resource
userID - the id of the user who added the tag.
tagName - the name of tag to be persisted.
Throws:
RegistryException - if some error occurs while adding a tag

addTaggings

void addTaggings(ResourceImpl resource,
                 TaggingDO[] taggingDOs)
                 throws RegistryException
Method to persist tags.

Parameters:
resource - the resource
taggingDOs - the tags to be persisted.
Throws:
RegistryException - if some error occurs while adding tags

copyTags

void copyTags(ResourceImpl fromResource,
              ResourceImpl toResource)
              throws RegistryException
Method to copy tags.

Parameters:
fromResource - the source resource.
toResource - the target resource.
Throws:
RegistryException - if some error occurs while copying tags

taggingExists

boolean taggingExists(String tagName,
                      ResourceImpl resourceImpl,
                      String userID)
                      throws RegistryException
Method to determine whether the given tag exists.

Parameters:
resourceImpl - the resource
userID - the id of the user who added the tag.
tagName - the name of tag to be persisted.
Returns:
whether the given tag exists.
Throws:
RegistryException - if some error occurs while checking whether a tag exists.

removeTags

void removeTags(ResourceImpl resource,
                String tag)
                throws RegistryException
Removes a tag by the given name added to the given resource by any user.

Parameters:
resource - the resource
tag - the name of tag to be persisted.
Throws:
RegistryException - if an error occurred while removing the tag.

removeTags

void removeTags(ResourceImpl resource,
                String tag,
                String userID)
                throws RegistryException
Removes a tag by the given name added to the given resource by user with the given id.

Parameters:
resource - the resource
tag - the name of tag to be persisted.
userID - the id of the user who added the tag.
Throws:
RegistryException - if an error occurred while removing the tag.

removeTags

void removeTags(ResourceImpl resource)
                throws RegistryException
Removes all tags added to the given resource by user with the given id.

Parameters:
resource - the resource
Throws:
RegistryException - if an error occurred while removing tags.

removeVersionTags

void removeVersionTags(long regVersion)
                       throws RegistryException
Removes all tags added to the given resource of a given version. This applies only to versioned resources.

Parameters:
regVersion - the version
Throws:
RegistryException - if an error occurred while removing tags.

getTags

String[] getTags(ResourceImpl resourceImpl)
                 throws RegistryException
Method to get the names of tags added to the given resource.

Parameters:
resourceImpl - the resource.
Returns:
array of tag names.
Throws:
RegistryException - if an error occurs while getting the tag names.

getTagDOs

List<TaggingDO> getTagDOs(ResourceImpl resourceImpl)
                          throws RegistryException
Method to get the data objects of tags added to the given resource.

Parameters:
resourceImpl - the resource.
Returns:
list of tagging data objects.
Throws:
RegistryException - if an error occurs while getting the tagging data objects.

getPathsWithAnyTag

List getPathsWithAnyTag(String[] tags)
                        throws RegistryException
Method to obtain the list of paths having any of the given tags.

Parameters:
tags - the tags.
Returns:
a list of paths.
Throws:
RegistryException - if an error occurs.

getTagCount

long getTagCount(ResourceImpl resourceImpl,
                 String tag)
                 throws RegistryException
Method to get the number of tags added to the given resource, by the given name.

Parameters:
resourceImpl - the resource.
tag - the tag name
Returns:
the number of tags.
Throws:
RegistryException - if an error occurred while getting the number of tags.

getTagsWithCount

Tag[] getTagsWithCount(ResourceImpl resourceImpl)
                       throws RegistryException
Method to get tags added to the given resource, along with the count.

Parameters:
resourceImpl - the resource.
Returns:
an array of tags (with counts).
Throws:
RegistryException - if an error occurred while getting tags.

getTagging

TaggingDO[] getTagging(ResourceImpl resource,
                       String tag,
                       String userID)
                       throws RegistryException
Method to get a tagging added to a given resource by the given user.

Parameters:
resource - the resource.
tag - the name of the tag.
userID - the id of the user who added the tagging.
Returns:
the tagging data objects.
Throws:
RegistryException - if an error occurs while getting the tagging.

getTagging

TaggingDO[] getTagging(ResourceImpl resource)
                       throws RegistryException
Method to get all taggings added to a given resource.

Parameters:
resource - the resource.
Returns:
the tagging data objects.
Throws:
RegistryException - if an error occurs while getting the taggings.

getTagging

TaggingDO getTagging(long taggingID)
                     throws RegistryException
Method to get a tagging by the given id.

Parameters:
taggingID - the id of the tagging.
Returns:
the tagging data object.
Throws:
RegistryException - if an error occurs while getting the tagging.

getResourceWithMinimumData

ResourceImpl getResourceWithMinimumData(String path)
                                        throws RegistryException
Gets the resource with sufficient data to differentiate it from another resource. This would populate a ResourceImpl with the path, name and path identifier of a resource.

Parameters:
path - the path of the resource.
Returns:
the resource with minimum data.
Throws:
RegistryException - if an error occurs while retrieving resource data.

moveTags

void moveTags(ResourceIDImpl source,
              ResourceIDImpl target)
              throws RegistryException
Method to move tags.

Parameters:
source - the source resource.
target - the target resource.
Throws:
RegistryException - if some error occurs while moving tags

moveTagPaths

void moveTagPaths(ResourceIDImpl source,
                  ResourceIDImpl target)
                  throws RegistryException
Method to move tag paths. This function will move the paths from one path id to another regardless of the resource name.

Parameters:
source - the source resource.
target - the target resource.
Throws:
RegistryException - if some error occurs while moving tag paths


Copyright © 2012 WSO2 Inc. All Rights Reserved.