com.atlassian.bamboo.jira.issuelink
Class JiraBranchLinkingServiceImpl

java.lang.Object
  extended by com.atlassian.bamboo.jira.issuelink.JiraBranchLinkingServiceImpl
All Implemented Interfaces:
JiraBranchLinkingService

public class JiraBranchLinkingServiceImpl
extends Object
implements JiraBranchLinkingService


Constructor Summary
JiraBranchLinkingServiceImpl(PlanManager planManager, JiraRemoteIssueManager jiraRemoteIssueManager, JiraRestService jiraRestService, JiraApplinksService jiraApplinksService, JiraIssueUtils jiraIssueUtils, ImpersonationService impersonationService, ImmutablePlanCacheService immutablePlanCacheService)
           
 
Method Summary
 JiraIssueDetails createRemoteLinkToBranch(ImmutableChainBranch branch, String issueKey)
          Creates a remote link from the issue to the branch.
 String findIssueKeyToLink(ImmutableChainBranch branch)
          Looks for an issue key in plan branch name or vcs branch name.
 void linkBranchToIssueIfRequiredAsync(PlanKey planKey, String username)
          Looks for an issue key in the branch name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JiraBranchLinkingServiceImpl

public JiraBranchLinkingServiceImpl(PlanManager planManager,
                                    JiraRemoteIssueManager jiraRemoteIssueManager,
                                    JiraRestService jiraRestService,
                                    JiraApplinksService jiraApplinksService,
                                    JiraIssueUtils jiraIssueUtils,
                                    ImpersonationService impersonationService,
                                    ImmutablePlanCacheService immutablePlanCacheService)
Method Detail

linkBranchToIssueIfRequiredAsync

public void linkBranchToIssueIfRequiredAsync(@NotNull
                                             PlanKey planKey,
                                             @Nullable
                                             String username)
Description copied from interface: JiraBranchLinkingService
Looks for an issue key in the branch name. If found will link the branch to the issue. And attempt to create a remote link from the issue to the branch. However this may fail. Check ChainBranchIdentifier.isRemoteJiraLinkRequired() to see if remote link succeeded.

Specified by:
linkBranchToIssueIfRequiredAsync in interface JiraBranchLinkingService
Parameters:
planKey - of branch to link
username - (optional) to use for authentication if possible/required

createRemoteLinkToBranch

@NotNull
public JiraIssueDetails createRemoteLinkToBranch(@NotNull
                                                         ImmutableChainBranch branch,
                                                         @NotNull
                                                         String issueKey)
                                          throws RemoteLinkCreationFailedException,
                                                 CredentialsRequiredContextException
Description copied from interface: JiraBranchLinkingService
Creates a remote link from the issue to the branch.

Specified by:
createRemoteLinkToBranch in interface JiraBranchLinkingService
Parameters:
branch - to link
issueKey - of the issue to link
Throws:
RemoteLinkCreationFailedException - if creation of the remote link in jira fails
CredentialsRequiredContextException - if authentication is required to create the remote link in JIRA.

findIssueKeyToLink

public String findIssueKeyToLink(@NotNull
                                 ImmutableChainBranch branch)
Description copied from interface: JiraBranchLinkingService
Looks for an issue key in plan branch name or vcs branch name. Will only return the first issue found. Only uses regex. No validation is performed for whether its a valid issue.

Specified by:
findIssueKeyToLink in interface JiraBranchLinkingService
Parameters:
branch - to find the issue for
Returns:
issueKey if one exists.


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.