I want to instantiate DefaultIndexManager,
import com.atlassian.jira.issue.index.DefaultIndexManager;
private static IssueIndexManager indexMgr = new DefaultIndexManager();
But I am getting "The import com.atlassian.jira.issue.index.DefaultIndexManager cannot be resolved".
I have also added
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
in my pom.xml. Please suggest what I am missing
Community moderators have prevented the ability to post new answers.
You should get IssueIndexManager instance through com.atlassian.jira.component.ComponentAccessor or through injection.
Why do you need to instantiate it yourself ?
Are you trying to do this from a plugin or this is some java class outside of the JIRA container?
Here's a plugin code sample:
try { Project p = ComponentAccessor.getProjectManager().getProjectObjByKey("sample"); IssueManager issueManager = ComponentAccessor.getIssueManager(); Collection<Long> issueIdsForProject = issueManager.getIssueIdsForProject(p.getId()); List<Issue> issueObjects = issueManager.getIssueObjects(issueIdsForProject); ComponentAccessor.getIssueIndexManager().reIndexIssueObjects(issueObjects); } catch (IndexException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (GenericEntityException e) { // TODO Auto-generated catch block e.printStackTrace(); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes I am trying to do this through a plugin . Thanks for the code snippet as the Component Manager is already deprecated and instead of using DefaultIndexManager , I can actually use Component Accessor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.