Class DefaultFavouriteManager
- java.lang.Object
-
- com.atlassian.confluence.userstatus.DefaultFavouriteManager
-
- All Implemented Interfaces:
FavouriteManager
public class DefaultFavouriteManager extends Object implements FavouriteManager
The default implementation of the Favourite Manager which uses a label on the entity to mark it as a favourite.
-
-
Constructor Summary
Constructors Constructor Description DefaultFavouriteManager(SpaceManager spaceManager, LabelManager labelManager, LabelPermissionEnforcer labelPermissionEnforcer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPageToFavourites(com.atlassian.user.User user, AbstractPage page)
Add a page or blog post to a user's favourites by attaching a personal label to the space.void
addSpaceToFavourites(com.atlassian.user.User user, Space space)
Add a space to a user's favourites by attaching a personal label to the space.boolean
hasPermission(com.atlassian.user.User user, AbstractPage page)
Get whether the current user has permission to add or remove a page favourite.boolean
hasPermission(com.atlassian.user.User user, Space space)
Get whether the current user has permission to add or remove a space favourite.boolean
isUserFavourite(com.atlassian.user.User user, AbstractPage page)
Returns whether a page or blog post is marked as a favourite for a user.boolean
isUserFavourite(com.atlassian.user.User user, Space space)
Returns whether a space is marked as a favourite for a user.void
removePageFromFavourites(com.atlassian.user.User user, AbstractPage page)
Remove a page or blog post from a user's favourites.void
removeSpaceFromFavourites(com.atlassian.user.User user, Space space)
Remove a space from a user's favourites.
-
-
-
Constructor Detail
-
DefaultFavouriteManager
public DefaultFavouriteManager(SpaceManager spaceManager, LabelManager labelManager, LabelPermissionEnforcer labelPermissionEnforcer)
-
-
Method Detail
-
isUserFavourite
public boolean isUserFavourite(com.atlassian.user.User user, Space space)
Description copied from interface:FavouriteManager
Returns whether a space is marked as a favourite for a user.- Specified by:
isUserFavourite
in interfaceFavouriteManager
-
addSpaceToFavourites
public void addSpaceToFavourites(com.atlassian.user.User user, Space space) throws NotAuthorizedException, org.springframework.dao.DataAccessException
Description copied from interface:FavouriteManager
Add a space to a user's favourites by attaching a personal label to the space.- Specified by:
addSpaceToFavourites
in interfaceFavouriteManager
- Parameters:
user
- The user to add the favourite on behalf of.space
- The space to add the favourite to.- Throws:
NotAuthorizedException
- If the current user doesn't have permission to add the favourite.org.springframework.dao.DataAccessException
- If the label save operation fails.
-
removeSpaceFromFavourites
public void removeSpaceFromFavourites(com.atlassian.user.User user, Space space) throws NotAuthorizedException, org.springframework.dao.DataAccessException
Description copied from interface:FavouriteManager
Remove a space from a user's favourites.- Specified by:
removeSpaceFromFavourites
in interfaceFavouriteManager
- Parameters:
user
- The user to remove the favourite on behalf of.space
- The space to remove the favourite from.- Throws:
NotAuthorizedException
- If the current user doesn't have permission to remove the favourite.org.springframework.dao.DataAccessException
- If the label delete operation fails.
-
isUserFavourite
public boolean isUserFavourite(com.atlassian.user.User user, AbstractPage page)
Description copied from interface:FavouriteManager
Returns whether a page or blog post is marked as a favourite for a user.- Specified by:
isUserFavourite
in interfaceFavouriteManager
-
addPageToFavourites
public void addPageToFavourites(com.atlassian.user.User user, AbstractPage page) throws NotAuthorizedException, org.springframework.dao.DataAccessException
Description copied from interface:FavouriteManager
Add a page or blog post to a user's favourites by attaching a personal label to the space.- Specified by:
addPageToFavourites
in interfaceFavouriteManager
- Parameters:
user
- The user to add the favourite on behalf of.- Throws:
NotAuthorizedException
- Thrown if the current user doesn't have permission to add the favourite.org.springframework.dao.DataAccessException
- If the label save operation fails.
-
removePageFromFavourites
public void removePageFromFavourites(com.atlassian.user.User user, AbstractPage page) throws NotAuthorizedException, org.springframework.dao.DataAccessException
Description copied from interface:FavouriteManager
Remove a page or blog post from a user's favourites.- Specified by:
removePageFromFavourites
in interfaceFavouriteManager
- Parameters:
user
- The user to remove the favourite on behalf of.- Throws:
NotAuthorizedException
- If the current user doesn't have permission to remove the favourite.org.springframework.dao.DataAccessException
- If the label delete operation fails.
-
hasPermission
public boolean hasPermission(com.atlassian.user.User user, Space space)
Description copied from interface:FavouriteManager
Get whether the current user has permission to add or remove a space favourite.- Specified by:
hasPermission
in interfaceFavouriteManager
-
hasPermission
public boolean hasPermission(com.atlassian.user.User user, AbstractPage page)
Description copied from interface:FavouriteManager
Get whether the current user has permission to add or remove a page favourite.- Specified by:
hasPermission
in interfaceFavouriteManager
-
-