com.atlassian.confluence.like
Class DefaultLikeManager

java.lang.Object
  extended by com.atlassian.confluence.like.DefaultLikeManager
All Implemented Interfaces:
LikeManager

public class DefaultLikeManager
extends Object
implements LikeManager


Constructor Summary
DefaultLikeManager(org.springframework.transaction.PlatformTransactionManager transactionManager, LikeEntityDao dao, com.atlassian.event.api.EventPublisher publisher, PermissionManager permissionManager)
           
 
Method Summary
 Like addLike(ContentEntityObject contentEntity)
           
 Like addLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
          Add a like for the provided user.
 Map<com.atlassian.bonnie.Searchable,Integer> countLikes(Collection<? extends com.atlassian.bonnie.Searchable> searchables)
          Count the number of likes for the given objects
 int countLikes(com.atlassian.bonnie.Searchable searchable)
          Count the number of likes for the given object
 Map<Long,List<Like>> getLikes(Collection<? extends ContentEntityObject> contentEntities)
          Gets all the likes for the specified content entities (likes are ordered such that recent likes come first).
 List<Like> getLikes(ContentEntityObject contentEntity)
          Gets all the likes for the specified content entity (likes are ordered such that recent likes come first)
 boolean hasLike(ContentEntityObject contentEntity)
           
 boolean hasLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
          Returns true if the provided user likes this content entity.
 void removeAllLikesFor(String username)
          Removes all likes (for any user) from the specified content entity.
 void removeAllLikesOn(ContentEntityObject contentEntity)
          Removes all likes (for any user) from the specified content entity.
 void removeLike(ContentEntityObject contentEntity)
           
 void removeLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
          Remove like from content entity for the current logged in user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLikeManager

public DefaultLikeManager(org.springframework.transaction.PlatformTransactionManager transactionManager,
                          LikeEntityDao dao,
                          com.atlassian.event.api.EventPublisher publisher,
                          PermissionManager permissionManager)
Method Detail

addLike

public Like addLike(ContentEntityObject contentEntity)
Specified by:
addLike in interface LikeManager

addLike

public Like addLike(ContentEntityObject contentEntity,
                    com.atlassian.user.User user)
Description copied from interface: LikeManager
Add a like for the provided user.

Specified by:
addLike in interface LikeManager
Parameters:
contentEntity - the content entity to add a like to
user - the user

removeLike

public void removeLike(ContentEntityObject contentEntity)
Specified by:
removeLike in interface LikeManager

removeLike

public void removeLike(ContentEntityObject contentEntity,
                       com.atlassian.user.User user)
Description copied from interface: LikeManager
Remove like from content entity for the current logged in user.

Specified by:
removeLike in interface LikeManager
Parameters:
contentEntity - content entity to remove like from
user - the user

removeAllLikesOn

public void removeAllLikesOn(ContentEntityObject contentEntity)
Description copied from interface: LikeManager
Removes all likes (for any user) from the specified content entity.

Specified by:
removeAllLikesOn in interface LikeManager
Parameters:
contentEntity - content entity

removeAllLikesFor

public void removeAllLikesFor(String username)
Description copied from interface: LikeManager
Removes all likes (for any user) from the specified content entity.

Specified by:
removeAllLikesFor in interface LikeManager
Parameters:
username - the name of the user to remove all likes for

hasLike

public boolean hasLike(ContentEntityObject contentEntity)
Specified by:
hasLike in interface LikeManager

hasLike

public boolean hasLike(ContentEntityObject contentEntity,
                       com.atlassian.user.User user)
Description copied from interface: LikeManager
Returns true if the provided user likes this content entity.

Specified by:
hasLike in interface LikeManager
Parameters:
contentEntity - the content entity
user - the user who would like this content
Returns:
true if the provided user likes this content entity.

getLikes

public List<Like> getLikes(ContentEntityObject contentEntity)
Description copied from interface: LikeManager
Gets all the likes for the specified content entity (likes are ordered such that recent likes come first)

Specified by:
getLikes in interface LikeManager
Parameters:
contentEntity - the content entity
Returns:
all the likes for the specified content entity.

getLikes

public Map<Long,List<Like>> getLikes(Collection<? extends ContentEntityObject> contentEntities)
Description copied from interface: LikeManager
Gets all the likes for the specified content entities (likes are ordered such that recent likes come first).

Specified by:
getLikes in interface LikeManager
Parameters:
contentEntities - content entities
Returns:
a map of contentId to a set of all the likes for that piece of content.

countLikes

public Map<com.atlassian.bonnie.Searchable,Integer> countLikes(Collection<? extends com.atlassian.bonnie.Searchable> searchables)
Description copied from interface: LikeManager
Count the number of likes for the given objects

Specified by:
countLikes in interface LikeManager
Parameters:
searchables - A searchable object whose ID must be set
Returns:
A map mapping the object to the number of likes it has. If an object no longer exists, it has 0 likes.

countLikes

public int countLikes(com.atlassian.bonnie.Searchable searchable)
Description copied from interface: LikeManager
Count the number of likes for the given object

Specified by:
countLikes in interface LikeManager
Parameters:
searchable - A searchable object whose ID must be set
Returns:
The number of likes it has. If an object no longer exists, it has 0 likes.


Copyright © 2003–2015 Atlassian. All rights reserved.