com.dotmarketing.tag.factories
Class TagFactory

java.lang.Object
  extended by com.dotmarketing.tag.factories.TagFactory

public class TagFactory
extends java.lang.Object


Constructor Summary
TagFactory()
           
 
Method Summary
protected static void _checkUserPermissions(Inode webAsset, com.liferay.portal.model.User user, int permission)
          Checks the permission access of an user over an object
static Tag addTag(java.lang.String tagName, java.lang.String userId)
          Creates a new tag
static java.util.List addTag(java.lang.String tagName, java.lang.String userId, java.lang.String inode)
          Tags an object, validates the existence of a tag(s), creates it if it doesn't exists and then tags the object
static TagInode addTagInode(java.lang.String tagName, java.lang.String inode, java.lang.String hostId)
          Gets a tagInode and a host identifier, if doesn't exists then the tagInode it's created
static void deleteTag(java.lang.String tagId)
          Deletes a tag
static void deleteTag(java.lang.String tagName, java.lang.String userId)
          Deletes a tag
static void deleteTag(Tag tag)
          Deletes a tag
static java.util.List deleteTagInode(java.lang.String tagName, java.lang.String inode)
          Deletes an object tag assignment(s)
static void deleteTagInode(TagInode tagInode)
          Deletes a TagInode
static void editTag(java.lang.String tagName, java.lang.String oldTagName, java.lang.String userId)
          Renames a tag
static java.util.List getAllTag(java.lang.String userId)
          Gets all the tags created, with the respective owner and permission information
static java.util.List<Tag> getAllTags()
          Get a list of all the tags created
static java.util.List<Tag> getAllTagsForUsers(java.util.List<java.lang.String> userIds)
          Gets all the tags given a user List
static java.util.List<java.lang.String> getAllTagsName()
          Get a list of all the tags name created
static java.util.List<Tag> getSuggestedTag(javax.servlet.http.HttpServletRequest request, java.lang.String name, java.lang.String selectedHostId)
          Gets a suggested tag(s), by name
static java.util.List<Tag> getSuggestedTag(java.lang.String name)
          Gets a suggested tag(s), by name
static Tag getTag(java.lang.String name, java.lang.String userId)
          Gets a Tag by name, validates the existance of the tag, if it doesn't exists then is created
static Tag getTag(java.lang.String name, java.lang.String userId, java.lang.String hostId)
          Gets a Tag by name, validates the existance of the tag, if it doesn't exists then is created
static java.util.List<Tag> getTagByName(java.lang.String name)
          Gets a Tag by name
static Tag getTagByTagId(java.lang.String tagId)
          Gets a Tag by a tagId retrieved from a TagInode.
static Tag getTagByTagIdAndHostId(java.lang.String tagId, java.lang.String hostId)
          Gets a Tag by a tagId and a hostId.
static java.util.List<Tag> getTagByUser(java.lang.String userId)
          Gets all the tag created by an user
static java.util.List getTagInfoByName(java.lang.String name)
          Gets a tag with the owner information, searching by name
static TagInode getTagInode(java.lang.String tagId, java.lang.String inode)
          Gets a tagInode by name and inode
static java.util.List getTagInodeByInode(java.lang.String inode)
          Gets all tags associated to an object
static java.util.List<TagInode> getTagInodeByTagId(java.lang.String tagId)
          Gets all tags associated to an object
static boolean isGlobalTag(Tag tag)
          Check if tag is global
static Tag saveTag(java.lang.String tagName, java.lang.String userId, java.lang.String hostId)
          Creates a new tag
static void setPermissionAPI(PermissionAPI permissionAPIRef)
           
static void updateTag(java.lang.String tagId, java.lang.String tagName, boolean updateTagReference, java.lang.String hostId)
           
static void updateTag(java.lang.String tagId, java.lang.String tagName, java.lang.String hostId)
           
static void updateTagReferences(java.lang.String hostIdentifier, java.lang.String oldTagStorageId, java.lang.String newTagStorageId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagFactory

public TagFactory()
Method Detail

setPermissionAPI

public static void setPermissionAPI(PermissionAPI permissionAPIRef)
Parameters:
permissionAPI - the permissionAPI to set

getAllTags

public static java.util.List<Tag> getAllTags()
Get a list of all the tags created

Returns:
list of all tags created

getAllTagsName

public static java.util.List<java.lang.String> getAllTagsName()
Get a list of all the tags name created

Returns:
list of all tags name created

getTagByName

public static java.util.List<Tag> getTagByName(java.lang.String name)
Gets a Tag by name

Parameters:
name - name of the tag to get
Returns:
tag

getTagByUser

public static java.util.List<Tag> getTagByUser(java.lang.String userId)
Gets all the tag created by an user

Parameters:
userId - id of the user
Returns:
a list of all the tags created

getTag

public static Tag getTag(java.lang.String name,
                         java.lang.String userId)
Gets a Tag by name, validates the existance of the tag, if it doesn't exists then is created

Parameters:
name - name of the tag to get
userId - owner of the tag
Returns:
tag

addTag

public static Tag addTag(java.lang.String tagName,
                         java.lang.String userId)
Creates a new tag

Parameters:
tagName - name of the new tag
userId - owner of the new tag
Returns:
new tag created

addTag

public static java.util.List addTag(java.lang.String tagName,
                                    java.lang.String userId,
                                    java.lang.String inode)
                             throws java.lang.Exception
Tags an object, validates the existence of a tag(s), creates it if it doesn't exists and then tags the object

Parameters:
tagName - tag(s) to create
userId - owner of the tag
inode - object to tag
Returns:
a list of all tags assigned to an object
Throws:
java.lang.Exception

deleteTag

public static void deleteTag(Tag tag)
Deletes a tag

Parameters:
tag - tag to be deleted

deleteTag

public static void deleteTag(java.lang.String tagName,
                             java.lang.String userId)
Deletes a tag

Parameters:
tagName - name of the tag to be deleted
userId - id of the tag owner

editTag

public static void editTag(java.lang.String tagName,
                           java.lang.String oldTagName,
                           java.lang.String userId)
Renames a tag

Parameters:
tagName - new tag name
oldTagName - current tag name
userId - owner of the tag

getAllTag

public static java.util.List getAllTag(java.lang.String userId)
Gets all the tags created, with the respective owner and permission information

Parameters:
userId - id of the user that searches the tag
Returns:
a complete list of all the tags, with the owner information and the respective permission information

getTagInfoByName

public static java.util.List getTagInfoByName(java.lang.String name)
Gets a tag with the owner information, searching by name

Parameters:
name - name of the tag
Returns:
the tag with the owner information

_checkUserPermissions

protected static void _checkUserPermissions(Inode webAsset,
                                            com.liferay.portal.model.User user,
                                            int permission)
                                     throws com.liferay.portal.struts.ActionException,
                                            DotDataException
Checks the permission access of an user over an object

Parameters:
webAsset - object to validates access
user - user to validate access
permission - read or write permission to validates
Throws:
com.liferay.portal.struts.ActionException
DotDataException

addTagInode

public static TagInode addTagInode(java.lang.String tagName,
                                   java.lang.String inode,
                                   java.lang.String hostId)
                            throws java.lang.Exception
Gets a tagInode and a host identifier, if doesn't exists then the tagInode it's created

Parameters:
tagName - name of the tag
inode - inode of the object tagged
hostId - the identifier of host that storage the tag
Returns:
a tagInode
Throws:
java.lang.Exception

getTagInodeByInode

public static java.util.List getTagInodeByInode(java.lang.String inode)
Gets all tags associated to an object

Parameters:
inode - inode of the object tagged
Returns:
list of all the TagInode where the tags are associated to the object

getTagInode

public static TagInode getTagInode(java.lang.String tagId,
                                   java.lang.String inode)
Gets a tagInode by name and inode

Parameters:
name - name of the tag
inode - inode of the object tagged
Returns:
the tagInode

deleteTagInode

public static void deleteTagInode(TagInode tagInode)
Deletes a TagInode

Parameters:
tagInode - TagInode to delete

deleteTagInode

public static java.util.List deleteTagInode(java.lang.String tagName,
                                            java.lang.String inode)
Deletes an object tag assignment(s)

Parameters:
tagName - name(s) of the tag(s)
inode - inode of the object tagged
Returns:
a list of all tags assigned to an object
Throws:
java.lang.Exception

getSuggestedTag

public static java.util.List<Tag> getSuggestedTag(java.lang.String name)
Gets a suggested tag(s), by name

Parameters:
name - name of the tag searched
Returns:
list of suggested tags

getAllTagsForUsers

public static java.util.List<Tag> getAllTagsForUsers(java.util.List<java.lang.String> userIds)
Gets all the tags given a user List

Parameters:
userIds - the user id's associated with the tags
Returns:
a complete list of all the tags, with the owner information and the respective permission information

getTag

public static Tag getTag(java.lang.String name,
                         java.lang.String userId,
                         java.lang.String hostId)
                  throws java.lang.Exception
Gets a Tag by name, validates the existance of the tag, if it doesn't exists then is created

Parameters:
name - name of the tag to get
userId - owner of the tag
hostId -
Returns:
tag
Throws:
java.lang.Exception

saveTag

public static Tag saveTag(java.lang.String tagName,
                          java.lang.String userId,
                          java.lang.String hostId)
                   throws java.lang.Exception
Creates a new tag

Parameters:
tagName - name of the new tag
userId - owner of the new tag
hostId -
Returns:
new tag created
Throws:
DotHibernateException
java.lang.Exception

isGlobalTag

public static boolean isGlobalTag(Tag tag)
Check if tag is global

Parameters:
tag -
Returns:
boolean

getTagInodeByTagId

public static java.util.List<TagInode> getTagInodeByTagId(java.lang.String tagId)
Gets all tags associated to an object

Parameters:
tagId - tagId of the object tagged
Returns:
list of all the TagInode where the tags are associated to the object

getTagByTagId

public static Tag getTagByTagId(java.lang.String tagId)
                         throws DotHibernateException
Gets a Tag by a tagId retrieved from a TagInode.

Parameters:
tagId - the tag id to get
Returns:
tag
Throws:
DotHibernateException

deleteTag

public static void deleteTag(java.lang.String tagId)
                      throws DotHibernateException
Deletes a tag

Parameters:
tagName - name of the tag to be deleted
userId - id of the tag owner
Throws:
DotHibernateException

updateTagReferences

public static void updateTagReferences(java.lang.String hostIdentifier,
                                       java.lang.String oldTagStorageId,
                                       java.lang.String newTagStorageId)

updateTag

public static void updateTag(java.lang.String tagId,
                             java.lang.String tagName,
                             java.lang.String hostId)
                      throws java.lang.Exception
Throws:
java.lang.Exception

updateTag

public static void updateTag(java.lang.String tagId,
                             java.lang.String tagName,
                             boolean updateTagReference,
                             java.lang.String hostId)
                      throws java.lang.Exception
Throws:
java.lang.Exception

getTagByTagIdAndHostId

public static Tag getTagByTagIdAndHostId(java.lang.String tagId,
                                         java.lang.String hostId)
                                  throws DotHibernateException
Gets a Tag by a tagId and a hostId.

Parameters:
tagId - the tag id to get
hostId - the host id
Returns:
tag
Throws:
DotHibernateException

getSuggestedTag

public static java.util.List<Tag> getSuggestedTag(javax.servlet.http.HttpServletRequest request,
                                                  java.lang.String name,
                                                  java.lang.String selectedHostId)
Gets a suggested tag(s), by name

Parameters:
name - name of the tag searched
Returns:
list of suggested tags


Copyright © 2013 dotCMS Inc. All Rights Reserved.