Package com.atlassian.confluence.like
Class DefaultLikeManager
java.lang.Object
com.atlassian.confluence.like.DefaultLikeManager
- All Implemented Interfaces:
LikeManager
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultLikeManager
(org.springframework.transaction.PlatformTransactionManager transactionManager, LikeEntityDao dao, com.atlassian.event.api.EventPublisher publisher, PermissionManager permissionManager, ConfluenceAccessManager confluenceAccessManager, ContentEntityManager contentEntityManager, AccessModeService accessModeService) -
Method Summary
Modifier and TypeMethodDescriptionaddLike
(ContentEntityObject contentEntity, com.atlassian.user.User user) Add a like for the provided user.int
countLikes
(Searchable searchable) Count the number of likes for the given objectcountLikes
(Collection<? extends Searchable> searchables) Count the number of likes for the given objectsgetLikes
(ContentEntityObject contentEntity) Gets all the likes for the specified content entity (likes are ordered such that recent likes come first)getLikes
(Collection<? extends ContentEntityObject> contentEntities) Gets all the likes for the specified content entities (likes are ordered such that recent likes come first).boolean
hasLike
(ContentEntityObject contentEntity, com.atlassian.user.User user) Returns true if the provided user likes this content entity.void
removeAllLikesFor
(@NonNull com.atlassian.sal.api.user.UserKey key) Remove all likes for the given userkey.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, 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
Methods inherited from interface com.atlassian.confluence.like.LikeManager
addLike, hasLike, removeAllLikesFor, removeLike
-
Constructor Details
-
DefaultLikeManager
public DefaultLikeManager(org.springframework.transaction.PlatformTransactionManager transactionManager, LikeEntityDao dao, com.atlassian.event.api.EventPublisher publisher, PermissionManager permissionManager, ConfluenceAccessManager confluenceAccessManager, ContentEntityManager contentEntityManager, AccessModeService accessModeService)
-
-
Method Details
-
addLike
Description copied from interface:LikeManager
Add a like for the provided user.- Specified by:
addLike
in interfaceLikeManager
- Parameters:
contentEntity
- the content entity to add a like touser
- the user
-
removeLike
Description copied from interface:LikeManager
Remove like from content entity for the current logged in user.- Specified by:
removeLike
in interfaceLikeManager
- Parameters:
contentEntity
- content entity to remove like fromuser
- the user
-
removeAllLikesOn
Description copied from interface:LikeManager
Removes all likes (for any user) from the specified content entity.- Specified by:
removeAllLikesOn
in interfaceLikeManager
- Parameters:
contentEntity
- content entity
-
removeAllLikesFor
Description copied from interface:LikeManager
Removes all likes (for any user) from the specified content entity.- Specified by:
removeAllLikesFor
in interfaceLikeManager
- Parameters:
username
- the name of the user to remove all likes for
-
removeAllLikesFor
public void removeAllLikesFor(@NonNull com.atlassian.sal.api.user.UserKey key) Description copied from interface:LikeManager
Remove all likes for the given userkey.- Specified by:
removeAllLikesFor
in interfaceLikeManager
- Parameters:
key
- a userKey. If no such user exists, this method will be a noop.
-
hasLike
Description copied from interface:LikeManager
Returns true if the provided user likes this content entity.- Specified by:
hasLike
in interfaceLikeManager
- Parameters:
contentEntity
- the content entityuser
- the user who would like this content- Returns:
- true if the provided user likes this content entity.
-
getLikes
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 interfaceLikeManager
- Parameters:
contentEntity
- the content entity- Returns:
- all the likes for the specified content entity.
-
getLikes
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 interfaceLikeManager
- Parameters:
contentEntities
- content entities- Returns:
- a map of contentId to a set of all the likes for that piece of content.
-
countLikes
Description copied from interface:LikeManager
Count the number of likes for the given objects- Specified by:
countLikes
in interfaceLikeManager
- 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
Description copied from interface:LikeManager
Count the number of likes for the given object- Specified by:
countLikes
in interfaceLikeManager
- 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.
-