Class CachingUserHistoryStore

java.lang.Object
com.atlassian.jira.user.CachingUserHistoryStore
All Implemented Interfaces:
UserHistoryStore

public class CachingUserHistoryStore extends Object implements UserHistoryStore
Caching implementation of UserHistoryStore. This is very broken, but no more broken than any of the other caches.
Since:
v4.0
  • Constructor Details

    • CachingUserHistoryStore

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

    • onComponentManagerStarted

      @EventListener public void onComponentManagerStarted(ComponentManagerStartedEvent startedEvent)
      Schedules the cache cleanup task.
    • onComponentManagerShutdown

      @EventListener public void onComponentManagerShutdown(ComponentManagerShutdownEvent shutdownEvent)
    • onClearCache

      @EventListener public void onClearCache(ClearCacheEvent event)
    • onUserHistoryItemFKChangedEvent

      @EventListener public void onUserHistoryItemFKChangedEvent(UserHistoryItemFKChangedEvent event)
    • addHistoryItem

      public void addHistoryItem(ApplicationUser user, @Nonnull UserHistoryItem historyItem)
      Description copied from interface: UserHistoryStore
      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.
      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 String userKey)
      Description copied from interface: UserHistoryStore
      Retrieve the history for a given user/type.
      Specified by:
      getHistory in interface UserHistoryStore
      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.
    • getHistory

      @Nonnull public List<UserHistoryItem> getHistory(@Nonnull UserHistoryItem.Type type, @Nonnull ApplicationUser user)
      Description copied from interface: UserHistoryStore
      Retrieve the history for a given user/type.
      Specified by:
      getHistory in interface UserHistoryStore
      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.
    • 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;
    • removeHistoryOlderThan

      public void removeHistoryOlderThan(@Nonnull Long timestamp)
      Description copied from interface: UserHistoryStore
      Method for removing old user history items. Removes elements older than provided timestamp, but not younger than 30 days.
      Specified by:
      removeHistoryOlderThan in interface UserHistoryStore
      Parameters:
      timestamp - remove elements older than this timestamp
    • getMaxItems

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