Package com.atlassian.jira.issue.link
Class DefaultIssueLinkManager
java.lang.Object
com.atlassian.jira.issue.link.DefaultIssueLinkManager
- All Implemented Interfaces:
InitializingComponent
,IssueLinkManager
public class DefaultIssueLinkManager
extends Object
implements IssueLinkManager, InitializingComponent
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultIssueLinkManager
(OfBizDelegator genericDelegator, QueryDslAccessor queryDslAccessor, IssueLinkCreator issueLinkCreator, IssueLinkTypeManager issueLinkTypeManager, IssueUpdater issueUpdater, IssueIndexingService issueIndexingService, ApplicationProperties applicationProperties, RequestCacheFactory requestCacheFactory, com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
changeIssueLinkType
(IssueLink issueLink, IssueLinkType swapLinkType, ApplicationUser remoteUser) Changes the type of an issue link.void
void
createIssueLink
(Long sourceId, Long destinationId, Long issueLinkTypeId, Long sequence, ApplicationUser remoteUser) Constructs a new issuelink from the sourceIssueId to the destinationId and persists it.getInwardLinks
(Long destinationId) Get links to an issue.getInwardLinksInBatch
(List<Long> destinationIssueIds) Get links to multiple issues.getInwardLinksInBatch
(List<Long> destinationIssueIds, IssueLinkType issueLinkType) Get inwards links of given type to a batch of issues.getIssueLink
(Long issueLinkId) Returns theIssueLink
with the specified id.getIssueLink
(Long sourceId, Long destinationId, Long issueLinkTypeId) Retrieves an issue link given a source, destination and a link type.getIssueLinks
(Long issueLinkTypeId) Returns a collection of allIssueLink
s for a particular issue link typegetLinkCollection
(Issue issue, ApplicationUser remoteUser) Constructs aLinkCollection
for a given issue.getLinkCollection
(Issue issue, ApplicationUser remoteUser, boolean excludeSystemLinks) getLinkCollection
(org.ofbiz.core.entity.GenericValue issue, ApplicationUser remoteUser) Constructs aLinkCollection
for a given issue.Constructs aLinkCollection
for a given issue, ignoring security.getOutwardLinks
(Long sourceId) Get links from an issue.getOutwardLinksInBatch
(List<Long> sourceIssueIds) Get links to multiple issues.boolean
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.protected void
reindexLinkedIssues
(IssueLink issueLink) void
removeIssueLink
(IssueLink issueLink, ApplicationUser remoteUser) Removes a single issue link We do not check for permission here.int
removeIssueLinks
(Issue issue, ApplicationUser remoteUser) Removes ALL incoming and outgoing issuelinks from the issue supplied.int
removeIssueLinks
(org.ofbiz.core.entity.GenericValue issue, ApplicationUser remoteUser) Removes ALL incoming and outgoing issuelinks from the issue supplied.int
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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.jira.issue.link.IssueLinkManager
clearCache
-
Constructor Details
-
DefaultIssueLinkManager
public DefaultIssueLinkManager(OfBizDelegator genericDelegator, QueryDslAccessor queryDslAccessor, IssueLinkCreator issueLinkCreator, IssueLinkTypeManager issueLinkTypeManager, IssueUpdater issueUpdater, IssueIndexingService issueIndexingService, ApplicationProperties applicationProperties, RequestCacheFactory requestCacheFactory, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Details
-
afterInstantiation
public void afterInstantiation()- Specified by:
afterInstantiation
in interfaceInitializingComponent
-
createIssueLink
public void createIssueLink(Long sourceId, Long destinationId, Long issueLinkTypeId, Long sequence, ApplicationUser remoteUser) throws CreateException Description copied from interface:IssueLinkManager
Constructs a new issuelink from the sourceIssueId to the destinationId and persists it. This operation will cause a re-index of the associated issues.- Specified by:
createIssueLink
in interfaceIssueLinkManager
- Parameters:
sourceId
- The source issue.destinationId
- The destination issue.issueLinkTypeId
- The type of issuelinksequence
- In which order the link will appear in the UIremoteUser
- 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.
-
reindexLinkedIssues
-
removeIssueLink
Description copied from interface:IssueLinkManager
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.- Specified by:
removeIssueLink
in interfaceIssueLinkManager
- Parameters:
issueLink
- the issue link to removeremoteUser
- needed for creation of change items
-
removeIssueLinks
Description copied from interface:IssueLinkManager
Removes ALL incoming and outgoing issuelinks from the issue supplied.- Specified by:
removeIssueLinks
in interfaceIssueLinkManager
- Parameters:
issue
- the IssueremoteUser
- the remote user- Returns:
- The total number of issuelinks deleted.
-
removeIssueLinks
Description copied from interface:IssueLinkManager
Removes ALL incoming and outgoing issuelinks from the issue supplied.- Specified by:
removeIssueLinks
in interfaceIssueLinkManager
- Parameters:
issue
- the IssueremoteUser
- the remote user- Returns:
- The total number of issuelinks deleted.
-
removeIssueLinksNoChangeItems
Description copied from interface:IssueLinkManager
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.
- Specified by:
removeIssueLinksNoChangeItems
in interfaceIssueLinkManager
- Parameters:
issue
- the Issue- Returns:
- The total number of issuelinks deleted.
- See Also:
-
getLinkCollection
public LinkCollection getLinkCollection(org.ofbiz.core.entity.GenericValue issue, ApplicationUser remoteUser) Description copied from interface:IssueLinkManager
Constructs aLinkCollection
for a given issue.- Specified by:
getLinkCollection
in interfaceIssueLinkManager
- Parameters:
issue
- the IssueremoteUser
- the remote user- Returns:
- A
LinkCollection
with all the issues ingoing and outgoing issue links
-
getLinkCollection
Description copied from interface:IssueLinkManager
Constructs aLinkCollection
for a given issue.- Specified by:
getLinkCollection
in interfaceIssueLinkManager
- Parameters:
issue
- the issueremoteUser
- the user performing the search- Returns:
- A
LinkCollection
with all the issues ingoing and outgoing issue links
-
getLinkCollection
public LinkCollection getLinkCollection(Issue issue, ApplicationUser remoteUser, boolean excludeSystemLinks) - Specified by:
getLinkCollection
in interfaceIssueLinkManager
- Parameters:
issue
- the issueremoteUser
- the user performing the searchexcludeSystemLinks
- whether or not to exclude system links- Returns:
- A
LinkCollection
with all the issues ingoing and outgoing issue links - See Also:
-
#getLinkCollection(com.atlassian.jira.issue.Issue, com.atlassian.crowd.embedded.api.User)
-
getLinkCollectionOverrideSecurity
Description copied from interface:IssueLinkManager
Constructs aLinkCollection
for a given issue, ignoring security.- Specified by:
getLinkCollectionOverrideSecurity
in interfaceIssueLinkManager
- Parameters:
issue
- the issue- Returns:
- A
LinkCollection
with all the issues ingoing and outgoing issue links
-
getOutwardLinks
Description copied from interface:IssueLinkManager
Get links from an issue.- Specified by:
getOutwardLinks
in interfaceIssueLinkManager
- Parameters:
sourceId
- Eg. fromIssue.getId()
- Returns:
- List of
IssueLink
s. This list will be immutable.
-
getInwardLinks
Description copied from interface:IssueLinkManager
Get links to an issue.- Specified by:
getInwardLinks
in interfaceIssueLinkManager
- Parameters:
destinationId
- Eg. fromIssue.getId()
- Returns:
- List of
IssueLink
s. This list will be immutable.
-
getInwardLinksInBatch
Description copied from interface:IssueLinkManager
Get links to multiple issues.- Specified by:
getInwardLinksInBatch
in interfaceIssueLinkManager
- Parameters:
destinationIssueIds
- A collection of issue IDs to get the links for.- Returns:
- A map from issueIDs to their links.
-
getOutwardLinksInBatch
Description copied from interface:IssueLinkManager
Get links to multiple issues.- Specified by:
getOutwardLinksInBatch
in interfaceIssueLinkManager
- Parameters:
sourceIssueIds
- A collection of issue IDs to get the links for.- Returns:
- A map from issueIDs to their links.
-
getInwardLinksInBatch
public Map<Long,List<IssueLink>> getInwardLinksInBatch(List<Long> destinationIssueIds, IssueLinkType issueLinkType) Description copied from interface:IssueLinkManager
Get inwards links of given type to a batch of issues.- Specified by:
getInwardLinksInBatch
in interfaceIssueLinkManager
- Parameters:
destinationIssueIds
- Eg. fromIssue.getId()
- Returns:
- Mapping from IssueId to the list of inward links. This list will contain only links of type passed as parameter
-
moveIssueLink
Description copied from interface:IssueLinkManager
Moves an issue link to a different position in the list of issuelink. NOTE: This is currently only used when re-ordering sub-tasks.- Specified by:
moveIssueLink
in interfaceIssueLinkManager
- Parameters:
issueLinks
- The list of issueLinkscurrentSequence
- The postion of the issuelink about to be movedsequence
- The target position of the issuelink
-
resetSequences
Description copied from interface:IssueLinkManager
Sets the sequence number for each issueLink in the List of issueLinks provided according to its position in the List.- Specified by:
resetSequences
in interfaceIssueLinkManager
- Parameters:
issueLinks
- A list of issue links to be recalculated
-
getIssueLink
Description copied from interface:IssueLinkManager
Retrieves an issue link given a source, destination and a link type.- Specified by:
getIssueLink
in interfaceIssueLinkManager
- Parameters:
sourceId
- the ID of the source issuedestinationId
- the ID of the destination issueissueLinkTypeId
- the issue link type- Returns:
- an
IssueLink
or null if this link does not exist
-
getIssueLinks
Description copied from interface:IssueLinkManager
Returns a collection of allIssueLink
s for a particular issue link type- Specified by:
getIssueLinks
in interfaceIssueLinkManager
- Parameters:
issueLinkTypeId
- ID of the Issue Link Type- Returns:
- A collection of
IssueLink
s
-
getIssueLink
Description copied from interface:IssueLinkManager
Returns theIssueLink
with the specified id.- Specified by:
getIssueLink
in interfaceIssueLinkManager
- Parameters:
issueLinkId
- the issue link id.- Returns:
- the
IssueLink
. Can be NULL, if no issue link found.
-
changeIssueLinkType
public void changeIssueLinkType(IssueLink issueLink, IssueLinkType swapLinkType, ApplicationUser remoteUser) Description copied from interface:IssueLinkManager
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.- Specified by:
changeIssueLinkType
in interfaceIssueLinkManager
- Parameters:
issueLink
- the issue linkswapLinkType
- the new link typeremoteUser
- the user requesting this change
-
isLinkingEnabled
public boolean isLinkingEnabled()Description copied from interface:IssueLinkManager
Returns whether Issue Linking is currently enabled in JIRA. Issue Linking can be enabled or disabled in the Admin section of JIRA.- Specified by:
isLinkingEnabled
in interfaceIssueLinkManager
-
clearCache
-