Accessing Add-on Services from ScriptRunner

Javadoc API

Configuration Management add-on's Javadoc API is not perfect, but it should help you a lot if you want to develop your own ScriptRunner integrations. You can access the API here. Note that this API is for latest version of the app, please contact us if you need previous version of the API.

API Change with 1.3.0 Version of App

API of add-on slightly changed with 1.12.0 version. The biggest change is that we have moved bundle related methods from CMPVersionMappingService to BundleService. Nearly all method signatures are the same. When creating your scripts please check which version of the "Configuration Management Toolkit" app you are using, and code accordingly. 

Getting Parent Component Hierarchy of a Component/Subcomponent
import com.deniz.jira.versioning.subcomponents.SubcomponentsService;
import com.onresolve.scriptrunner.runner.customisers.PluginModule;
import com.onresolve.scriptrunner.runner.customisers.WithPlugin;

@WithPlugin("com.deniz.jira.versioning")
@PluginModule
SubcomponentsService subcomponentsService;
return subcomponentsService.getParentComponentHierarchy(10800L); //this is the component or virtual component id
Getting Component Hierarchy of a Project
import com.deniz.jira.versioning.subcomponents.SubcomponentsService;
import com.deniz.jira.versioning.subcomponents.ComponentHierarchy;
import com.onresolve.scriptrunner.runner.customisers.PluginModule;
import com.onresolve.scriptrunner.runner.customisers.WithPlugin;

@WithPlugin("com.deniz.jira.versioning")
@PluginModule
SubcomponentsService subcomponentsService;
com.google.common.base.Optional<ComponentHierarchy> componentHierarchy = subcomponentsService.getComponentHierarchy("ERP", true); //since we pass true for second argument all components are returned if hierarchy is not defined
Accessing Bundles
import com.deniz.jira.versioning.CmpVersionMappingService;
import com.onresolve.scriptrunner.runner.customisers.PluginModule;
import com.onresolve.scriptrunner.runner.customisers.WithPlugin;

@WithPlugin("com.deniz.jira.versioning")
@PluginModule
CmpVersionMappingService cvService;
@WithPlugin("com.deniz.jira.versioning")
@PluginModule
BundleService bundleService;

//return cvService.getAllBundles(10000L); //Id of the project. FOR VERSIONS BEFORE 1.12.0
return bundleService.getAllBundles(1000L); //FOR VERSIONS 1.12.0+
Accessing Subprojects
import com.deniz.jira.versioning.subprojects.SubprojectsService;
import com.onresolve.scriptrunner.runner.customisers.PluginModule;
import com.onresolve.scriptrunner.runner.customisers.WithPlugin;

@WithPlugin("com.deniz.jira.versioning")
@PluginModule
SubprojectsService subprojects;
return subprojects.getSubprojectHierarchyOf(-1); //Returns whole project hierarhcy. pass a project id to return a subtree.

More detailed Samples