public class

DefaultIssueManager

extends Object
implements IssueManager
java.lang.Object
   ↳ com.atlassian.jira.issue.managers.DefaultIssueManager

Summary

Public Constructors
DefaultIssueManager(OfBizDelegator ofBizDelegator, WorkflowManager workflowManager, NodeAssociationStore nodeAssociationStore, UserAssociationStore userAssociationStore, IssueUpdater issueUpdater, PermissionManager permissionManager, MovedIssueKeyStore movedIssueKeyStore, ProjectKeyStore projectKeyStore)
Public Methods
GenericValue createIssue(User remoteUser, Issue issue)
Persists a new issue.
GenericValue createIssue(User remoteUser, Map<StringObject> fields)
This function creates an issue in Jira.
GenericValue createIssue(String remoteUserName, Map<StringObject> fields)
This method is here because this is a logical place for the "createIssue" method to be.
Issue createIssueObject(User remoteUser, Issue issue)
Creates an issue.
Issue createIssueObject(String remoteUserName, Map<StringObject> fields)
Creates an issue.
Issue createIssueObject(User remoteUser, Map<StringObject> fields)
Creates an issue.
void deleteIssue(User user, MutableIssue issue, EventDispatchOption eventDispatchOption, boolean sendMail)
This method will delete an issue from JIRA.
void deleteIssue(User user, Issue issue, EventDispatchOption eventDispatchOption, boolean sendMail)
This method will delete an issue from JIRA.
void deleteIssueNoEvent(Issue issue)
Delete issue without firing any events, or sending notifications.
void deleteIssueNoEvent(MutableIssue issue)
Delete issue without firing any events, or sending notifications.
Issue findMovedIssue(String originalKey)
Returns an issue that has been moved by searching on the old issue key.
Set<String> getAllIssueKeys(Long issueId)
Returns all issue keys that are associated with Issue.
List<GenericValue> getEntitiesByIssue(String relationName, GenericValue issue)
Get a list of entities (versions, components etc) related to this issue.
List<GenericValue> getEntitiesByIssueObject(String relationName, Issue issue)
Get a list of entities (versions, components etc) related to this issue.
GenericValue getIssue(Long id)
Retrieves an issue by its id.
GenericValue getIssue(String key)
Retrieves the issue as a GenericValue with the given key.
MutableIssue getIssueByCurrentKey(String key)
Retrieves the Issue that has the given key, or null if no such Issue exists.
MutableIssue getIssueByKeyIgnoreCase(String key)
Retrieves the Issue that has the given key, or null if no such Issue exists.
GenericValue getIssueByWorkflow(Long wfid)
Retrieves an issue GenericValue given a workflow ID.
long getIssueCount()
Returns the number of issues.
long getIssueCountForProject(Long projectId)
Returns the number of issues that exist for the provided project id.
Collection<Long> getIssueIdsForProject(Long projectId)
Retrieve a collection of all issue ids that belong to a given project.
MutableIssue getIssueObject(String key)
Retrieves the Issue that has the given key, or null if no such Issue exists.
MutableIssue getIssueObject(Long id)
Retrieves an issue by id.
MutableIssue getIssueObjectByWorkflow(Long workflowId)
Retrieves an issue given a workflow ID.
List<Issue> getIssueObjects(Collection<Long> ids)
Get issues with the following ids.
List<Issue> getIssueObjectsByEntity(String relationName, GenericValue entity)
Get a list of issues related to an entity (version, component etc).
List<GenericValue> getIssues(Collection<Long> ids)
Get issues with the following ids.
List<GenericValue> getIssuesByEntity(String relationName, GenericValue entity)
Get a list of issues related to an entity (version, component etc).
List<GenericValue> getProjectIssues(GenericValue project)
Get all the issues for a given project.
long getUnassignedIssueCount()
Returns the number of unassigned issues.
List<Issue> getVotedIssues(ApplicationUser user)
Get a list of issues that the user has voted on and can see.
List<Issue> getVotedIssues(User user)
Get a list of issues that the user has voted on and can see.
List<Issue> getVotedIssuesOverrideSecurity(ApplicationUser user)
Get a list of issues that the user has voted on.
List<Issue> getVotedIssuesOverrideSecurity(User user)
Get a list of issues that the user has voted on.
List<Issue> getWatchedIssues(ApplicationUser user)
Get a list of issues that the user is watching and can see.
List<Issue> getWatchedIssues(User user)
Get a list of issues that the user is watching and can see.
List<Issue> getWatchedIssuesOverrideSecurity(ApplicationUser user)
Get a list of issues that the user is watching
List<Issue> getWatchedIssuesOverrideSecurity(User user)
Get a list of issues that the user is watching
List<User> getWatchers(Issue issue)
Return a list of watchers for a particular issue.
List<ApplicationUser> getWatchersFor(Issue issue)
Return a list of watchers for a particular issue.
boolean hasUnassignedIssues()
Returns a boolean indicating whether there are unassigned issues.
boolean isEditable(Issue issue, User user)
Returns true if the issue can be edited by the current user.
boolean isEditable(Issue issue)
Returns true if the issue can be edited.
boolean isExistingIssueKey(String issueKey)
Returns true if issue with a given key exists (it looks for issues having current issue key set for the value, and moved issue keys that used the key).
void recordMovedIssueKey(Issue oldIssue)
Used internally when we want to record that an Issue has changed its Issue key (because it has moved project).
Issue updateIssue(User user, MutableIssue issue, EventDispatchOption eventDispatchOption, boolean sendMail)
This method will store the provided issue to the JIRA datastore.
Issue updateIssue(ApplicationUser user, MutableIssue issue, UpdateIssueRequest updateIssueRequest)
This method will store the provided issue to the JIRA datastore.
Protected Methods
void doUpdate(ApplicationUser user, MutableIssue issue, GenericValue originalIssueGV, DefaultIssueChangeHolder issueChangeHolder, UpdateIssueRequest updateRequest)
MutableIssue getIssueObject(GenericValue issueGV)
Creates a MutableIssue object from an Issue GenericValue.
DefaultIssueChangeHolder updateFieldValues(MutableIssue issue, StringBuffer modifiedText)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.issue.IssueManager

Public Constructors

public DefaultIssueManager (OfBizDelegator ofBizDelegator, WorkflowManager workflowManager, NodeAssociationStore nodeAssociationStore, UserAssociationStore userAssociationStore, IssueUpdater issueUpdater, PermissionManager permissionManager, MovedIssueKeyStore movedIssueKeyStore, ProjectKeyStore projectKeyStore)

Public Methods

public GenericValue createIssue (User remoteUser, Issue issue)

Persists a new issue.

Parameters
remoteUser Issue creator
issue The new issue.
Returns
  • GenericValue representing the new issue.

public GenericValue createIssue (User remoteUser, Map<StringObject> fields)

This function creates an issue in Jira. Read the javadoc under the fields parameter to see what object need to be passed to create an issue.

Parameters
remoteUser User that is creating this issue
fields see below

Required Fields

projectId: A Long value representing the id of the project
issueType: The String id of an issueType
summary: A String describing the issue (max 255 chars)

Recomended Fields

assignee: A String representing the username of the assignee
reporter: A String representing the username of the reporter
priority: The String id of a priority

Optional Fields

description: A String description of the issue
environment: A String description of the environment the issue is in. e.g W2K
fixVersions: A List of Long values representing fixVersion ids
components: A List of Long values representing component ids
timeOriginalEstimate: A Long value representing the number of seconds this tast should take
timeEstimate: A Long value representing the number of seconds allocated for this issue
versions: = A List of Long value representing version ids
customFields: A Map with the CustomField as the key and Transport Object of the CF as the value
created: The date which the issue was created. If not specified, defaults to currentTimeMillis()
updated: The date which the issue was updated. If not specified, defaults to currentTimeMillis()
Returns
  • A generic value representing the issue created
Throws
CreateException
CreateException

public GenericValue createIssue (String remoteUserName, Map<StringObject> fields)

This method is here because this is a logical place for the "createIssue" method to be. As the issues are actually created using workflow, the current implementation of this method uses the WorkflowManager to create the issue

Parameters
remoteUserName the user who is creating the issue
fields issue's attribute's
Returns
  • the created issue

public Issue createIssueObject (User remoteUser, Issue issue)

Creates an issue.

Parameters
remoteUser Issue creator
issue The new issue.
Returns
  • the new issue.

public Issue createIssueObject (String remoteUserName, Map<StringObject> fields)

Creates an issue.

Parameters
remoteUserName Issue creator
fields A map of the issue's immediate field values. See the Issue definition in entitymodel.xml for values.
Returns
  • representing the new issue.

public Issue createIssueObject (User remoteUser, Map<StringObject> fields)

Creates an issue.

Parameters
remoteUser Issue creator
fields A map of the issue's immediate field values. See the Issue definition in entitymodel.xml for values.
Returns
  • the new issue.

public void deleteIssue (User user, MutableIssue issue, EventDispatchOption eventDispatchOption, boolean sendMail)

This method will delete an issue from JIRA. This will clean up all issue associations in JIRA and will de-index the issue.

This method should be used if you want to exert more control over what happens when JIRA deletes an issue. This method will allow you to specify if an event is dispatched and if so which event is dispatched, see EventDispatchOption. This method also allows you to specify if email notifications should be send to notify users of the deletion.

Parameters
user who is performing the operation
issue the issue to delete.
eventDispatchOption specifies if an event should be sent and if so which should be sent.
sendMail if true mail notifications will be sent, otherwise mail notifications will be suppressed.

public void deleteIssue (User user, Issue issue, EventDispatchOption eventDispatchOption, boolean sendMail)

This method will delete an issue from JIRA.

This will clean up all issue associations in JIRA and will de-index the issue.

This method should be used if you want to exert more control over what happens when JIRA deletes an issue. This method will allow you to specify if an event is dispatched and if so which event is dispatched, see EventDispatchOption. This method also allows you to specify if email notifications should be send to notify users of the deletion.

Parameters
user who is performing the operation
issue the issue to delete.
eventDispatchOption specifies if an event should be sent and if so which should be sent.
sendMail if true mail notifications will be sent, otherwise mail notifications will be suppressed.

public void deleteIssueNoEvent (Issue issue)

Delete issue without firing any events, or sending notifications.

This is preferred in some bulk operations, but normally you would call deleteIssue(com.atlassian.crowd.embedded.api.User, Issue, com.atlassian.jira.event.type.EventDispatchOption, boolean)

Parameters
issue issue to delete

public void deleteIssueNoEvent (MutableIssue issue)

Delete issue without firing any events, or sending notifications.

This is preferred in some bulk operations, but normally you would call deleteIssue(com.atlassian.crowd.embedded.api.User, MutableIssue, com.atlassian.jira.event.type.EventDispatchOption, boolean)

Parameters
issue issue to delete

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 Set<String> getAllIssueKeys (Long issueId)

Returns all issue keys that are associated with Issue.

Returns
  • all issue keys (including the current one) associated with the issue

public List<GenericValue> getEntitiesByIssue (String relationName, GenericValue issue)

Get a list of entities (versions, components etc) related to this issue.

Parameters
relationName A IssueRelationConstants string indicating some issue relation
issue Issue to consider
Returns
  • A list of entity GenericValues associated with the issue.
Throws
GenericEntityException

public List<GenericValue> getEntitiesByIssueObject (String relationName, Issue issue)

Get a list of entities (versions, components etc) related to this issue.

Parameters
relationName A IssueRelationConstants string indicating some issue relation
issue Issue to consider
Returns
  • A list of entity GenericValues associated with the issue.
Throws
GenericEntityException

public GenericValue getIssue (Long id)

Retrieves an issue by its id.

Parameters
id Issue ID.
Returns
  • An issue GenericValue.

public GenericValue getIssue (String key)

Retrieves the issue as a GenericValue with the given key.

Parameters
key the issue key.
Returns
  • the issue as a GenericValue.
Throws
GenericEntityException

public MutableIssue getIssueByCurrentKey (String key)

Retrieves the Issue that has the given key, or null if no such Issue exists.

This method will strictly only return the issue which has current issue key equal to the one given.

Parameters
key The Issue key.
Returns
  • a MutableIssue with the given key, or null if no such Issue exists.

public MutableIssue getIssueByKeyIgnoreCase (String key)

Retrieves the Issue that has the given key, or null if no such Issue exists.

This method will ignore case of issue key.

Parameters
key The Issue key.
Returns
  • a MutableIssue with the given key, or null if no such Issue exists.

public GenericValue getIssueByWorkflow (Long wfid)

Retrieves an issue GenericValue given a workflow ID. This is used when transitioning through the various steps of a workflow.

Parameters
wfid workflow ID.
Returns
  • An issue GenericValue.
Throws
GenericEntityException

public long getIssueCount ()

Returns the number of issues.

Returns
  • the number of issues

public long getIssueCountForProject (Long projectId)

Returns the number of issues that exist for the provided project id.

Parameters
projectId identifies the project which the issues are associated with
Returns
  • a count of how many issues exist in the project

public Collection<Long> getIssueIdsForProject (Long projectId)

Retrieve a collection of all issue ids that belong to a given project.

Parameters
projectId the id of the project for which to retrieve all issue ids
Returns
  • A collection of issue IDs
Throws
GenericEntityException

public MutableIssue getIssueObject (String key)

Retrieves the Issue that has the given key, or null if no such Issue exists.

This method will always return a new instance of an issue object if the issue exists.

Parameters
key The Issue key.
Returns
  • a MutableIssue with the given key, or null if no such Issue exists.

public MutableIssue getIssueObject (Long id)

Retrieves an issue by id. This method will always return a new instance of an issue.

Parameters
id the id
Returns

public MutableIssue getIssueObjectByWorkflow (Long workflowId)

Retrieves an issue given a workflow ID. This is used when transitioning through the various steps of a workflow.

Parameters
workflowId workflow ID.
Returns
  • The Issue
Throws
GenericEntityException

public List<Issue> getIssueObjects (Collection<Long> ids)

Get issues with the following ids. The issues are sorted in the order that the ids were given in. Any ids that are not found will be missing from the list. That is list will not contains nulls.

Parameters
ids Issue IDs.
Returns

public List<Issue> getIssueObjectsByEntity (String relationName, GenericValue entity)

Get a list of issues related to an entity (version, component etc).

Parameters
relationName A IssueRelationConstants string indicating some relation of entity
entity The entity related to the issues we're after
Returns
Throws
GenericEntityException

public List<GenericValue> getIssues (Collection<Long> ids)

Get issues with the following ids. The issues are sorted in the order that the ids were given in.

Parameters
ids Issue IDs.
Returns
  • A collection of issue GenericValues

public List<GenericValue> getIssuesByEntity (String relationName, GenericValue entity)

Get a list of issues related to an entity (version, component etc).

Parameters
relationName A IssueRelationConstants string indicating some relation of entity
entity The entity related to the issues we're after
Returns
  • A list of issue GenericValues associated with an entity.
Throws
GenericEntityException

public List<GenericValue> getProjectIssues (GenericValue project)

Get all the issues for a given project.

Parameters
project the Project
Returns
  • a List of GenericValue objects
Throws
GenericEntityException

public long getUnassignedIssueCount ()

Returns the number of unassigned issues.

Returns
  • the number of unassigned issues

public List<Issue> getVotedIssues (ApplicationUser user)

Get a list of issues that the user has voted on and can see.

Parameters
user The user.
Returns
  • A list of Issue objects the user has voted on.

public List<Issue> getVotedIssues (User user)

Get a list of issues that the user has voted on and can see.

Parameters
user The user.
Returns
  • A list of Issue objects the user has voted on.
Throws
GenericEntityException

public List<Issue> getVotedIssuesOverrideSecurity (ApplicationUser user)

Get a list of issues that the user has voted on.

Parameters
user The user.
Returns
  • A list of Issue objects the user has voted on.

public List<Issue> getVotedIssuesOverrideSecurity (User user)

Get a list of issues that the user has voted on.

Parameters
user The user.
Returns
  • A list of Issue objects the user has voted on.
Throws
GenericEntityException

public List<Issue> getWatchedIssues (ApplicationUser user)

Get a list of issues that the user is watching and can see.

Parameters
user the User.
Returns

public List<Issue> getWatchedIssues (User user)

Get a list of issues that the user is watching and can see.

Parameters
user the User.
Returns

public List<Issue> getWatchedIssuesOverrideSecurity (ApplicationUser user)

Get a list of issues that the user is watching

Parameters
user the User.
Returns

public List<Issue> getWatchedIssuesOverrideSecurity (User user)

Get a list of issues that the user is watching

Parameters
user the User.
Returns

public List<User> getWatchers (Issue issue)

Return a list of watchers for a particular issue.

Parameters
issue the Issue
Returns

public List<ApplicationUser> getWatchersFor (Issue issue)

Return a list of watchers for a particular issue.

Parameters
issue the Issue
Returns

public boolean hasUnassignedIssues ()

Returns a boolean indicating whether there are unassigned issues.

Returns
  • a boolean indicating whether there are unassigned issues

public boolean isEditable (Issue issue, User user)

Returns true if the issue can be edited by the current user. This is determined by looking at both the user's permissions and the workflow step the issue is in.

Parameters
issue the issue you want to edit
user the user who will be performing the edit
Returns
  • true if the user has permission and the issue is in an editable workflow step

public boolean isEditable (Issue issue)

Returns true if the issue can be edited. This is determined by looking at the workflow step the issue is in.

Parameters
issue the Issue.
Returns
  • true if the issue can be edited. This is determined by looking at the workflow step the issue is in.

public boolean isExistingIssueKey (String issueKey)

Returns true if issue with a given key exists (it looks for issues having current issue key set for the value, and moved issue keys that used the key).

Throws
GenericEntityException

public void recordMovedIssueKey (Issue oldIssue)

Used internally when we want to record that an Issue has changed its Issue key (because it has moved project).

Parameters
oldIssue The issue with it's old issue key

public Issue updateIssue (User user, MutableIssue issue, EventDispatchOption eventDispatchOption, boolean sendMail)

This method will store the provided issue to the JIRA datastore. The issue will be saved and re-indexed. This method performs no permission checks.

This method should be used if you want to exert more control over what happens when JIRA updates an issue. This method will allow you to specify if an event is dispatched and if so which event is dispatched, see EventDispatchOption. This method also allows you to specify if email notifications should be send to notify users of the update.

Parameters
user who is performing the operation
issue the issue to update
eventDispatchOption specifies if an event should be sent and if so which should be sent.
sendMail if true mail notifications will be sent, otherwise mail notifications will be suppressed.
Returns
  • the updated issue.

public Issue updateIssue (ApplicationUser user, MutableIssue issue, UpdateIssueRequest updateIssueRequest)

This method will store the provided issue to the JIRA datastore. The issue will be saved and re-indexed. This method performs no permission checks.

This method should be used if you want to exert more control over what happens when JIRA updates an issue.

Parameters
user who is performing the operation
issue the issue to update
updateIssueRequest details about how to perform the update, including user context, event dispatch strategy and history metadata

Protected Methods

protected void doUpdate (ApplicationUser user, MutableIssue issue, GenericValue originalIssueGV, DefaultIssueChangeHolder issueChangeHolder, UpdateIssueRequest updateRequest)

protected MutableIssue getIssueObject (GenericValue issueGV)

Creates a MutableIssue object from an Issue GenericValue.

If a null GenericValue is passed, then null is returned.

Parameters
issueGV the Issue GenericValue.
Returns
  • the MutableIssue Object (will be null if issueGV is null).

protected DefaultIssueChangeHolder updateFieldValues (MutableIssue issue, StringBuffer modifiedText)