It's all about the answers!

Ask a question

Querying for Unresolved items via Plain Java API


Martin Gompertz (48611) | asked Apr 12 '20, 2:54 p.m.
Hi,
I see a few attempts to ask this question in the past, but no accepted answers.
Surely someone out there is doing this successfully?
I have other code that works fine for querying work items for various attributes, but cannot see how to query for Unresolved items.
I tried the approach below, but I get an exception at the point noted: com.ibm.team.repository.common.query.QueryException: Unknown queryable reference: stateGroup

    qattr3 = factory.findAttribute(projectArea, "stateGroup", auClient, null);
    expr3 = new AttributeExpression(qattr3, AttributeOperation.NOT_EQUALS, new Integer(IWorkflowInfo.CLOSED_STATES));
    Term term = new Term(Term.Operator.AND);
    term.add(expr1); // Work item is of correct type - code ommitted
    term.add(expr2); // Work item is owned by me - code omitted
    term.add(expr3); // Work item is unresolved
    resolvedResults = quClient.getResolvedExpressionResults(projectArea, term, IWorkItem.FULL_PROFILE);
    if ( resolvedResults != null )
    {
      while ( resolvedResults.hasNext(null) ) // Exception occurs here
      {

Any ideas how to query for only unresolved items, please?

Comments
Geoffrey Clemm commented Apr 12 '20, 3:26 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Are you sure the exception occurs the first time through the loop?   If not, one would need to see the rest of the loop body. 


Martin Gompertz commented Apr 12 '20, 3:36 p.m.
Hi Geoffrey, yes the exception is
com.ibm.team.repository.common.query.QueryException: Unknown queryable reference: stateGroup

and it comes the first time of executing
resolvedResults.hasNext(null)

It looks like the query is first evaluated/executed when making that call (not in the earlier call to getResolvedExpressionResults).

And so it looks like stateGroup is something I can't query on.

My confusion is over how successfully to query for Unresolved items - is there any sample code you can point me to, please?

Thanks

Geoffrey Clemm commented Apr 13 '20, 10:35 a.m. | edited Apr 13 '20, 11:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Note that my comment was just to clarify the question .. I personally do not know these APIs. 


Martin Gompertz commented Apr 13 '20, 11:09 a.m.
I re-checked, and definitely have not made a mistake on where the exception is coming from.

I have been able to overcome this exception by forming my query differently (same attribute, different operator).  NB. it still doesn't "work" - ie. the results include items with stategroup value I asked it to filter out.  I'm working around that now, by retrieving the full set from the server, and filtering myself on the client side - not ideal, but I didn't see any alternative.

I don't think I should offer this as an answer, since, although I overcame the exception, I still don't get the results I expect.

Anyway, for info, this was my change:


This causes an exception from resolvedResults.hasNext :
    expr3 = new AttributeExpression(qattr3, AttributeOperation.NOT_EQUALS, IWorkflowInfo.CLOSED_STATES);

This does not:
    expr3 = new AttributeExpression(qattr3, AttributeOperation.STATE_GROUP_NOT_EQUALS, IWorkflowInfo.CLOSED_STATES);

One answer



permanent link
Ralph Schoon (63.5k33646) | answered Apr 14 '20, 2:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Apr 14 '20, 2:31 a.m.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.