@PublicApi public interface

IssueLinkManager

com.atlassian.jira.issue.link.IssueLinkManager
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

The implementations of this class are used to manage issue link types and issue links.

Summary

Public Methods
void changeIssueLinkType(IssueLink issueLink, IssueLinkType swapLinkType, User remoteUser)
Changes the type of an issue link.
void clearCache()
Clears the Issue Link cache used by the Issue Link Manager.
void createIssueLink(Long sourceIssueId, Long destinationIssueId, Long issueLinkTypeId, Long sequence, User remoteUser)
Constructs a new issuelink from the sourceIssueId to the destinationId and persists it.
List<IssueLink> getInwardLinks(Long destinationIssueId)
Get links to an issue.
IssueLink getIssueLink(Long sourceId, Long destinationId, Long issueLinkTypeId)
Retrieves an issue link given a source, destination and a link type.
IssueLink getIssueLink(Long issueLinkId)
Returns the IssueLink with the specified id.
Collection<IssueLink> getIssueLinks(Long issueLinkTypeId)
Returns a collection of all IssueLinks for a particular issue link type
LinkCollection getLinkCollection(Issue issue, User remoteUser)
Constructs a LinkCollection for a given issue.
LinkCollection getLinkCollection(Issue issue, User remoteUser, boolean excludeSystemLinks)
LinkCollection getLinkCollection(GenericValue issue, User remoteUser)
This method is deprecated. use getLinkCollection(com.atlassian.jira.issue.Issue, User) instead
LinkCollection getLinkCollectionOverrideSecurity(Issue issue)
Constructs a LinkCollection for a given issue, ignoring security.
List<IssueLink> getOutwardLinks(Long sourceIssueId)
Get links from an issue.
boolean isLinkingEnabled()
Returns whether Issue Linking is currently enabled in JIRA.
void moveIssueLink(List<IssueLink> issueLinks, Long currentSequence, Long sequence)
Moves an issue link to a different position in the list of issuelink.
void removeIssueLink(IssueLink issueLink, User remoteUser)
Removes a single issue link We do not check for permission here.
int removeIssueLinks(GenericValue issue, User remoteUser)
int removeIssueLinks(Issue issue, User remoteUser)
Removes ALL incoming and outgoing issuelinks from the issue supplied.
int removeIssueLinksNoChangeItems(Issue issue)
Removes ALL incoming and outgoing issuelinks from the issue supplied without creating ChangeItems for the Change History.
void resetSequences(List<IssueLink> issueLinks)
Sets the sequence number for each issueLink in the List of issueLinks provided according to its position in the List.

Public Methods

public void changeIssueLinkType (IssueLink issueLink, IssueLinkType swapLinkType, User remoteUser)

Changes the type of an issue link. NOTE: It is not possible to convert a system link type to a non-system link type and vice versa.

public void clearCache ()

Clears the Issue Link cache used by the Issue Link Manager.

public void createIssueLink (Long sourceIssueId, Long destinationIssueId, Long issueLinkTypeId, Long sequence, User remoteUser)

Constructs a new issuelink from the sourceIssueId to the destinationId and persists it. This operation will cause a re-index of the associated issues.

Parameters
sourceIssueId The source issue.
destinationIssueId The destination issue.
issueLinkTypeId The type of issuelink
sequence In which order the link will appear in the UI
remoteUser Needed for creation of change items.
Throws
CreateException If there is an error when creating the "Change Item" for this operation. Note that the Link itself has most likely been created.

public List<IssueLink> getInwardLinks (Long destinationIssueId)

Get links to an issue.

Parameters
destinationIssueId Eg. from getId()
Returns
  • List of IssueLinks. This list will be immutable.

public IssueLink getIssueLink (Long sourceId, Long destinationId, Long issueLinkTypeId)

Retrieves an issue link given a source, destination and a link type.

Returns

public IssueLink getIssueLink (Long issueLinkId)

Returns the IssueLink with the specified id.

Parameters
issueLinkId the issue link id.
Returns
  • the IssueLink. Can be NULL, if no issue link found.

public Collection<IssueLink> getIssueLinks (Long issueLinkTypeId)

Returns a collection of all IssueLinks for a particular issue link type

Parameters
issueLinkTypeId ID of the Issue Link Type
Returns

public LinkCollection getLinkCollection (Issue issue, User remoteUser)

Constructs a LinkCollection for a given issue.

Parameters
issue the issue
remoteUser the user performing the search
Returns

public LinkCollection getLinkCollection (Issue issue, User remoteUser, boolean excludeSystemLinks)

Parameters
issue the issue
remoteUser the user performing the search
excludeSystemLinks whether or not to exclude system links
Returns

public LinkCollection getLinkCollection (GenericValue issue, User remoteUser)

This method is deprecated.
use getLinkCollection(com.atlassian.jira.issue.Issue, User) instead

Constructs a LinkCollection for a given issue.

Returns

public LinkCollection getLinkCollectionOverrideSecurity (Issue issue)

Constructs a LinkCollection for a given issue, ignoring security.

Parameters
issue the issue
Returns

public List<IssueLink> getOutwardLinks (Long sourceIssueId)

Get links from an issue.

Parameters
sourceIssueId Eg. from getId()
Returns
  • List of IssueLinks. This list will be immutable.

public boolean isLinkingEnabled ()

Returns whether Issue Linking is currently enabled in JIRA. Issue Linking can be enabled or disabled in the Admin section of JIRA.

public void moveIssueLink (List<IssueLink> issueLinks, Long currentSequence, Long sequence)

Moves an issue link to a different position in the list of issuelink. NOTE: This is currently only used when re-ordering sub-tasks.

Parameters
issueLinks The list of issueLinks
currentSequence The postion of the issuelink about to be moved
sequence The target position of the issuelink
Throws
IllegalArgumentException If currentSequence or sequence are null

public void removeIssueLink (IssueLink issueLink, User remoteUser)

Removes a single issue link We do not check for permission here. It should be done before this method is called. For example, in the action.

Parameters
issueLink the issue link to remove
remoteUser needed for creation of change items
Throws
RemoveException if error occurs during creation of change items
IllegalArgumentException if the supplied issueLink is null.

public int removeIssueLinks (GenericValue issue, User remoteUser)

This method is deprecated.
Use removeIssueLinks(com.atlassian.jira.issue.Issue, com.atlassian.crowd.embedded.api.User) instead. Since v5.0.

Removes ALL incoming and outgoing issuelinks from the issue supplied.

Returns
  • The total number of issuelinks deleted.
Throws
RemoveException
RemoveException

public int removeIssueLinks (Issue issue, User remoteUser)

Removes ALL incoming and outgoing issuelinks from the issue supplied.

Returns
  • The total number of issuelinks deleted.

public int removeIssueLinksNoChangeItems (Issue issue)

Removes ALL incoming and outgoing issuelinks from the issue supplied without creating ChangeItems for the Change History.

You would normally want to use the other method which creates the ChangeItems - this method is only intended for use during Issue Delete.

Returns
  • The total number of issuelinks deleted.
Throws
RemoveException
RemoveException

public void resetSequences (List<IssueLink> issueLinks)

Sets the sequence number for each issueLink in the List of issueLinks provided according to its position in the List.

Parameters
issueLinks A list of issue links to be recalculated