[ServiceDesk API] How to get SD project configuration? Edited

Hello,

how to get access to ServiceDesk project cofiguration using api?

I find class and method to do that

com.atlassian.servicedesk.internal.feature.servicedesk.ServiceDesk;

accessConfig()
but when i run plugin i get this error
[INFO] [talledLocalContainer] java.lang.ClassNotFoundException: com.atlassian.servicedesk.internal.feature.servicedesk.ServiceDesk not found by com.tutorial.myplugin.jira.servicedesk-plugin [199]
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
[INFO] [talledLocalContainer] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Compilation run without any errors.

A.

1 answer

This widget could not be displayed.
Andy Brook Community Champion Jul 07, 2017

Its probably an import problem.

Here's what I have in pom.xml:

  <dependency>
      <groupId>com.atlassian.servicedesk</groupId>
      <artifactId>jira-servicedesk-api</artifactId>
      <version>3.2.0-029</version> 
      <scope>provided</scope>
  </dependency>

  <dependency>
   <groupId>com.atlassian.servicedesk</groupId>
   <artifactId>servicedesk-parent-pom</artifactId>
   <version>3.2.0-029</version>
   <type>pom</type>
      <scope>provided</scope>
  </dependency>

The maven-jira-plugin needs no more than:

<amps.version>5.1.20</amps.version>
<plugin>
 <groupId>com.atlassian.maven.plugins</groupId>
 <artifactId>maven-jira-plugin</artifactId>
 <version>${amps.version}</version>
 <extensions>true</extensions>
 <configuration>
  <compressResources>false</compressResources>
  <productVersion>${jira.version}</productVersion>
  <productDataVersion>${jira.version}</productDataVersion>
  <productDataPath>${basedir}/src/test/resources/integration/product-data/generated-test-resources.zip</productDataPath>
  <extractDependencies>false</extractDependencies>
 </configuration>
</plugin>

Then, you have to lookup the JSD service class:

fRequestTypeService=ComponentAccessor.getOSGiComponentInstanceOfType(RequestTypeService.class);
fPortalService=ComponentAccessor.getOSGiComponentInstanceOfType(PortalService.class);
fServiceDeskManager=ComponentAccessor.getOSGiComponentInstanceOfType(ServiceDeskManager.class);
fCommentService=ComponentAccessor.getOSGiComponentInstanceOfType(ServiceDeskCommentService.class);
fCustomerContextService=ComponentAccessor.getOSGiComponentInstanceOfType(CustomerContextService.class);

Andy thank you for replay.

I know how to use standard ServiceDesk api, but if you look into documentation ther's no information about SD Configuration, becouse you can get only this class com.atlassian.servicedesk.api.ServiceDesk (https://docs.atlassian.com/jira-servicedesk/3.5.1-REL-0026/com/atlassian/servicedesk/api/ServiceDesk.html)

 

I use java decompiler and find this class com.atlassian.servicedesk.internal.feature.servicedesk.ServiceDesk. 

Inside this class you will find accessConfig() method

 

 

public AccessConfig accessConfig()
{
    return this.accessConfig;
}

 

com.atlassian.servicedesk.internal.feature.servicedesk.AccessConfig

 

This is what i need :(

OK, thats more specific.  JSD API's are very limited, they only expose what JSD architects detrmine you should need to perform actions that are supported by their published API.

The class you refer is in an internal package.  If JSD does not export components making them visible to addons, you are out of luck.

Atlassian provide source for core produts, though 'JSD' has always been different.   I just looked at my.atalssian.com for JSD, there is a Download source option but its ancient (for JIRA 7.0.0 added 01 OCT 2015) and appears broken in any case.   I've logged a support case about that, though, probably would not wait on a resolutions, though, probably should not mention decompilers, is a breach of the customer agreement (para 12).  

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 13, 2018 in Jira Service Desk

Jira Service Desk – Don’t be afraid, the journey begins with curiosity!

...be more productive while being fun to use at the same time. For some, getting started can be a bit intimidating. This is especially true if Jira Service Desk is your first exposure to Atlassian...

10,019 views 9 28
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you