Package com.atlassian.jira.favourites
Interface FavouritesManager<S extends SharedEntity>
- All Known Implementing Classes:
DefaultFavouritesManager
Manager for basic Favourites functionality. Used for adding, removing and checking favourites of generic entities. It also adjusts favourite counts
for entities
- Since:
- v3.13
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddFavourite(ApplicationUser user, S entity) Add the given entity as a favourite of the user passed in add to favourites count if necessary.voidaddFavouriteInPosition(ApplicationUser user, S entity, long position) Add the given entity as a favourite of the user passed in, in the specified position, add to favourites count if necessary.voiddecreaseFavouriteSequence(ApplicationUser user, S entity) Decreases the position of theSharedEntityrelative to the user's set of all other entities of the same type.getFavouriteIds(ApplicationUser user, SharedEntity.TypeDescriptor<S> entityType) Get the ids of a user's favourite Entities for a given entity typevoidincreaseFavouriteSequence(ApplicationUser user, S entity) Increases the position of theSharedEntityrelative to the user's set of all other entities of the same type.booleanisFavourite(ApplicationUser user, S entity) Check to see if the given entity is a favourite of the user passed in.voidmoveToEndFavouriteSequence(ApplicationUser user, S entity) Moves the position of theSharedEntityto the end relative to the user's set of all other entities of the same type.voidmoveToStartFavouriteSequence(ApplicationUser user, S entity) Moves the position of theSharedEntityto the start relative to the user's set of all other entities of the same type.voidremoveFavourite(ApplicationUser user, S entity) Remove the given entity as a favourite of the user passed in.voidRemove all favourite associations for a given entity for entity deletion.voidremoveFavouritesForUser(ApplicationUser user, SharedEntity.TypeDescriptor<S> entityType) Remove the favourite associations for the given User and the given type
-
Method Details
-
addFavourite
Add the given entity as a favourite of the user passed in add to favourites count if necessary.- Parameters:
user- The user adding the favouriteentity- The entity to favourite- Throws:
PermissionException- when trying to add a filter as favourite when you have no permissions
-
addFavouriteInPosition
void addFavouriteInPosition(ApplicationUser user, S entity, long position) throws PermissionException Add the given entity as a favourite of the user passed in, in the specified position, add to favourites count if necessary. The entity currently in the specified position and all those after will be moved down one position.- Parameters:
user- The user adding the favouriteentity- The entity to favouriteposition- the position in which this entity should be added in the favourites order.- Throws:
PermissionException- when trying to add a filter as favourite when you have no permissions
-
removeFavourite
Remove the given entity as a favourite of the user passed in. Remove even if user doesn't have permission to see it and adjust count of favourites if necessary.- Parameters:
user- The user removing the favouriteentity- The entity to favourite
-
isFavourite
Check to see if the given entity is a favourite of the user passed in.- Parameters:
user- The user checking the favouriteentity- The entity to favourite- Returns:
- true if the entity is favourite and can be seen by user, otherwise false
- Throws:
PermissionException- when checking a filter with no permission
-
increaseFavouriteSequence
Increases the position of theSharedEntityrelative to the user's set of all other entities of the same type.- Parameters:
user- the user whom the entity belongs toentity- The entity in question- Throws:
PermissionException- when the user does not have permission to perform the action.
-
decreaseFavouriteSequence
Decreases the position of theSharedEntityrelative to the user's set of all other entities of the same type.- Parameters:
user- the user whom the entity belongs toentity- The entity in question- Throws:
PermissionException- when the user does not have permission to perform the action.
-
moveToStartFavouriteSequence
Moves the position of theSharedEntityto the start relative to the user's set of all other entities of the same type.- Parameters:
user- the user whom the entity belongs toentity- The entity in question- Throws:
PermissionException- when the user does not have permission to perform the action.
-
moveToEndFavouriteSequence
Moves the position of theSharedEntityto the end relative to the user's set of all other entities of the same type.- Parameters:
user- the user whom the entity belongs toentity- The entity in question- Throws:
PermissionException- when the user does not have permission to perform the action.
-