public class CachingUserHistoryStore extends Object implements UserHistoryStore, Startable
UserHistoryStore
.
This is very broken, but no more broken than any of the other caches.Constructor and Description |
---|
CachingUserHistoryStore(OfBizUserHistoryStore delegatingStore,
ApplicationProperties applicationProperties,
com.atlassian.cache.CacheManager cacheManager) |
Modifier and Type | Method and Description |
---|---|
void |
addHistoryItem(ApplicationUser user,
UserHistoryItem historyItem)
Add a history item to the database.
|
List<UserHistoryItem> |
getHistory(UserHistoryItem.Type type,
ApplicationUser user)
Retrieve the history for a given user/type.
|
List<UserHistoryItem> |
getHistory(UserHistoryItem.Type type,
String userKey)
Retrieve 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 |
removeHistoryOlderThan(Long timestamp)
Method for removing old user history items.
|
void |
start()
This method will be called after the plugin system is fully initialised and all components added to the
dependency injection framework.
|
public CachingUserHistoryStore(@Nonnull OfBizUserHistoryStore delegatingStore, @Nonnull ApplicationProperties applicationProperties, @Nonnull com.atlassian.cache.CacheManager cacheManager)
public void start() throws Exception
Startable
@EventListener public void onClearCache(ClearCacheEvent event)
public void addHistoryItem(ApplicationUser user, @Nonnull UserHistoryItem historyItem)
UserHistoryStore
addHistoryItem
in interface UserHistoryStore
user
- The user to store the history item againsthistoryItem
- the item to store. Containing a timestamp and referenced entity@Nonnull public List<UserHistoryItem> getHistory(@Nonnull UserHistoryItem.Type type, @Nonnull String userKey)
UserHistoryStore
getHistory
in interface UserHistoryStore
type
- The type of entity to retrieve history for.userKey
- The key of the user to retrieve history for.@Nonnull public List<UserHistoryItem> getHistory(@Nonnull UserHistoryItem.Type type, @Nonnull ApplicationUser user)
UserHistoryStore
getHistory
in interface UserHistoryStore
type
- The type of entity to retrieve history for.user
- The user to retrieve history for.public Set<UserHistoryItem.Type> removeHistoryForUser(@Nonnull ApplicationUser user)
UserHistoryStore
removeHistoryForUser
in interface UserHistoryStore
user
- The user to remove all history of.public void removeHistoryOlderThan(@Nonnull Long timestamp)
UserHistoryStore
removeHistoryOlderThan
in interface UserHistoryStore
timestamp
- remove elements older than this timestamppublic static int getMaxItems(UserHistoryItem.Type type, ApplicationProperties applicationProperties)
Copyright © 2002-2015 Atlassian. All Rights Reserved.