com.atlassian.jira.user
Class OfBizUserHistoryStore

java.lang.Object
  extended by com.atlassian.jira.user.OfBizUserHistoryStore
All Implemented Interfaces:
UserHistoryStore

@ThreadSafe
public class OfBizUserHistoryStore
extends Object
implements UserHistoryStore

OfBiz implementation of UserHistoryStore

Since:
v4.0

Constructor Summary
OfBizUserHistoryStore(OfBizDelegator delegator, ApplicationProperties applicationProperties)
           
 
Method Summary
 void addHistoryItem(com.atlassian.crowd.embedded.api.User user, UserHistoryItem item)
          Add a history item to the database.
 void addHistoryItemNoChecks(com.atlassian.crowd.embedded.api.User user, UserHistoryItem item)
          Optimised method for adding a history item.
 void expireOldHistoryItems(com.atlassian.crowd.embedded.api.User user, UserHistoryItem.Type type, Collection<String> entityIds)
          Method for expiring old items.
 List<UserHistoryItem> getHistory(UserHistoryItem.Type type, com.atlassian.crowd.embedded.api.User user)
          Retreive the history for a given user/type.
 Set<UserHistoryItem.Type> removeHistoryForUser(com.atlassian.crowd.embedded.api.User user)
          Remove all history items for a given user.
 void updateHistoryItemNoChecks(com.atlassian.crowd.embedded.api.User user, UserHistoryItem item)
          Optimised method for updating a record in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OfBizUserHistoryStore

public OfBizUserHistoryStore(OfBizDelegator delegator,
                             ApplicationProperties applicationProperties)
Method Detail

addHistoryItem

public void addHistoryItem(@NotNull
                           com.atlassian.crowd.embedded.api.User user,
                           @NotNull
                           UserHistoryItem item)
Description copied from interface: UserHistoryStore
Add a history item to the database. This removes the currently refered 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
item - the item to store. Containing a timestamp and referenced entity

addHistoryItemNoChecks

public void addHistoryItemNoChecks(@NotNull
                                   com.atlassian.crowd.embedded.api.User user,
                                   @NotNull
                                   UserHistoryItem item)
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 for
item - Teh item to insert into the db

updateHistoryItemNoChecks

public void updateHistoryItemNoChecks(@NotNull
                                      com.atlassian.crowd.embedded.api.User user,
                                      @NotNull
                                      UserHistoryItem item)
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 for
item - The item to update

expireOldHistoryItems

public void expireOldHistoryItems(@NotNull
                                  com.atlassian.crowd.embedded.api.User user,
                                  @NotNull
                                  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 for
type - The type of record to remove
entityIds - Teh list of entity ids to remove.

getHistory

@NotNull
public List<UserHistoryItem> getHistory(@NotNull
                                                UserHistoryItem.Type type,
                                                @NotNull
                                                com.atlassian.crowd.embedded.api.User user)
Description copied from interface: UserHistoryStore
Retreive the history for a given user/type.

Specified by:
getHistory in interface UserHistoryStore
Parameters:
type - The type of entity to retreive history for.
user - The user to retreive history for.
Returns:
a list containing all stored history items for the passed in user/type.

removeHistoryForUser

public Set<UserHistoryItem.Type> removeHistoryForUser(@NotNull
                                                      com.atlassian.crowd.embedded.api.User 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;


Copyright © 2002-2012 Atlassian. All Rights Reserved.