com.atlassian.jira.user
Class CachingUserHistoryStore

java.lang.Object
  extended by com.atlassian.jira.user.CachingUserHistoryStore
All Implemented Interfaces:
Startable, UserHistoryStore

public class CachingUserHistoryStore
extends Object
implements UserHistoryStore, Startable

Caching implementation of UserHistoryStore. This is very broken, but no more broken than any of the other caches.

Since:
v4.0

Constructor Summary
CachingUserHistoryStore(OfBizUserHistoryStore delegatingStore, ApplicationProperties applicationProperties, com.atlassian.cache.CacheManager cacheManager)
           
 
Method Summary
 void addHistoryItem(ApplicationUser user, UserHistoryItem historyItem)
          Add a history item to the database.
 List<UserHistoryItem> getHistory(UserHistoryItem.Type type, ApplicationUser user)
          Retreive the history for a given user/type.
static int getMaxItems(UserHistoryItem.Type type, ApplicationProperties applicationProperties)
           
 void onClearCache(ClearCacheEvent event)
           
 Set<UserHistoryItem.Type> removeHistoryForUser(ApplicationUser user)
          Remove all history items for a given user.
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingUserHistoryStore

public CachingUserHistoryStore(@Nonnull
                               OfBizUserHistoryStore delegatingStore,
                               @Nonnull
                               ApplicationProperties applicationProperties,
                               @Nonnull
                               com.atlassian.cache.CacheManager cacheManager)
Method Detail

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.

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

addHistoryItem

public void addHistoryItem(@Nonnull
                           ApplicationUser user,
                           @Nonnull
                           UserHistoryItem historyItem)
Description copied from interface: UserHistoryStore
Add a history item to the database. This removes the currently refered to entity (user, type, id) from the list and then adds it. If adding it causes the history items stored for that user/type to exceed the max (jira.max.history.items) items allowed, it should remove the oldest items.

Specified by:
addHistoryItem in interface UserHistoryStore
Parameters:
user - The user to store the history item against
historyItem - the item to store. Containing a timestamp and referenced entity

getHistory

@Nonnull
public List<UserHistoryItem> getHistory(@Nonnull
                                                UserHistoryItem.Type type,
                                                @Nonnull
                                                ApplicationUser user)
Description copied from interface: UserHistoryStore
Retreive the history for a given user/type.

Specified by:
getHistory in interface UserHistoryStore
Parameters:
type - The type of entity to retreive history for.
user - The user to retreive history for.
Returns:
a list containing all stored history items for the passed in user/type.

removeHistoryForUser

public Set<UserHistoryItem.Type> removeHistoryForUser(@Nonnull
                                                      ApplicationUser user)
Description copied from interface: UserHistoryStore
Remove all history items for a given user.

Specified by:
removeHistoryForUser in interface UserHistoryStore
Parameters:
user - The user to remove all history of.
Returns:
The set of history types that were removed;

getMaxItems

public static int getMaxItems(UserHistoryItem.Type type,
                              ApplicationProperties applicationProperties)


Copyright © 2002-2014 Atlassian. All Rights Reserved.