public class

CachingUserHistoryStore

extends Object
implements Startable UserHistoryStore
java.lang.Object
   ↳ com.atlassian.jira.user.CachingUserHistoryStore

Class Overview

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

Summary

Public Constructors
CachingUserHistoryStore(OfBizUserHistoryStore delegatingStore, ApplicationProperties applicationProperties, CacheManager cacheManager)
Public Methods
void addHistoryItem(ApplicationUser user, UserHistoryItem historyItem)
Add a history item to the database.
@Nonnull List<UserHistoryItem> getHistory(UserHistoryItem.Type type, ApplicationUser user)
Retrieve the history for a given user/type.
@Nonnull List<UserHistoryItem> getHistory(UserHistoryItem.Type type, String userKey)
Retrieve the history for a given user/type.
static int getMaxItems(UserHistoryItem.Type type, ApplicationProperties applicationProperties)
@EventListener 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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.extension.Startable
From interface com.atlassian.jira.user.UserHistoryStore

Public Constructors

public CachingUserHistoryStore (OfBizUserHistoryStore delegatingStore, ApplicationProperties applicationProperties, CacheManager cacheManager)

Public Methods

public void addHistoryItem (ApplicationUser user, UserHistoryItem historyItem)

Add a history item to the database. This removes the currently referred 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.

Parameters
user The user to store the history item against
historyItem the item to store. Containing a timestamp and referenced entity

@Nonnull public List<UserHistoryItem> getHistory (UserHistoryItem.Type type, ApplicationUser user)

Retrieve the history for a given user/type.

Parameters
type The type of entity to retrieve history for.
user The user to retrieve history for.
Returns
  • a list containing all stored history items for the passed in user/type.

@Nonnull public List<UserHistoryItem> getHistory (UserHistoryItem.Type type, String userKey)

Retrieve the history for a given user/type.

Parameters
type The type of entity to retrieve history for.
userKey The key of the user to retrieve history for.
Returns
  • a list containing all stored history items for the passed in user/type.

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

@EventListener public void onClearCache (ClearCacheEvent event)

public Set<UserHistoryItem.Type> removeHistoryForUser (ApplicationUser user)

Remove all history items for a given user.

Parameters
user The user to remove all history of.
Returns
  • The set of history types that were removed;

public void start ()

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

Throws
Exception