public class JDBCTagsDAO extends Object implements TagsDAO
TagsDAO to store tags on a JDBC-based database.| Modifier and Type | Field and Description |
|---|---|
protected static Object |
ADD_TAG_LOCK |
| Constructor and Description |
|---|
JDBCTagsDAO(DAOManager daoManager)
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
String[] |
getPathsWithTag(String tag,
Connection conn)
Method to get resource paths containing the given tag.
|
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.
|
protected static final Object ADD_TAG_LOCK
public JDBCTagsDAO(DAOManager daoManager)
daoManager - instance of the data access object manager.public void addTagging(String tagName, ResourceImpl resource, String userID) throws RegistryException
TagsDAOaddTagging in interface TagsDAOtagName - the name of tag to be persisted.resource - the resourceuserID - the id of the user who added the tag.RegistryException - if some error occurs while adding a tagpublic void addTaggings(ResourceImpl resource, TaggingDO[] taggingDOs) throws RegistryException
TagsDAOaddTaggings in interface TagsDAOresource - the resourcetaggingDOs - the tags to be persisted.RegistryException - if some error occurs while adding tagspublic void copyTags(ResourceImpl fromResource, ResourceImpl toResource) throws RegistryException
TagsDAOcopyTags in interface TagsDAOfromResource - the source resource.toResource - the target resource.RegistryException - if some error occurs while copying tagspublic boolean taggingExists(String tagName, ResourceImpl resourceImpl, String userID) throws RegistryException
TagsDAOtaggingExists in interface TagsDAOtagName - the name of tag to be persisted.resourceImpl - the resourceuserID - the id of the user who added the tag.RegistryException - if some error occurs while checking whether a tag exists.public void removeTags(ResourceImpl resource, String tag) throws RegistryException
TagsDAOremoveTags in interface TagsDAOresource - the resourcetag - the name of tag to be persisted.RegistryException - if an error occurred while removing the tag.public void removeTags(ResourceImpl resource, String tag, String userID) throws RegistryException
TagsDAOremoveTags in interface TagsDAOresource - the resourcetag - the name of tag to be persisted.userID - the id of the user who added the tag.RegistryException - if an error occurred while removing the tag.public void removeTags(ResourceImpl resource) throws RegistryException
TagsDAOremoveTags in interface TagsDAOresource - the resourceRegistryException - if an error occurred while removing tags.public void removeVersionTags(long regVersion)
throws RegistryException
TagsDAOremoveVersionTags in interface TagsDAOregVersion - the versionRegistryException - if an error occurred while removing tags.public String[] getPathsWithTag(String tag, Connection conn) throws RegistryException
tag - the tag name.conn - the connection to use.RegistryException - if an error occurs while getting the resource path.public String[] getTags(ResourceImpl resourceImpl) throws RegistryException
TagsDAOgetTags in interface TagsDAOresourceImpl - the resource.RegistryException - if an error occurs while getting the tag names.public List<TaggingDO> getTagDOs(ResourceImpl resourceImpl) throws RegistryException
TagsDAOgetTagDOs in interface TagsDAOresourceImpl - the resource.RegistryException - if an error occurs while getting the tagging data objects.public List getPathsWithAnyTag(String[] tags) throws RegistryException
TagsDAOgetPathsWithAnyTag in interface TagsDAOtags - the tags.RegistryException - if an error occurs.public long getTagCount(ResourceImpl resourceImpl, String tag) throws RegistryException
TagsDAOgetTagCount in interface TagsDAOresourceImpl - the resource.tag - the tag nameRegistryException - if an error occurred while getting the number of tags.public Tag[] getTagsWithCount(ResourceImpl resourceImpl) throws RegistryException
TagsDAOgetTagsWithCount in interface TagsDAOresourceImpl - the resource.RegistryException - if an error occurred while getting tags.public TaggingDO[] getTagging(ResourceImpl resource, String tag, String userID) throws RegistryException
TagsDAOgetTagging in interface TagsDAOresource - the resource.tag - the name of the tag.userID - the id of the user who added the tagging.RegistryException - if an error occurs while getting the tagging.public TaggingDO[] getTagging(ResourceImpl resource) throws RegistryException
TagsDAOgetTagging in interface TagsDAOresource - the resource.RegistryException - if an error occurs while getting the taggings.public TaggingDO getTagging(long taggingID) throws RegistryException
TagsDAOgetTagging in interface TagsDAOtaggingID - the id of the tagging.RegistryException - if an error occurs while getting the tagging.public ResourceImpl getResourceWithMinimumData(String path) throws RegistryException
TagsDAOResourceImpl with the path, name and path identifier
of a resource.getResourceWithMinimumData in interface TagsDAOpath - the path of the resource.RegistryException - if an error occurs while retrieving resource data.public void moveTags(ResourceIDImpl source, ResourceIDImpl target) throws RegistryException
TagsDAOmoveTags in interface TagsDAOsource - the source resource.target - the target resource.RegistryException - if some error occurs while moving tagspublic void moveTagPaths(ResourceIDImpl source, ResourceIDImpl target) throws RegistryException
TagsDAOmoveTagPaths in interface TagsDAOsource - the source resource.target - the target resource.RegistryException - if some error occurs while moving tag pathsCopyright © 2015 WSO2 Inc. All Rights Reserved.