Package com.atlassian.confluence.like
Class DefaultLikeManager
- java.lang.Object
-
- com.atlassian.confluence.like.DefaultLikeManager
-
- All Implemented Interfaces:
LikeManager
public class DefaultLikeManager extends Object implements LikeManager
-
-
Constructor Summary
Constructors Constructor Description DefaultLikeManager(org.springframework.transaction.PlatformTransactionManager transactionManager, LikeEntityDao dao, com.atlassian.event.api.EventPublisher publisher, PermissionManager permissionManager, ConfluenceAccessManager confluenceAccessManager, ContentEntityManager contentEntityManager, AccessModeService accessModeService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LikeaddLike(ContentEntityObject contentEntity, com.atlassian.user.User user)Add a like for the provided user.intcountLikes(Searchable searchable)Count the number of likes for the given objectMap<Searchable,Integer>countLikes(Collection<? extends Searchable> searchables)Count the number of likes for the given objectsList<Like>getLikes(ContentEntityObject contentEntity)Gets all the likes for the specified content entity (likes are ordered such that recent likes come first)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).booleanhasLike(ContentEntityObject contentEntity, com.atlassian.user.User user)Returns true if the provided user likes this content entity.voidremoveAllLikesFor(@NonNull com.atlassian.sal.api.user.UserKey key)Remove all likes for the given userkey.voidremoveAllLikesFor(String username)Removes all likes (for any user) from the specified content entity.voidremoveAllLikesOn(ContentEntityObject contentEntity)Removes all likes (for any user) from the specified content entity.voidremoveLike(ContentEntityObject contentEntity, com.atlassian.user.User user)Remove like from content entity for the current logged in user.
-
-
-
Constructor Detail
-
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 Detail
-
addLike
public Like addLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
Description copied from interface:LikeManagerAdd a like for the provided user.- Specified by:
addLikein interfaceLikeManager- Parameters:
contentEntity- the content entity to add a like touser- the user
-
removeLike
public void removeLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
Description copied from interface:LikeManagerRemove like from content entity for the current logged in user.- Specified by:
removeLikein interfaceLikeManager- Parameters:
contentEntity- content entity to remove like fromuser- the user
-
removeAllLikesOn
public void removeAllLikesOn(ContentEntityObject contentEntity)
Description copied from interface:LikeManagerRemoves all likes (for any user) from the specified content entity.- Specified by:
removeAllLikesOnin interfaceLikeManager- Parameters:
contentEntity- content entity
-
removeAllLikesFor
public void removeAllLikesFor(String username)
Description copied from interface:LikeManagerRemoves all likes (for any user) from the specified content entity.- Specified by:
removeAllLikesForin 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:LikeManagerRemove all likes for the given userkey.- Specified by:
removeAllLikesForin interfaceLikeManager- Parameters:
key- a userKey. If no such user exists, this method will be a noop.
-
hasLike
public boolean hasLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
Description copied from interface:LikeManagerReturns true if the provided user likes this content entity.- Specified by:
hasLikein interfaceLikeManager- Parameters:
contentEntity- the content entityuser- 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:LikeManagerGets all the likes for the specified content entity (likes are ordered such that recent likes come first)- Specified by:
getLikesin interfaceLikeManager- 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:LikeManagerGets all the likes for the specified content entities (likes are ordered such that recent likes come first).- Specified by:
getLikesin interfaceLikeManager- Parameters:
contentEntities- content entities- Returns:
- a map of contentId to a set of all the likes for that piece of content.
-
countLikes
public Map<Searchable,Integer> countLikes(Collection<? extends Searchable> searchables)
Description copied from interface:LikeManagerCount the number of likes for the given objects- Specified by:
countLikesin 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
public int countLikes(Searchable searchable)
Description copied from interface:LikeManagerCount the number of likes for the given object- Specified by:
countLikesin 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.
-
-