Since 4.3 Iteration 2 the JIRA Engine Room Team has started on integrating the new  Application Links functionality with JIRA.

Any plugin developer who is building a feature that involves JIRA talking to another Atlassian application or a 3rd party system should check out application links!

Application links address several problems that in the past were left up to the plugin developer to solve:

  • Storing information (e.g. URL) about the remote system
  • Storing authentication information to communicate with the remote system
  • A UI to administrate this information

Thus we ended up with different configuration UI’s in each of our products.

The new way to create Application Links

Application Links will ship with JIRA 4.3 and will be the new way to configure Application Links to other applications. You can configure authentication information for every Application Link. Application Links support Basic, OAuth and Trusted Applications authentication.

application-links.jpg

The screenshot above shows the new administration UI with a
sample Application Link from JIRA to FishEye (2.4.3) using Trusted
Applications authentication.

Linking JIRA Projects

Every JIRA Project can be linked to entitities in the remote system. As an example, if JIRA has an Application Link to a FishEye instance, we can link a JIRA Project to a FishEye Repository and/or a Crucible Project.

app-links-jira-projects.jpg

The screenshot above shows list of links from the JIRA Project
‘homosapien’ to other entities ( eg. FishEye Repositories, JIRA
Projects…)

How do I get started using Application Links in my plugin?

Take advantage of Application Links within your own plugin by following these three steps:

Step 1: Add the applinks dependency to your plugin pom.xml with scope provided.

<dependency>
<groupId>com.atlassian.applinks</groupId>
<artifactId>applinks-api</artifactId>
<version>3.1</version>
<scope>provided</scope>
</dependency>

Step 2: Add imports for the ApplicationLinkService and EntityLinkService to your atlassian-plugin.xml file

<component-import key="applicationLinkService">
<interface>com.atlassian.applinks.api.ApplicationLinkService</interface>
</component-import>
<component-import key="entityLinkService">
<interface>com.atlassian.applinks.api.EntityLinkService</interface>
</component-import>

Step 3: Use the EntityLinkService or ApplicationLinkService in your code.

These services can be injected as any other service / manager / component from JIRA.
Here a coding example that uses the EntityLinkService:

class IssueResolver {
IssueResolver(EntityLinkService entityLinkService) {
this.entityLinkService = entityLinkService;
}

Issue getJiraIssue(Space contextSpace, String issueKey) {
EntityLink link = linkService.getPrimaryEntityLink(contextSpace, JiraProjectType.class);

if (link == null) {
return null;
}

Request req = link.getApplicationLink()
.createAuthenticatedRequestFactory().createRequest(GET,
"/rest/api/2.0.alpha1/issue/" + issueKey);

return req.execute(new ResponseHandler<Issue>() {
void handle(Response resp) {
if (resp.isSuccessful()) {
return resp.getEntity(Issue.class);
} else {
return null;
}
}
});
}
}

I suggest to discover the Application Links API by looking at the ApplicationLinkService and EntityLinkService. These both services allow you to access the configured links and to make requests to the remote application using configured authentication.

Fresh ideas, announcements, and inspiration for your team, delivered weekly.

Subscribe now

Fresh ideas, announcements, and inspiration for your team, delivered weekly.

Subscribe now