Running OSLC snippets on Jira

The MDAccess for OSLC library enables to easily execute requests to read and update content of OSLC resources. You may refer to its Developer Guide for more details.

Complete source code and executable snippets can be found in this public GIT repository: https://bitbucket.org/sodius/public.oslc.jira.snippets

A valid license is required to execute the snippets. We invite you to contact us to get one if desired.

Below are code extracts to get an overview of how to execute requests with this library.

Purpose Snippet
Obtain an OSLC client to execute requests on Jira
String userName = ...;
String password = ...;
OslcClient client = OslcClients.basic(new UsernamePasswordCredentials(userName, password)).create();
Obtain an OSLC client to execute requests on IBM Engineering Lifecycle Management
String userName = ...;
String password = ...;
OslcClient client = OslcClients.jazzForm(new UsernamePasswordCredentials(userName, password)).create();
Get a Jira issue as an OSLC Change Request
OslcClient client = ...;
URI issueLocation = URI.create("https://SERVER:PORT/rest/oslc/1.0/cm/issue/ISSUE");
ChangeRequest issue = new GetResource<>(client, issueLocation, ChangeRequest.class).get();
Create a link from a Jira issue to an OSLC remote resource
OslcClient client = ...;
URI linkType = LinkType.IMPLEMENTS_REQUIREMENT.getPropertyDefinition();
URI source = URI.create("https://SERVER:PORT/rest/oslc/1.0/cm/issue/ISSUE");
URI target = URI.create("https://REMOTE-SERVER:REMOTE-PORT/myRemoteApp/myRequirement/IDENTIFIER");
DirectedLink link = new DirectedLink(linkType, source, target);
new AddLink(client, link).call();
Remove a link from a Jira issue to an OSLC remote resource
OslcClient client = ...;
URI linkType = LinkType.IMPLEMENTS_REQUIREMENT.getPropertyDefinition();
URI source = URI.create("https://SERVER:PORT/rest/oslc/1.0/cm/issue/ISSUE");
URI target = URI.create("https://REMOTE-SERVER:REMOTE-PORT/myRemoteApp/myRequirement/IDENTIFIER");
DirectedLink link = new DirectedLink(linkType, source, target);
new RemoveLink(client, link).call();