public class

CachingFavouritesStore

extends Object
implements Startable FavouritesStore
java.lang.Object
   ↳ com.atlassian.jira.favourites.CachingFavouritesStore

Class Overview

Cache is keyed on userkey:type. This is very broken, but no more broken than any of the other caches.

Summary

Public Constructors
CachingFavouritesStore(FavouritesStore delegateStore, CacheManager cacheManager)
Public Methods
boolean addFavourite(ApplicationUser user, SharedEntity entity)
Create Favourites association between User and entity
Collection<Long> getFavouriteIds(ApplicationUser user, TypeDescriptor<?> entityType)
Get the ids of a user's favourite Entities for a given entity type
Collection<Long> getFavouriteIds(String userKey, TypeDescriptor<?> entityType)
Get the ids of a user's favourite Entities for a given entity type
boolean isFavourite(ApplicationUser user, SharedEntity entity)
Checks to see if entity is a favourite of the user passed in.
@EventListener void onClearCache(ClearCacheEvent event)
boolean removeFavourite(ApplicationUser user, SharedEntity entity)
Remove Favourites association between User and entity
void removeFavouritesForEntity(SharedEntity entity)
Remove all favourite associations for a given entity.
void removeFavouritesForUser(ApplicationUser user, TypeDescriptor<?> entityType)
Remove the favourite associations for the given User and the given type
void start()
This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.
void updateSequence(ApplicationUser user, List<? extends SharedEntity> favouriteEntities)
Called to update the sequence of a list of favourite shared entities
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.extension.Startable
From interface com.atlassian.jira.favourites.FavouritesStore

Public Constructors

public CachingFavouritesStore (FavouritesStore delegateStore, CacheManager cacheManager)

Public Methods

public boolean addFavourite (ApplicationUser user, SharedEntity entity)

Create Favourites association between User and entity

Parameters
user User to associate entity with
entity the entity to associate with
Returns
  • true if association was successfully made, else false if it wasn't made or already existed.

public Collection<Long> getFavouriteIds (ApplicationUser user, TypeDescriptor<?> entityType)

Get the ids of a user's favourite Entities for a given entity type

Parameters
user The user for the associated entities
entityType The type of entities to get. E.g. SearchRequest.ENTITY_TYPE
Returns
  • A Collection on Longs that represent the entities

public Collection<Long> getFavouriteIds (String userKey, TypeDescriptor<?> entityType)

Get the ids of a user's favourite Entities for a given entity type

Parameters
userKey The key of the user for the associated entities
entityType The type of entities to get. E.g. SearchRequest.ENTITY_TYPE
Returns
  • A Collection on Longs that represent the entities

public boolean isFavourite (ApplicationUser user, SharedEntity entity)

Checks to see if entity is a favourite of the user passed in.

Parameters
user to check entity with
entity the entity to check with
Returns
  • true if user has favourite association with entity

@EventListener public void onClearCache (ClearCacheEvent event)

public boolean removeFavourite (ApplicationUser user, SharedEntity entity)

Remove Favourites association between User and entity

Parameters
user to disassociate entity with
entity the entity to disassociate with
Returns
  • true if association was successfully removed, else false

public void removeFavouritesForEntity (SharedEntity entity)

Remove all favourite associations for a given entity.

Parameters
entity The entity to remove all associations with

public void removeFavouritesForUser (ApplicationUser user, TypeDescriptor<?> entityType)

Remove the favourite associations for the given User and the given type

Parameters
user The user with whom to disassociate entities with
entityType The type of entity to disassociate user with.

public void start ()

This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Throws
Exception

public void updateSequence (ApplicationUser user, List<? extends SharedEntity> favouriteEntities)

Called to update the sequence of a list of favourite shared entities

Parameters
user the user in play
favouriteEntities the list specifying the order of the SharedEntitys