com.atlassian.jira.issue.link
Class DefaultIssueLinkManager

java.lang.Object
  extended by com.atlassian.jira.issue.link.DefaultIssueLinkManager
All Implemented Interfaces:
Startable, IssueLinkManager

public class DefaultIssueLinkManager
extends Object
implements IssueLinkManager, Startable


Constructor Summary
DefaultIssueLinkManager(OfBizDelegator genericDelegator, IssueLinkCreator issueLinkCreator, IssueLinkTypeManager issueLinkTypeManager, CollectionReorderer collectionReorderer, IssueUpdater issueUpdater, IssueIndexManager issueIndexManager, ApplicationProperties applicationProperties, com.atlassian.cache.CacheManager cacheManager)
           
 
Method Summary
 void changeIssueLinkType(IssueLink issueLink, IssueLinkType swapLinkType, com.atlassian.crowd.embedded.api.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 sourceId, Long destinationId, Long issueLinkTypeId, Long sequence, com.atlassian.crowd.embedded.api.User remoteUser)
          Constructs a new issuelink from the sourceIssueId to the destinationId and persists it.
 List<IssueLink> getInwardLinks(Long destinationId)
          Get links to an issue.
 IssueLink getIssueLink(Long issueLinkId)
          Returns the IssueLink with the specified id.
 IssueLink getIssueLink(Long sourceId, Long destinationId, Long issueLinkTypeId)
          Retrieves an issue link given a source, destination and a link type.
 Collection<IssueLink> getIssueLinks(Long issueLinkTypeId)
          Returns a collection of all IssueLinks for a particular issue link type
 LinkCollection getLinkCollection(org.ofbiz.core.entity.GenericValue issue, com.atlassian.crowd.embedded.api.User remoteUser)
          Constructs a LinkCollection for a given issue.
 LinkCollection getLinkCollection(Issue issue, com.atlassian.crowd.embedded.api.User remoteUser)
          Constructs a LinkCollection for a given issue.
 LinkCollection getLinkCollection(Issue issue, com.atlassian.crowd.embedded.api.User remoteUser, boolean excludeSystemLinks)
           
 LinkCollection getLinkCollectionOverrideSecurity(Issue issue)
          Constructs a LinkCollection for a given issue, ignoring security.
 List<IssueLink> getOutwardLinks(Long sourceId)
          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 onClearCache(ClearCacheEvent event)
           
protected  void reindexLinkedIssues(IssueLink issueLink)
           
 void removeIssueLink(IssueLink issueLink, com.atlassian.crowd.embedded.api.User remoteUser)
          Removes a single issue link We do not check for permission here.
 int removeIssueLinks(org.ofbiz.core.entity.GenericValue issue, com.atlassian.crowd.embedded.api.User remoteUser)
          Removes ALL incoming and outgoing issuelinks from the issue supplied.
 int removeIssueLinks(Issue issue, com.atlassian.crowd.embedded.api.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.
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIssueLinkManager

public DefaultIssueLinkManager(OfBizDelegator genericDelegator,
                               IssueLinkCreator issueLinkCreator,
                               IssueLinkTypeManager issueLinkTypeManager,
                               CollectionReorderer collectionReorderer,
                               IssueUpdater issueUpdater,
                               IssueIndexManager issueIndexManager,
                               ApplicationProperties applicationProperties,
                               com.atlassian.cache.CacheManager cacheManager)
Method Detail

start

public void start()
           throws Exception
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable
Throws:
Exception - Allows implementations to throw an Exception.

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

createIssueLink

public void createIssueLink(Long sourceId,
                            Long destinationId,
                            Long issueLinkTypeId,
                            Long sequence,
                            com.atlassian.crowd.embedded.api.User 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 interface IssueLinkManager
Parameters:
sourceId - The source issue.
destinationId - 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.

reindexLinkedIssues

protected void reindexLinkedIssues(IssueLink issueLink)

removeIssueLink

public void removeIssueLink(IssueLink issueLink,
                            com.atlassian.crowd.embedded.api.User remoteUser)
                     throws RemoveException
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 interface IssueLinkManager
Parameters:
issueLink - the issue link to remove
remoteUser - needed for creation of change items
Throws:
RemoveException - if error occurs during creation of change items

removeIssueLinks

public int removeIssueLinks(Issue issue,
                            com.atlassian.crowd.embedded.api.User remoteUser)
                     throws RemoveException
Description copied from interface: IssueLinkManager
Removes ALL incoming and outgoing issuelinks from the issue supplied.

Specified by:
removeIssueLinks in interface IssueLinkManager
Returns:
The total number of issuelinks deleted.
Throws:
RemoveException

removeIssueLinks

public int removeIssueLinks(org.ofbiz.core.entity.GenericValue issue,
                            com.atlassian.crowd.embedded.api.User remoteUser)
                     throws RemoveException
Description copied from interface: IssueLinkManager
Removes ALL incoming and outgoing issuelinks from the issue supplied.

Specified by:
removeIssueLinks in interface IssueLinkManager
Returns:
The total number of issuelinks deleted.
Throws:
RemoveException

removeIssueLinksNoChangeItems

public int removeIssueLinksNoChangeItems(Issue issue)
                                  throws RemoveException
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 interface IssueLinkManager
Returns:
The total number of issuelinks deleted.
Throws:
RemoveException
See Also:
IssueLinkManager.removeIssueLinks(com.atlassian.jira.issue.Issue, com.atlassian.crowd.embedded.api.User)

getLinkCollection

public LinkCollection getLinkCollection(org.ofbiz.core.entity.GenericValue issue,
                                        com.atlassian.crowd.embedded.api.User remoteUser)
Description copied from interface: IssueLinkManager
Constructs a LinkCollection for a given issue.

Specified by:
getLinkCollection in interface IssueLinkManager
Returns:
A LinkCollection with all the issues ingoing and outgoing issue links

getLinkCollection

public LinkCollection getLinkCollection(Issue issue,
                                        com.atlassian.crowd.embedded.api.User remoteUser)
Description copied from interface: IssueLinkManager
Constructs a LinkCollection for a given issue.

Specified by:
getLinkCollection in interface IssueLinkManager
Parameters:
issue - the issue
remoteUser - the user performing the search
Returns:
A LinkCollection with all the issues ingoing and outgoing issue links

getLinkCollection

public LinkCollection getLinkCollection(Issue issue,
                                        com.atlassian.crowd.embedded.api.User remoteUser,
                                        boolean excludeSystemLinks)
Specified by:
getLinkCollection in interface IssueLinkManager
Parameters:
issue - the issue
remoteUser - the user performing the search
excludeSystemLinks - whether or not to exclude system links
Returns:
A LinkCollection with all the issues ingoing and outgoing issue links
See Also:
IssueLinkManager.getLinkCollection(com.atlassian.jira.issue.Issue, com.atlassian.crowd.embedded.api.User)

getLinkCollectionOverrideSecurity

public LinkCollection getLinkCollectionOverrideSecurity(Issue issue)
Description copied from interface: IssueLinkManager
Constructs a LinkCollection for a given issue, ignoring security.

Specified by:
getLinkCollectionOverrideSecurity in interface IssueLinkManager
Parameters:
issue - the issue
Returns:
A LinkCollection with all the issues ingoing and outgoing issue links

getOutwardLinks

public List<IssueLink> getOutwardLinks(Long sourceId)
Description copied from interface: IssueLinkManager
Get links from an issue.

Specified by:
getOutwardLinks in interface IssueLinkManager
Parameters:
sourceId - Eg. from Issue.getId()
Returns:
List of IssueLinks. This list will be immutable.

getInwardLinks

public List<IssueLink> getInwardLinks(Long destinationId)
Description copied from interface: IssueLinkManager
Get links to an issue.

Specified by:
getInwardLinks in interface IssueLinkManager
Parameters:
destinationId - Eg. from Issue.getId()
Returns:
List of IssueLinks. This list will be immutable.

moveIssueLink

public void moveIssueLink(List<IssueLink> issueLinks,
                          Long currentSequence,
                          Long sequence)
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 interface IssueLinkManager
Parameters:
issueLinks - The list of issueLinks
currentSequence - The postion of the issuelink about to be moved
sequence - The target position of the issuelink

resetSequences

public void resetSequences(List<IssueLink> issueLinks)
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 interface IssueLinkManager
Parameters:
issueLinks - A list of issue links to be recalculated

getIssueLink

public IssueLink getIssueLink(Long sourceId,
                              Long destinationId,
                              Long issueLinkTypeId)
Description copied from interface: IssueLinkManager
Retrieves an issue link given a source, destination and a link type.

Specified by:
getIssueLink in interface IssueLinkManager
Returns:
an IssueLink

getIssueLinks

public Collection<IssueLink> getIssueLinks(Long issueLinkTypeId)
Description copied from interface: IssueLinkManager
Returns a collection of all IssueLinks for a particular issue link type

Specified by:
getIssueLinks in interface IssueLinkManager
Parameters:
issueLinkTypeId - ID of the Issue Link Type
Returns:
A collection of IssueLinks

getIssueLink

public IssueLink getIssueLink(Long issueLinkId)
Description copied from interface: IssueLinkManager
Returns the IssueLink with the specified id.

Specified by:
getIssueLink in interface IssueLinkManager
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,
                                com.atlassian.crowd.embedded.api.User remoteUser)
                         throws RemoveException
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 interface IssueLinkManager
Throws:
RemoveException

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 interface IssueLinkManager

clearCache

public void clearCache()
Description copied from interface: IssueLinkManager
Clears the Issue Link cache used by the Issue Link Manager.

Specified by:
clearCache in interface IssueLinkManager


Copyright © 2002-2014 Atlassian. All Rights Reserved.