Ability to extract all options hierarchy programmatically
Hi Yury,
Is there a way (either using SQL or using JAVA API ) to extract whole tree of components?
For integration with some other plugins (Structure for), I need to have a map with Option and its parent option, if it exists.
I failed to find SQL table in jira DB, and the Groovy script I wrote
```
#!java
import com.atlassian.jira.component.ComponentAccessor
import groovy.json.JsonSlurper
import groovy.json.JsonBuilder
import groovy.json.JsonOutput
import com.atlassian.jira.event.type.EventDispatchOption;
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import ru.slie.jira.tree.manager.TreeSchemaManager
@WithPlugin("ru.slie.jira.tree-customfield")
@PluginModule
TreeSchemaManager tsm
def issueManager = ComponentAccessor.getIssueManager()
def issue = issueManager.getIssueObject("VER-2234")
def user = ComponentAccessor.getUserManager().getUserByName("jira_role");
def customFieldManager = ComponentAccessor.customFieldManager
def treeField = customFieldManager.getCustomFieldObject("customfield_17212")
def options = tsm.findOptionByName(treeField, "*", 0)
log.debug(options)
def schema = tsm.getSchema(treeField.getRelevantConfig(issue))
if (!schema) {
log.debug "no assign schema for field"
} else {
log.debug(schema.getOptions())
}
```
seem to return only a subset of values
Comments (3)
-
repo owner -
reporter Wow, thanks a bunch!
That helps a lot. -
repo owner - changed status to resolved
- Log in to comment
Hi!
Tables names for sql:
Java API:
If you have any questions write them in comment