public class

DefaultChangeHistoryManager

extends Object
implements ChangeHistoryManager
java.lang.Object
   ↳ com.atlassian.jira.issue.changehistory.DefaultChangeHistoryManager

Summary

Constants
String HISTORY_METADATA_KEY
Public Constructors
DefaultChangeHistoryManager(IssueManager issueManager, OfBizDelegator ofBizDelegator, PermissionManager permissionManager, ComponentLocator componentLocator, UserManager userManager, JsonEntityPropertyManager jsonEntityPropertyManager)
Public Methods
@Deprecated Map<StringString> findAllPossibleValues(String field)
Find a map of all names ever used in the change history.
Issue findMovedIssue(String originalKey)
Returns an issue that has been moved by searching on the old issue key.
Collection<Issue> findUserHistory(ApplicationUser remoteUser, Collection<String> userkeys, Collection<Project> projects, int maxResults)
Find a list of issues that the given users have acted on with the option to limit the projects included in the search.
Collection<Issue> findUserHistory(ApplicationUser remoteUser, Collection<String> userkeys, int maxResults)
Find a list of issues that the given users have acted on.
List<ChangeHistoryItem> getAllChangeItems(Issue issue)
Returns a List of ChangeHistoryItem's for the given issue
List<ChangeHistory> getChangeHistories(Issue issue)
Returns a List of ChangeHistory entities
List<ChangeHistory> getChangeHistoriesForUser(Issue issue, ApplicationUser remoteUser)
Returns a List of ChangeHistory entities for a single issue.
List<ChangeHistory> getChangeHistoriesForUser(Iterable<Issue> issues, ApplicationUser remoteUser)
Returns a List of ChangeHistory entities for multiple issues.
@Nonnull List<ChangeHistory> getChangeHistoriesSince(Issue issue, Date since)
Returns a List of ChangeHistory entities that occurred after the provided date.
@Nullable ChangeHistory getChangeHistoryById(Long changeGroupId)
List<ChangeItemBean> getChangeItemsForField(Issue issue, String changeItemFieldName)
Returns a List of ChangeItemBean's for the given issue which also are for the provided changeItemFieldName (i.e.
List<ChangeHistory> getChangeItemsWithFieldsForIssues(Iterable<Issue> issues, Iterable<String> fieldNames)
Returns a List of ChangeHistory for the listed issues with changes only for the listed fields.
Collection<String> getPreviousIssueKeys(String issueKey)
Given an issue key, this method returns a list of previous issue keys this issue was moved from.
Collection<String> getPreviousIssueKeys(Long issueId)
Returns the same as getPreviousIssueKeys(String) but is slightly more efficient since no lookup of the issue id needs to be performed.
void removeAllChangeItems(Issue issue)
Remove all change items associated with an issue.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.issue.changehistory.ChangeHistoryManager

Constants

public static final String HISTORY_METADATA_KEY

Constant Value: "history_metadata"

Public Constructors

public DefaultChangeHistoryManager (IssueManager issueManager, OfBizDelegator ofBizDelegator, PermissionManager permissionManager, ComponentLocator componentLocator, UserManager userManager, JsonEntityPropertyManager jsonEntityPropertyManager)

Public Methods

@Deprecated public Map<StringString> findAllPossibleValues (String field)

Find a map of all names ever used in the change history.

Parameters
field The field name.
Returns
  • An immutable map of issue objects sorted by creation date in descending order

public Issue findMovedIssue (String originalKey)

Returns an issue that has been moved by searching on the old issue key.

Parameters
originalKey the original key of an issue that has since been moved (moving between projects assigns a new key to an issue)
Returns

public Collection<Issue> findUserHistory (ApplicationUser remoteUser, Collection<String> userkeys, Collection<Project> projects, int maxResults)

Find a list of issues that the given users have acted on with the option to limit the projects included in the search.

Parameters
remoteUser The user executing this request.
userkeys The keys of users to find the history for. If null, returns the history for all users. If empty, no results will be found.
projects The projects to include issues from
maxResults The maxmimum number of issues to return
Returns
  • An immutable collection of issue objects sorted by creation date in descending order

public Collection<Issue> findUserHistory (ApplicationUser remoteUser, Collection<String> userkeys, int maxResults)

Find a list of issues that the given users have acted on.

Parameters
remoteUser The user executing this request.
userkeys The keys of users to find the history for. If null, returns the history for all users. If empty, no results will be found.
maxResults The maxmimum number of issues to return
Returns
  • An immutable collection of issue objects sorted by creation date in descending order

public List<ChangeHistoryItem> getAllChangeItems (Issue issue)

Returns a List of ChangeHistoryItem's for the given issue

Parameters
issue the issue
Returns
  • A list containing all of the change items for a specific Issue

public List<ChangeHistory> getChangeHistories (Issue issue)

Returns a List of ChangeHistory entities

Parameters
issue the issue.
Returns
  • a List of ChangeHistory entries.

public List<ChangeHistory> getChangeHistoriesForUser (Issue issue, ApplicationUser remoteUser)

Returns a List of ChangeHistory entities for a single issue.

Parameters
issue the issue.
remoteUser the user who is asking.
Returns
  • a List of ChangeHistory entries.

public List<ChangeHistory> getChangeHistoriesForUser (Iterable<Issue> issues, ApplicationUser remoteUser)

Returns a List of ChangeHistory entities for multiple issues. This method is much more efficient than #getChangeHistoriesForUser(com.atlassian.jira.issue.Issue, com.atlassian.crowd.embedded.api.User) and should be prefered whenever possible.

Parameters
issues the issues.
remoteUser the user who is asking.
Returns
  • a List of ChangeHistory entries.

@Nonnull public List<ChangeHistory> getChangeHistoriesSince (Issue issue, Date since)

Returns a List of ChangeHistory entities that occurred after the provided date.

Parameters
issue the issue. Must not be null.
since only change histories made after this date will be returned. Must not be null.
Returns
  • a possibly empty List of ChangeHistory entries made after the provided date. Will not be null.

@Nullable public ChangeHistory getChangeHistoryById (Long changeGroupId)

public List<ChangeItemBean> getChangeItemsForField (Issue issue, String changeItemFieldName)

Returns a List of ChangeItemBean's for the given issue which also are for the provided changeItemFieldName (i.e. Link, Fix Version/s, etc). The order of the list will from oldest to newest.

Parameters
issue the issue the change items are associated with, not null.
changeItemFieldName the field name the change item is stored under, not null or empty.
Returns
  • a List of ChangeItemBean's for the given issue.

public List<ChangeHistory> getChangeItemsWithFieldsForIssues (Iterable<Issue> issues, Iterable<String> fieldNames)

Returns a List of ChangeHistory for the listed issues with changes only for the listed fields.

Parameters
issues The list of issues to search
fieldNames The list of field names
Returns
  • A list of changes.

public Collection<String> getPreviousIssueKeys (String issueKey)

Given an issue key, this method returns a list of previous issue keys this issue was moved from. This may be useful for source control plugins for example, where a given changeset should be displayed even after an issue has been moved and it's issue key has changed.

Note: The list of previous issue keys is no longer returned in chronological order.

Parameters
issueKey The current issue key.
Returns
  • A collection of previous issue keys or an empty list if none exist.

public Collection<String> getPreviousIssueKeys (Long issueId)

Returns the same as getPreviousIssueKeys(String) but is slightly more efficient since no lookup of the issue id needs to be performed. If you have an issue object available with the issue's id use this method.

Parameters
issueId The id of the issue being looked up.
Returns
  • A collection of previous issue keys or an empty list if none exist.

public void removeAllChangeItems (Issue issue)

Remove all change items associated with an issue.

Parameters
issue affected issue