Forums

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

Executing a JQL String in plugin and getting result issues

AbrahamA
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.
December 7, 2011

Hi

I have a string like this

(project=MYTESTA and (fixversion="1.0.0" or affectedversion="1.0.0") ) or (project=MYTESTA and (fixversion="1.0.1" or affectedversion="1.0.1") )AND issuetype in(Defect,Enhancement) AND Severity in( 1-Critical,2-High,3-Low)

how do I execute this string in plugin and get back issues.

I am trying to see if Query or Querybuilder takes and string and execute and give me results.

Any pointers.

Please let me know.

Thanks

Abe

2 answers

1 accepted

1 vote
Answer accepted
Nazia Tarannum
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.
December 7, 2011
Query query = builder.sub().project("MYTESTA").and().sub().fixVersion("1.0.0").or().affectedVersion("1.0.0").endsub().endsub().or().sub().project("MYTESTA").and().sub().fixVersion("1.0.0").or().affectedVersion("1.0.0").endsub().endsub().issueType("Defect","Enhancement").and().customField(customfieldID).in("1-Critical","2-High","3-Low").buildQuery();

AbrahamA
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.
December 7, 2011

Thanks Nazia

0 votes
Nazia Tarannum
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.
December 7, 2011
SearchProvider searchProvider = ComponentManager.getInstance().getSearchProvider();
JqlClauseBuilder builder = JqlQueryBuilder.newClauseBuilder();
Query query = <your query>;
SearchResults searchResults = searchProvider.search(query, admin, PagerFilter.getUnlimitedFilter());
List<Issue> issues = new LinkedList<Issue>();
issues = searchResults.getIssues();

AbrahamA
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.
December 7, 2011

Hi

Thanks for the response.

Query query = <your Query>

How does it work.

Query query = "(project=mytesta)"

I cannot give like this. That is where I have difficulty, how do I construct Query object from my string.

Thanks

Abe

Suggest an answer

Log in or Sign up to answer