com.atlassian.jira.bc.issue.issuelink
Class DefaultIssueLinkService

java.lang.Object
  extended by com.atlassian.jira.bc.issue.issuelink.DefaultIssueLinkService
All Implemented Interfaces:
IssueLinkService

public class DefaultIssueLinkService
extends Object
implements IssueLinkService

An implementation of Issue Linking Service

Since:
v4.4

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.bc.issue.issuelink.IssueLinkService
IssueLinkService.AddIssueLinkValidationResult, IssueLinkService.DeleteIssueLinkValidationResult, IssueLinkService.IssueLinkResult, IssueLinkService.IssueLinkValidationResult
 
Constructor Summary
DefaultIssueLinkService(IssueLinkTypeManager issueLinkTypeManager, IssueManager issueManager, PermissionManager permissionManager, I18nHelper.BeanFactory beanFactory, IssueLinkManager issueLinkManager, UserHistoryManager userHistoryManager)
           
 
Method Summary
 IssueLinkService.IssueLinkResult addIssueLinks(com.atlassian.crowd.embedded.api.User user, IssueLinkService.AddIssueLinkValidationResult result)
          Adds the issue link to the issue specified by the validation result.
 void delete(IssueLinkService.DeleteIssueLinkValidationResult validationResult)
          Deletes the issue link with the given id from the JIRA datastore, if the current user has permission to do so.
 IssueLink getIssueLink(Long sourceId, Long destinationId, Long issueLinkTypeId)
          Returns the issue link or null if not found.
 IssueLinkService.IssueLinkResult getIssueLinks(com.atlassian.crowd.embedded.api.User user, Issue issue)
          Returns the issue links that the specified user can see.
 IssueLinkService.IssueLinkResult getIssueLinks(com.atlassian.crowd.embedded.api.User user, Issue issue, boolean excludeSystemLinks)
           
 Collection<IssueLinkType> getIssueLinkTypes()
           
 IssueLinkService.AddIssueLinkValidationResult validateAddIssueLinks(com.atlassian.crowd.embedded.api.User user, Issue issue, Long issueLinkTypeId, Direction direction, Collection<String> linkKeys, boolean excludeSystemLinks)
           
 IssueLinkService.AddIssueLinkValidationResult validateAddIssueLinks(com.atlassian.crowd.embedded.api.User user, Issue issue, String linkName, Collection<String> linkKeys)
          Validates that the user provided can add the link provided for a particular issue.
 IssueLinkService.DeleteIssueLinkValidationResult validateDelete(com.atlassian.crowd.embedded.api.User user, Issue issue, IssueLink issueLink)
          Validates parameters and checks permissions, and if all checks pass it will create a IssueLinkService.DeleteIssueLinkValidationResult that can be passed to the IssueLinkService.delete(DeleteIssueLinkValidationResult) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIssueLinkService

public DefaultIssueLinkService(IssueLinkTypeManager issueLinkTypeManager,
                               IssueManager issueManager,
                               PermissionManager permissionManager,
                               I18nHelper.BeanFactory beanFactory,
                               IssueLinkManager issueLinkManager,
                               UserHistoryManager userHistoryManager)
Method Detail

getIssueLinkTypes

public Collection<IssueLinkType> getIssueLinkTypes()
Specified by:
getIssueLinkTypes in interface IssueLinkService
Returns:
the all issue link types defined in JIRA

getIssueLink

public IssueLink getIssueLink(Long sourceId,
                              Long destinationId,
                              Long issueLinkTypeId)
Description copied from interface: IssueLinkService
Returns the issue link or null if not found.

Specified by:
getIssueLink in interface IssueLinkService
Parameters:
sourceId - source issue id of the link
destinationId - destination issue id of the link
issueLinkTypeId - link type id of the link
Returns:
issue link or null if not found

getIssueLinks

public IssueLinkService.IssueLinkResult getIssueLinks(com.atlassian.crowd.embedded.api.User user,
                                                      Issue issue)
Description copied from interface: IssueLinkService
Returns the issue links that the specified user can see. Will only return non-system (user-defined) links.

Specified by:
getIssueLinks in interface IssueLinkService
Parameters:
user - The user performing the operation
issue - The issue that links will retrieved on
Returns:
a result that contains the issue links

getIssueLinks

public IssueLinkService.IssueLinkResult getIssueLinks(com.atlassian.crowd.embedded.api.User user,
                                                      Issue issue,
                                                      boolean excludeSystemLinks)
Specified by:
getIssueLinks in interface IssueLinkService
Parameters:
user - The user performing the operation
issue - The issue that links will retrieved on
excludeSystemLinks - whether or not to exclude system links
Returns:
a result that contains the issue links
See Also:
IssueLinkService.getIssueLinks(com.atlassian.crowd.embedded.api.User, com.atlassian.jira.issue.Issue)

validateAddIssueLinks

public IssueLinkService.AddIssueLinkValidationResult validateAddIssueLinks(com.atlassian.crowd.embedded.api.User user,
                                                                           Issue issue,
                                                                           String linkName,
                                                                           Collection<String> linkKeys)
Description copied from interface: IssueLinkService
Validates that the user provided can add the link provided for a particular issue. Validation will ensure that the user has the EDIT_ISSUE permission for the issue in question. The label will also be validated to ensure that it doesn't contain spaces and that it doesn't exceed the max length of 255 characters. Only user-created (i.e. non-system) links are allowed.

Specified by:
validateAddIssueLinks in interface IssueLinkService
Parameters:
user - The user performing the operation
issue - The issue that links will be set on
linkName - The actual link name as strings to set on the issue
linkKeys - The collection of issue keys to link against
Returns:
a validation result, that can be used to set the labels or to display errors.

validateAddIssueLinks

public IssueLinkService.AddIssueLinkValidationResult validateAddIssueLinks(com.atlassian.crowd.embedded.api.User user,
                                                                           Issue issue,
                                                                           Long issueLinkTypeId,
                                                                           Direction direction,
                                                                           Collection<String> linkKeys,
                                                                           boolean excludeSystemLinks)
Specified by:
validateAddIssueLinks in interface IssueLinkService
Parameters:
user - The user performing the operation
issue - The issue that links will be set on
issueLinkTypeId - The actual link id to set on the issue
direction - which direction we are linking in
linkKeys - The collection of issue keys to link against
excludeSystemLinks - whether or not system links are okay
Returns:
a validation result, that can be used to set the labels or to display errors.

addIssueLinks

public IssueLinkService.IssueLinkResult addIssueLinks(com.atlassian.crowd.embedded.api.User user,
                                                      IssueLinkService.AddIssueLinkValidationResult result)
Description copied from interface: IssueLinkService
Adds the issue link to the issue specified by the validation result.

Specified by:
addIssueLinks in interface IssueLinkService
Parameters:
user - The user performing the operation
result - The validation result obtained via #validateAddIssueLinks(com.atlassian.crowd.embedded.api.User,com.atlassian.jira.issue.Issue, String, java.util.Collection
Returns:
result containing the new links

validateDelete

public IssueLinkService.DeleteIssueLinkValidationResult validateDelete(com.atlassian.crowd.embedded.api.User user,
                                                                       Issue issue,
                                                                       IssueLink issueLink)
Description copied from interface: IssueLinkService
Validates parameters and checks permissions, and if all checks pass it will create a IssueLinkService.DeleteIssueLinkValidationResult that can be passed to the IssueLinkService.delete(DeleteIssueLinkValidationResult) method.

Specified by:
validateDelete in interface IssueLinkService
Parameters:
user - who the permission checks will be run against (can be null, indicating an anonymous user)
issue - issue the link is being deleted from
issueLink - issue link to be deleted
Returns:
a validation result, if all validation and permission passes it will contain a validated issue link id, otherwise the issue link id will be null

delete

public void delete(IssueLinkService.DeleteIssueLinkValidationResult validationResult)
Description copied from interface: IssueLinkService
Deletes the issue link with the given id from the JIRA datastore, if the current user has permission to do so.

Specified by:
delete in interface IssueLinkService
Parameters:
validationResult - contains the remote issue link id to delete. This should have been created by the IssueLinkService.validateDelete(com.atlassian.crowd.embedded.api.User, com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.issuelink.IssueLink) method. The result must have ServiceResult.isValid() return true. If false this method will throw an IllegalStateException.


Copyright © 2002-2012 Atlassian. All Rights Reserved.