Assets app development

Still need help?

The Atlassian Community is here for you.

Ask the community

The Assets Java API plays an important part in customizing your environment to fulfill special requirements that are specific to your organization. Whether it’s creating your own app or writing a post function, getting to know the API is your first step on your road to helping you improve the way you work.

Before you start developing any new solutions for Assets, check out the Assets Javadoc and Groovy script examples to get inspired.

How to set up your own app

If you want to use the Assets Java API from you app, you need to specify the dependency to Assets, so that you can use Assets classes in your code. 

Maven

pom.xml

<dependency>
    <groupId>com.atlassian.jira.plugins</groupId>
    <artifactId>insight</artifactId>
    <version>${insight.version}</version>
    <scope>provided</scope>
 </dependency>
 <dependency>
    <groupId>com.atlassian.servicedesk</groupId>
    <artifactId>insight-core-model</artifactId>
    <version>${insight.version}</version>
    <scope>provided</scope>
</dependency>


App descriptor configuration

You need to install Assets locally in your mvn repository. Read more about how to do this in Maven’s documentation: Guide to installing 3rd party JARs.

You also need to specify the dependency in the app configuration (or as an annotation).

In atlassian-plugin.xml if will look like this:

<component-import key="objectFacade"
    interface="com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade"/>

Java example

Assets exports all the necessary packages so you can just access the Assets facade classes by doing something like this:

...
 
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade;
import com.riadalabs.jira.plugins.insight.services.model.ObjectBean;
 
public class MyPluginResource {
 
    ...
    private final ObjectFacade objectFacade;
    ...
  
    public MyPluginResource(final ObjectFacade objectFacade) {
        this.objectFacade = objectFacade;
    }
 
    public ObjectBean getInsightObject(String key) throws Exception {
        return objectFacade.loadObjectBean(key);
    }
     
}


More resources

For more info, check these pages:

Last modified on May 15, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.