Package com.atlassian.confluence.like
Class HibernateLikeEntityDao
- java.lang.Object
-
- com.atlassian.confluence.like.HibernateLikeEntityDao
-
- All Implemented Interfaces:
LikeEntityDao
@ParametersAreNonnullByDefault public class HibernateLikeEntityDao extends Object implements LikeEntityDao
-
-
Constructor Summary
Constructors Constructor Description HibernateLikeEntityDao(org.hibernate.SessionFactory sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LikeEntity
addLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
Add a like on the content entity for the given user.int
countLikes(Searchable searchable)
Map<Searchable,Integer>
countLikes(Collection<? extends Searchable> searchables)
List<LikeEntity>
getLikeEntities(Collection<? extends ContentEntityObject> contentEntities)
boolean
hasLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
Returns true if the given user likes this content entity.void
removeAllLikesFor(@NonNull com.atlassian.sal.api.user.UserKey key)
Remove all likes for the given userKeyvoid
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 given user.
-
-
-
Method Detail
-
addLike
public LikeEntity addLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
Description copied from interface:LikeEntityDao
Add a like on the content entity for the given user.- Specified by:
addLike
in interfaceLikeEntityDao
- Parameters:
contentEntity
- the content entity to add a like touser
- User liking the content- Returns:
- the created Like
-
removeLike
public void removeLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
Description copied from interface:LikeEntityDao
Remove like from content entity for the given user.- Specified by:
removeLike
in interfaceLikeEntityDao
- Parameters:
contentEntity
- content entity to remove like fromuser
- User removing their Like
-
removeAllLikesOn
public void removeAllLikesOn(ContentEntityObject contentEntity)
Description copied from interface:LikeEntityDao
Removes all likes (for any user) from the specified content entity.- Specified by:
removeAllLikesOn
in interfaceLikeEntityDao
- Parameters:
contentEntity
- content entity
-
removeAllLikesFor
public void removeAllLikesFor(String username)
Description copied from interface:LikeEntityDao
Removes all likes (for any user) from the specified content entity.- Specified by:
removeAllLikesFor
in interfaceLikeEntityDao
- 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:LikeEntityDao
Remove all likes for the given userKey- Specified by:
removeAllLikesFor
in interfaceLikeEntityDao
-
hasLike
public boolean hasLike(ContentEntityObject contentEntity, com.atlassian.user.User user)
Description copied from interface:LikeEntityDao
Returns true if the given user likes this content entity.- Specified by:
hasLike
in interfaceLikeEntityDao
- Parameters:
contentEntity
- the content entityuser
- the User the Like is being checked for- Returns:
- true if the user likes this content entity.
-
getLikeEntities
public List<LikeEntity> getLikeEntities(Collection<? extends ContentEntityObject> contentEntities)
- Specified by:
getLikeEntities
in interfaceLikeEntityDao
-
countLikes
public int countLikes(Searchable searchable)
- Specified by:
countLikes
in interfaceLikeEntityDao
-
countLikes
public Map<Searchable,Integer> countLikes(Collection<? extends Searchable> searchables)
- Specified by:
countLikes
in interfaceLikeEntityDao
-
-