Forums

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

Solved: Reading an Issue using JQL return information as BasicIssue, not Issue

jolgau
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 8, 2019

Hello :)

I'm using a Java Client to access Jira API.

I've managed to do a search and retrieve all the Epics from a certain project from JIRA and I've noticed that SearchResult.getIssues() returns information as BasicIssue, not Issue. In order to retrieve it as Issue I have to make an extra call.   

Is there a way that I could retrieve the information using JQL directly as Issue?  

 

My Code right now:

public List<Issue> readAllEpicsFromProject(String projectKey) {
log.info("call readAllEpicsFromProject");

List<Issue> issues = new ArrayList<>();
NullProgressMonitor pm = new NullProgressMonitor();

SearchResult searchJql = restClient.getSearchClient()
.searchJql("project = \"" + projectKey + "\" AND issueType = epic", pm);
for (BasicIssue issue : searchJql.getIssues()) {

issues.add(restClient.getIssueClient().getIssue(issue.getKey(), pm));
}
return issues;
}

2 answers

2 accepted

0 votes
Answer accepted
jolgau
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 10, 2019

Solved:

I had to migrate from JRJC 1.x to JRJC 2.x.

This is my code now:

public Issue readIssue(String issueKey) {

     Promise<Issue> i = restClient.getIssueClient().getIssue(issueKey);

     return i.claim();
}

 

https://ecosystem.atlassian.net/wiki/spaces/JRJC/pages/50593810/Migrating+from+JRJC+1.x+to+2.x

0 votes
Answer accepted
Nic Brough -Adaptavist-
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.
January 9, 2019

You'd need to look at the docs for your "client" - BasicIssue is something it is doing, and if you want it to do something else, you'll need to use whatever the client API provides.

The REST API will not give you an object though.  My best guess is that your client thinks of BasicIssue being the core of an issue, created by asking Jira for the plain text of an issue over REST and built into a more issue-like object from that data.

Suggest an answer

Log in or Sign up to answer