@PublicApi public interface

FavouritesService

com.atlassian.jira.bc.favourites.FavouritesService
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

Service for basic Favourites functionality. Used for adding, removing and checking favourites of generic entities. Initially used by SearchRequests and Dashboards but can be easily extended.

Summary

Public Methods
void addFavourite(JiraServiceContext ctx, SharedEntity entity)
Add the given entity as a favourite of the user passed in the context
void addFavouriteInPosition(JiraServiceContext ctx, SharedEntity entity, long position)
Add the given entity as a favourite of the user passed in the context and place it in the specified position.
boolean isFavourite(ApplicationUser user, SharedEntity entity)
Check that the given entity is a favourite of the user passed in the context
boolean isFavourite(User user, SharedEntity entity)
This method is deprecated. Use isFavourite(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.sharing.SharedEntity) instead. Since v6.0. Check that the given entity is a favourite of the user passed in the context
void removeFavourite(JiraServiceContext ctx, SharedEntity entity)
Remove the given entity as a favourite of the user passed in the context

Public Methods

public void addFavourite (JiraServiceContext ctx, SharedEntity entity)

Add the given entity as a favourite of the user passed in the context

Parameters
ctx JIRA Service context
entity The entity to favourite

public void addFavouriteInPosition (JiraServiceContext ctx, SharedEntity entity, long position)

Add the given entity as a favourite of the user passed in the context and place it in the specified position. The entity currently in the specified position and all those after will be moved down one position.

Parameters
ctx JIRA Service Context holding the current user
entity the entity to favourite
position the position in which this entity should be added in the favourites order.

public boolean isFavourite (ApplicationUser user, SharedEntity entity)

Check that the given entity is a favourite of the user passed in the context

Parameters
user the user to check for
entity The entity to check favourite
Returns
  • true if entity is a favourite, otherwise false

public boolean isFavourite (User user, SharedEntity entity)

This method is deprecated.
Use isFavourite(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.sharing.SharedEntity) instead. Since v6.0. Check that the given entity is a favourite of the user passed in the context

Parameters
user the user to check for
entity The entity to check favourite
Returns
  • true if entity is a favourite, otherwise false

public void removeFavourite (JiraServiceContext ctx, SharedEntity entity)

Remove the given entity as a favourite of the user passed in the context

Parameters
ctx JIRA Service context
entity The entity to unfavourite