com.atlassian.jira.favourites
Class CachingFavouritesStore

java.lang.Object
  extended by com.atlassian.jira.favourites.CachingFavouritesStore
All Implemented Interfaces:
Startable, FavouritesStore

public class CachingFavouritesStore
extends Object
implements FavouritesStore, Startable

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

Since:
v3.13

Constructor Summary
CachingFavouritesStore(FavouritesStore delegateStore, com.atlassian.cache.CacheManager cacheManager)
           
 
Method Summary
 boolean addFavourite(ApplicationUser user, SharedEntity entity)
          Create Favourites association between User and entity
 Collection<Long> getFavouriteIds(ApplicationUser user, SharedEntity.TypeDescriptor<?> entityType)
          Get the ids of a user's favourite Entities for a given entity type
 Collection<Long> getFavouriteIds(String userKey, SharedEntity.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.
 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, SharedEntity.TypeDescriptor<?> entityType)
          Remove the favourite associations for the given User and the given type
 void start()
          This method wil 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingFavouritesStore

public CachingFavouritesStore(FavouritesStore delegateStore,
                              com.atlassian.cache.CacheManager cacheManager)
Method Detail

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

addFavourite

public boolean addFavourite(ApplicationUser user,
                            SharedEntity entity)
Description copied from interface: FavouritesStore
Create Favourites association between User and entity

Specified by:
addFavourite in interface FavouritesStore
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.

removeFavourite

public boolean removeFavourite(ApplicationUser user,
                               SharedEntity entity)
Description copied from interface: FavouritesStore
Remove Favourites association between User and entity

Specified by:
removeFavourite in interface FavouritesStore
Parameters:
user - to disassociate entity with
entity - the entity to disassociate with
Returns:
true if association was successfully removed, else false

isFavourite

public boolean isFavourite(ApplicationUser user,
                           SharedEntity entity)
Description copied from interface: FavouritesStore
Checks to see if entity is a favourite of the user passed in.

Specified by:
isFavourite in interface FavouritesStore
Parameters:
user - to check entity with
entity - the entity to check with
Returns:
true if user has favourite association with entity

getFavouriteIds

public Collection<Long> getFavouriteIds(ApplicationUser user,
                                        SharedEntity.TypeDescriptor<?> entityType)
Description copied from interface: FavouritesStore
Get the ids of a user's favourite Entities for a given entity type

Specified by:
getFavouriteIds in interface FavouritesStore
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

getFavouriteIds

public Collection<Long> getFavouriteIds(String userKey,
                                        SharedEntity.TypeDescriptor<?> entityType)
Description copied from interface: FavouritesStore
Get the ids of a user's favourite Entities for a given entity type

Specified by:
getFavouriteIds in interface FavouritesStore
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

removeFavouritesForUser

public void removeFavouritesForUser(ApplicationUser user,
                                    SharedEntity.TypeDescriptor<?> entityType)
Description copied from interface: FavouritesStore
Remove the favourite associations for the given User and the given type

Specified by:
removeFavouritesForUser in interface FavouritesStore
Parameters:
user - The user with whom to disassociate entities with
entityType - The type of entity to disassociate user with.

removeFavouritesForEntity

public void removeFavouritesForEntity(SharedEntity entity)
Description copied from interface: FavouritesStore
Remove all favourite associations for a given entity.

Specified by:
removeFavouritesForEntity in interface FavouritesStore
Parameters:
entity - The entity to remove all associations with

updateSequence

public void updateSequence(ApplicationUser user,
                           List<? extends SharedEntity> favouriteEntities)
Description copied from interface: FavouritesStore
Called to update the sequence of a list of favourite shared entities

Specified by:
updateSequence in interface FavouritesStore
Parameters:
user - the user in play
favouriteEntities - the list specifying the order of the SharedEntitys

start

public void start()
           throws Exception
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable
Throws:
Exception - Allows implementations to throw an Exception.


Copyright © 2002-2014 Atlassian. All Rights Reserved.