Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use PrioritySchemeManager in Jira API 7.6 ?

Eddy Fras
Contributor
March 15, 2019

The code snippet included in the javadoc of the PrioritySchemeManager class is missing a getter :

https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/issue/fields/config/manager/PrioritySchemeManager.html

PrioritySchemeManager prioritySchemeManager;
...
FieldConfigScheme fieldConfigScheme = prioritySchemeManager.createWithDefaultMapping("Some name", "Some description", ImmutableList.of("1", "2", "3"));
...

Logically, we get a "java.lang.NullPointerException: Cannot invoke method createWithDefaultMapping() on null object" error.

So how do we get access to an instance of the PrioritySchemeManager ?

The ComponentAccessor that usually gives access to all managers doesn't help for this one.

Thanks,

Eddy

2 answers

0 votes
WW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 7, 2023

You can use ComponentAccessor, like this:

 

import com.atlassian.jira.issue.fields.config.manager.PrioritySchemeManager

PrioritySchemeManager prioritySchemeManager = ComponentAccessor.getComponent(PrioritySchemeManager)
0 votes
ChristopherChilds
Contributor
January 4, 2023

Did you ever find a solution for this Fras?

Suggest an answer

Log in or Sign up to answer