Java setup

If you are developping an app, this section contains useful information for Java setup and service reference.

Maven reference

Dependency

At first you will need to reference the Elements Checklist API. If you're using Maven, you need to add this dependency to your pom.xml file :

Maven dependency
<dependency>
    <groupId>com.valiantys.software.elements.api</groupId>
    <artifactId>elements-public-api</artifactId>
    <version>1.0.0</version>
	<scope>provided</scope>
</dependency>

Important

Note the <scope>provided</scope> above. This scope is mandatory.

Maven repository

To make the dependency available, you will need to add our repository to your maven configuration :

<repository>
	<id>valiantys-repository</id>
    <name>Valiantys</name>
    <url>https://repository.valiantys.com/artifactory/valiantys-public</url>
</repository>

Osgi / Package dependencies

When developping an add-on, you will need to add the following package import in your OSGI section:

<plugin>
	<groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-jira-plugin</artifactId>
    <version>${amps.version}</version>
    <extensions>true</extensions>
    <configuration>
    	...
        <!-- See here for an explanation of default instructions: -->
        <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
        <instructions>
			...
            <Import-Package>
            	com.valiantys.software.elements.api,
                com.valiantys.software.elements.api.content,
                com.valiantys.software.elements.api.model,
                com.valiantys.software.elements.api.model.builders,
                com.valiantys.software.elements.api.render,
                com.valiantys.software.elements.api.render.format,
                com.valiantys.software.elements.api.event
            </Import-Package>


Services reference

The following code sniplet show how to reference the PanelContentService in you code (Imports have been omitted). The same works for PanelRenderingService.


Service reference in Java
@Named
public class MyService {

    private final PanelContentService panelContentService;

    @Inject
    public MyService(PanelContentService panelContentService) {
        this.panelContentService = panelContentService;
    }
    
    public void doStuff() throws ElementsException {
        Panel panel = panelContentService.getPanel(IssueRef.byKey("ISSUE-1"), PanelRef.byName("My Panel"));
		...
    }
}


Plugin Scanner

The code above is in a plugin configured to use the Atlassian plugin scanner. If you are not using the plugin scanner, you will need to reference the services the old way, by adding a <component-import ...> reference inside your atlassian-plugin.xml.