public class DefaultLikeManager extends Object implements LikeManager
Constructor and Description |
---|
DefaultLikeManager(org.springframework.transaction.PlatformTransactionManager transactionManager,
LikeEntityDao dao,
com.atlassian.event.api.EventPublisher publisher,
PermissionManager permissionManager,
ConfluenceAccessManager confluenceAccessManager,
ContentEntityManager contentEntityManager,
AccessModeService accessModeService) |
Modifier and Type | Method and Description |
---|---|
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,
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 |
removeAllLikesFor(@NonNull com.atlassian.sal.api.user.UserKey key)
Remove all likes for the given userkey.
|
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.
|
public DefaultLikeManager(org.springframework.transaction.PlatformTransactionManager transactionManager, LikeEntityDao dao, com.atlassian.event.api.EventPublisher publisher, PermissionManager permissionManager, ConfluenceAccessManager confluenceAccessManager, ContentEntityManager contentEntityManager, AccessModeService accessModeService)
public Like addLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
LikeManager
addLike
in interface LikeManager
contentEntity
- the content entity to add a like touser
- the userpublic void removeLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
LikeManager
removeLike
in interface LikeManager
contentEntity
- content entity to remove like fromuser
- the userpublic void removeAllLikesOn(ContentEntityObject contentEntity)
LikeManager
removeAllLikesOn
in interface LikeManager
contentEntity
- content entitypublic void removeAllLikesFor(String username)
LikeManager
removeAllLikesFor
in interface LikeManager
username
- the name of the user to remove all likes forpublic void removeAllLikesFor(@NonNull com.atlassian.sal.api.user.UserKey key)
LikeManager
removeAllLikesFor
in interface LikeManager
key
- a userKey. If no such user exists, this method will be a noop.public boolean hasLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
LikeManager
hasLike
in interface LikeManager
contentEntity
- the content entityuser
- the user who would like this contentpublic List<Like> getLikes(ContentEntityObject contentEntity)
LikeManager
getLikes
in interface LikeManager
contentEntity
- the content entitypublic Map<Long,List<Like>> getLikes(Collection<? extends ContentEntityObject> contentEntities)
LikeManager
getLikes
in interface LikeManager
contentEntities
- content entitiespublic Map<com.atlassian.bonnie.Searchable,Integer> countLikes(Collection<? extends com.atlassian.bonnie.Searchable> searchables)
LikeManager
countLikes
in interface LikeManager
searchables
- A searchable object whose ID must be setpublic int countLikes(com.atlassian.bonnie.Searchable searchable)
LikeManager
countLikes
in interface LikeManager
searchable
- A searchable object whose ID must be setCopyright © 2003–2020 Atlassian. All rights reserved.