Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Querying for Unresolved items via Plain Java API

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?

0 votes

Comments

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. 

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

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

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

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,952

Question asked: Apr 12 '20, 2:54 p.m.

Question was seen: 1,669 times

Last updated: Apr 14 '20, 2:31 a.m.

Confirmation Cancel Confirm