Package com.atlassian.jira.user
Class OfBizUserHistoryStore
java.lang.Object
com.atlassian.jira.user.OfBizUserHistoryStore
- All Implemented Interfaces:
UserHistoryStore
OfBiz implementation of
UserHistoryStore- Since:
- v4.0
-
Constructor Summary
ConstructorsConstructorDescriptionOfBizUserHistoryStore(OfBizDelegator delegator, ApplicationProperties applicationProperties) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHistoryItem(ApplicationUser user, UserHistoryItem item) Add a history item to the database.voidaddHistoryItemNoChecks(ApplicationUser user, UserHistoryItem item) Optimised method for adding a history item.voidexpireOldHistoryItems(ApplicationUser user, UserHistoryItem.Type type, Collection<String> entityIds) Method for expiring old items.getHistory(UserHistoryItem.Type type, ApplicationUser user) Retrieve the history for a given user/type.getHistory(UserHistoryItem.Type type, String userKey) Retrieve the history for a given user/type.Remove all history items for a given user.voidremoveHistoryOlderThan(Long timestamp) Method for removing old user history items.voidupdateHistoryItemNoChecks(ApplicationUser user, UserHistoryItem item) Optimised method for updating a record in the database.
-
Constructor Details
-
OfBizUserHistoryStore
-
-
Method Details
-
addHistoryItem
Description copied from interface:UserHistoryStoreAdd 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:
addHistoryItemin interfaceUserHistoryStore- Parameters:
user- The user to store the history item againstitem- the item to store. Containing a timestamp and referenced entity
-
addHistoryItemNoChecks
Optimised method for adding a history item. This will throw a duplicate row exception from the db if you try and insert a history item that already exists. Should only call if we are sure it doesn't exist.This does not expire old items or try and update existing items. It is dumb.
- Parameters:
user- The user to insert the record foritem- Teh item to insert into the db
-
updateHistoryItemNoChecks
Optimised method for updating a record in the database. If the record doesn't exist it will create it, otherwise just update it.This does not expire old items or try and update existing items. It is dumb.
- Parameters:
user- The user to update the record foritem- The item to update
-
expireOldHistoryItems
public void expireOldHistoryItems(@Nonnull ApplicationUser user, @Nonnull UserHistoryItem.Type type, Collection<String> entityIds) Method for expiring old items. You can actually delete any items but it is typically used to delete old records.- Parameters:
user- The user to remove entries fortype- The type of record to removeentityIds- The list of entity ids to remove.
-
getHistory
@Nonnull public List<UserHistoryItem> getHistory(@Nonnull UserHistoryItem.Type type, @Nonnull String userKey) Description copied from interface:UserHistoryStoreRetrieve the history for a given user/type.- Specified by:
getHistoryin interfaceUserHistoryStore- 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:UserHistoryStoreRetrieve the history for a given user/type.- Specified by:
getHistoryin interfaceUserHistoryStore- 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
Description copied from interface:UserHistoryStoreRemove all history items for a given user.- Specified by:
removeHistoryForUserin interfaceUserHistoryStore- Parameters:
user- The user to remove all history of.- Returns:
- The set of history types that were removed;
-
removeHistoryOlderThan
Description copied from interface:UserHistoryStoreMethod for removing old user history items. Removes elements older than provided timestamp, but not younger than 30 days.- Specified by:
removeHistoryOlderThanin interfaceUserHistoryStore- Parameters:
timestamp- remove elements older than this timestamp
-