Package com.atlassian.jira.bc.issue.link
Class DefaultIssueLinkService
java.lang.Object
com.atlassian.jira.bc.issue.link.DefaultIssueLinkService
- All Implemented Interfaces:
IssueLinkService
An implementation of Issue Linking Service
- Since:
- 5.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.jira.bc.issue.link.IssueLinkService
IssueLinkService.AddIssueLinkValidationResult, IssueLinkService.DeleteIssueLinkValidationResult, IssueLinkService.IssueLinkResult, IssueLinkService.IssueLinkValidationResult, IssueLinkService.SingleIssueLinkResult -
Constructor Summary
ConstructorsConstructorDescriptionDefaultIssueLinkService(IssueLinkTypeManager issueLinkTypeManager, IssueManager issueManager, PermissionManager permissionManager, I18nHelper.BeanFactory beanFactory, IssueLinkManager issueLinkManager, UserHistoryManager userHistoryManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the issue link to the issue specified by the validation result.voiddelete(IssueLinkService.DeleteIssueLinkValidationResult validationResult) Deletes the issue link with the given id from the JIRA datastore, if the current user has permission to do so.getIssueLink(Long issueLinkId, ApplicationUser user) Returns the issue link for the given id.getIssueLink(Long sourceId, Long destinationId, Long issueLinkTypeId) Returns the issue link or null if not found.getIssueLinks(ApplicationUser user, Issue issue) Returns the issue links that the specified user can see.getIssueLinks(ApplicationUser user, Issue issue, boolean excludeSystemLinks) validateAddIssueLinks(ApplicationUser user, Issue issue, Long issueLinkTypeId, Direction direction, Collection<String> linkKeys, boolean excludeSystemLinks) validateAddIssueLinks(ApplicationUser user, Issue issue, String linkName, Collection<String> linkKeys) Validates that the user provided can add the link provided for a particular issue.validateDelete(ApplicationUser user, Issue issue, IssueLink issueLink) Validates parameters and checks permissions, and if all checks pass it will create aIssueLinkService.DeleteIssueLinkValidationResultthat can be passed to theIssueLinkService.delete(DeleteIssueLinkValidationResult)method.
-
Constructor Details
-
DefaultIssueLinkService
public DefaultIssueLinkService(IssueLinkTypeManager issueLinkTypeManager, IssueManager issueManager, PermissionManager permissionManager, I18nHelper.BeanFactory beanFactory, IssueLinkManager issueLinkManager, UserHistoryManager userHistoryManager)
-
-
Method Details
-
getIssueLinkTypes
- Specified by:
getIssueLinkTypesin interfaceIssueLinkService- Returns:
- the all issue link types defined in JIRA
-
getIssueLink
Description copied from interface:IssueLinkServiceReturns the issue link or null if not found.- Specified by:
getIssueLinkin interfaceIssueLinkService- Parameters:
sourceId- source issue id of the linkdestinationId- destination issue id of the linkissueLinkTypeId- link type id of the link- Returns:
- issue link or null if not found
-
getIssueLink
Description copied from interface:IssueLinkServiceReturns the issue link for the given id. It will return the issue link if the user has the permission to see the source and destination issue of this issue link.- Specified by:
getIssueLinkin interfaceIssueLinkService- Parameters:
issueLinkId- issue link id.user- The user performing the operation- Returns:
- a result that contains the issue link.
-
getIssueLinks
Description copied from interface:IssueLinkServiceReturns the issue links that the specified user can see. Will only return non-system (user-defined) links.- Specified by:
getIssueLinksin interfaceIssueLinkService- Parameters:
user- The user performing the operationissue- The issue that links will retrieved on- Returns:
- a result that contains the issue links
-
getIssueLinks
public IssueLinkService.IssueLinkResult getIssueLinks(ApplicationUser user, Issue issue, boolean excludeSystemLinks) - Specified by:
getIssueLinksin interfaceIssueLinkService- Parameters:
user- The user performing the operationissue- The issue that links will retrieved onexcludeSystemLinks- whether or not to exclude system links- Returns:
- a result that contains the issue links
- See Also:
-
validateAddIssueLinks
public IssueLinkService.AddIssueLinkValidationResult validateAddIssueLinks(ApplicationUser user, Issue issue, String linkName, Collection<String> linkKeys) Description copied from interface:IssueLinkServiceValidates 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:
validateAddIssueLinksin interfaceIssueLinkService- Parameters:
user- The user performing the operationissue- The issue that links will be set onlinkName- The actual link name as strings to set on the issuelinkKeys- 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(ApplicationUser user, Issue issue, Long issueLinkTypeId, Direction direction, Collection<String> linkKeys, boolean excludeSystemLinks) - Specified by:
validateAddIssueLinksin interfaceIssueLinkService- Parameters:
user- The user performing the operationissue- The issue that links will be set onissueLinkTypeId- The actual link id to set on the issuedirection- which direction we are linking inlinkKeys- The collection of issue keys to link againstexcludeSystemLinks- 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 void addIssueLinks(ApplicationUser user, IssueLinkService.AddIssueLinkValidationResult result) Description copied from interface:IssueLinkServiceAdds the issue link to the issue specified by the validation result.- Specified by:
addIssueLinksin interfaceIssueLinkService- Parameters:
user- The user performing the operationresult- The validation result obtained viainvalid reference
#validateAddIssueLinks(com.atlassian.crowd.embedded.api.User, com.atlassian.jira.issue.Issue, String, java.util.Collection)
-
validateDelete
public IssueLinkService.DeleteIssueLinkValidationResult validateDelete(ApplicationUser user, Issue issue, IssueLink issueLink) Description copied from interface:IssueLinkServiceValidates parameters and checks permissions, and if all checks pass it will create aIssueLinkService.DeleteIssueLinkValidationResultthat can be passed to theIssueLinkService.delete(DeleteIssueLinkValidationResult)method.- Specified by:
validateDeletein interfaceIssueLinkService- Parameters:
user- who the permission checks will be run against (can be null, indicating an anonymous user)issue- issue the link is being deleted fromissueLink- 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
Description copied from interface:IssueLinkServiceDeletes the issue link with the given id from the JIRA datastore, if the current user has permission to do so.- Specified by:
deletein interfaceIssueLinkService- Parameters:
validationResult- contains the remote issue link id to delete. This should have been created by themethod. The result must haveinvalid reference
#validateDelete(com.atlassian.crowd.embedded.api.User, com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.link.IssueLink)ServiceResult.isValid()return true. If false this method will throw an IllegalStateException.
-