Managing Project Associations

Once the OSLC Connect for Jira classes are visible to your plug-in (as instructed in the parent topic), you can add, remove or get all project associations through the com.sodius.oslc.server.process.ProjectAreaAssociationStore class.

On your plug-in's component, get the reference by using the com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport annotation:

private ProjectAreaAssociationStore store;

Creating a Project Association

In order to create a remote project association it is recommended to execute first a REST request over the service provider URL of the remote project to get the required data.

Once the RDF of the remote service provider is available, only three properties will be required: rdf:about, oslc:details and dcterms:title. With this data, the following snippet can be filled with the appropriate data:

private void addAssociation() {
    // create the OSLC details URI (needs to be an array).
    URI[] oslcDetailsURI = new URI[] { URI.create("https://server:9443/ccm/process/project-areas/_0eFXwtB1Eey07PI3pYMBJQ") };

    // create the remote service provider instance.
    ServiceProvider serviceProvider = new ServiceProvider();
    serviceProvider.setTitle("Remote Project Name");

    // create the project area association instance.
    String associationIdentifier = ... // needs to be unique, e.g: UUID.randomUUID().toString()
    ProjectAreaAssociation association = new ProjectAreaAssociation();

    // call the API
    String jiraProjectIdentifier = ... //  the Jira project id, e.g. "10000"
    try {
        store.addAssociation(jiraProjectIdentifier, association);
    } catch (ProjectAreaAssociationStoreException e) {
        // handle the exception

The link type property (related-to) determines the association type which determines, in turn, the available link types to create, once the association is created, according to the following table:

Application Domain Association Type Collaboration Link Type
Requirements Management implements affects requirement
implements requirement
tracks-rm tracks requirement
Quality Management tested-by affects test case result
blocks test execution
tested by test case
tracks related test case
related test execution record
related test plan
related test script
Change Management related-to related change request
affected by defect
affects plan item
contributes to
Architecture Management architected-by elaborated by architecture element

Remove a Project Association

Having the Jira project Id and the association identifier, removing an association is as simple as:

private void removeAssociation() {
    String jiraProjectIdentifier = ... // the Jira project id, e.g. "10000"
    String associationIdentifier = ...

    // call the API
    try {
        store.deleteAssociation(jiraProjectIdentifier, associationIdentifier);
    } catch (ProjectAreaAssociationStoreException e) {
        // handle the exception

Retrieve all Project Associations

private void getAssociation() {
    String jiraProjectIdentifier = ... // the Jira project id, e.g. "10000"

    // call the API
    try {
        Collection<ProjectAreaAssociation> projectAreas = store.getAssociations(jiraProjectIdentifier);
    } catch (ProjectAreaAssociationStoreException e) {
        // handle the exception