Interface UserHistoryStore

All Known Implementing Classes:
CachingUserHistoryStore, OfBizUserHistoryStore, SessionBasedAnonymousUserHistoryStore

public interface UserHistoryStore
Store interface for UserHistoryItem objects.
Since:
v4.0
  • Method Details

    • addHistoryItem

      void addHistoryItem(@Nullable ApplicationUser user, @Nonnull 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
    • getHistory

      @Nonnull List<UserHistoryItem> getHistory(@Nonnull UserHistoryItem.Type type, @Nonnull 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.
    • removeHistoryForUser

      Set<UserHistoryItem.Type> removeHistoryForUser(@Nonnull 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;
    • removeHistoryOlderThan

      void removeHistoryOlderThan(@Nonnull Long timestamp)
      Method for removing old user history items. Removes elements older than provided timestamp, but not younger than 30 days.
      Parameters:
      timestamp - remove elements older than this timestamp
      Throws:
      IllegalArgumentException - If provided timestamp is not at least 30 days old
    • getHistory

      @Nonnull List<UserHistoryItem> getHistory(@Nonnull UserHistoryItem.Type type, @Nonnull 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.