You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi,
I have the following Scriptrunner Script that used to remove applications links from jira:
import com.atlassian.jira.component.ComponentAccessorimport com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPluginimport com.atlassian.applinks.api.ApplicationLinkService
import com.atlassian.applinks.spi.link.ApplicationLinkDetails
ApplicationLinkService applicationLinkService = ComponentAccessor.getComponent(ApplicationLinkService)
@WithPlugin('com.atlassian.applinks.applinks-plugin')
import com.atlassian.applinks.core.DefaultApplicationLinkService
@PluginModuleDefaultApplicationLinkService defaultApplicationLinkService
applicationLinkService.getApplicationLinks().each{ defaultApplicationLinkService.deleteApplicationLink(it)}
It worked in jira 8.5 but stopped working in jira 8.13, in 8.13 I get error
java.lang.Exception: Can't find plugin module or OSGi service for class: com.atlassian.applinks.core.DefaultApplicationLinkService, check the plugin is installed / enabled / licensed. at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.getPluginComponent(ScriptRunnerImpl.groovy:94) at com.onresolve.scriptrunner.runner.ScriptRunnerImpl$getPluginComponent$2.callStatic(Unknown Source) at Script168.run(Script168.groovy:13)
Adaptavist support only mentioned that com.atlassian.applinks.applinks-plugin have less modules (94 instead of 127) but I have jira code downloaded and DefaultApplicationLinkService is still under:
com.atlassian.applinks.core.DefaultApplicationLinkService in applinks-plugin-8.0.0-sources.jar file.
What more, Code Completions in scriptrunner works and I can see and pick methods from DefaultApplicationLinkService .
also I've try with other class in this jar:
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.applinks.api.ApplicationLinkService
import com.atlassian.applinks.spi.link.ApplicationLinkDetails
ApplicationLinkService applicationLinkService = ComponentAccessor.getComponent(ApplicationLinkService)
@WithPlugin('com.atlassian.applinks.applinks-plugin')
//import com.atlassian.applinks.core.DefaultApplicationLinkService
import com.atlassian.applinks.core.ApplinkStatusService
@PluginModule
//DefaultApplicationLinkService defaultApplicationLinkService
ApplinkStatusService applinkStatusService
applicationLinkService.getApplicationLinks().each{
log.error applinkStatusService.getApplinkStatus(it.getId())
// defaultApplicationLinkService.deleteApplicationLink(it)
}
and this worked, what is the difference between DefaultApplicationLinkService and ApplinkStatusService? location is almost the same:
Any idea why this import stopped working and how properly import DefaultApplicationLinkService?
Best Regards,
Lukasz
Hi @Łukasz Sielski just fast check, what about line:
@WithPlugin('com.atlassian.applinks.applinks-plugin
it should be
@WithPlugin('com.atlassian.applinks.applinks-plugin')
Hi @Martin Bayer _MoroSystems_ s_r_o__
That was of course mistake during copy paste in here, in such case scriptrunner console would report an error in code which is not the case, the code is correct, at lease according to this build in code review function of SC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Łukasz Sielski I checked source code of 8.0.1 version and it looks like you are looking for
com.atlassian.applinks.spi.link.MutatingApplicationLinkService
from com.atlassian.applinks.applinks-spi artifact.
I have no 8.13. environment available but can you try to change your code to:
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.applinks.api.ApplicationLinkService
import com.atlassian.applinks.spi.link.ApplicationLinkDetails
@WithPlugin('com.atlassian.applinks.applinks-spi')
import com.atlassian.applinks.spi.link.MutatingApplicationLinkService
MutatingApplicationLinkService applicationLinkService = ComponentAccessor.getComponent(MutatingApplicationLinkService)
applicationLinkService.getApplicationLinks().each{ applicationLinkService.deleteApplicationLink(it)}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Martin Bayer _MoroSystems_ s_r_o__
Thank you this worked.
actually in case of jira 8.5 and 8.13 I needed to do it like that:
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.atlassian.applinks.spi.link.MutatingApplicationLinkService
@PluginModule
MutatingApplicationLinkService applicationLinkService
applicationLinkService.getApplicationLinks().each{ applicationLinkService.deleteApplicationLink(it)}
because ComponentAccesspr didn't import class at all.
Additional question, how did you find that? I'm using Intelij and for some reason can't search text in all files in project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Łukasz Sielski I downloaded source of the ApplicationLink library (https://mvnrepository.com/artifact/com.atlassian.applinks/applinks-plugin/8.0.1) and I decompiled it online. So I found out the service DefaultApplicationLInkService implements MutatingApplicationLinkService. But to be honest, it is enought to check online docs:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.