It's all about the answers!

Ask a question

How to query workitems in open state ?


Chen Feng (622) | asked Apr 21 '11, 6:29 a.m.
I want to query workitems in open state by using client java API, but the following code doesn't work, anyone can help me?

IQueryableAttribute queryableAttribute1 = factory.findAttribute(projectArea, IWorkItem.STATE_PROPERTY, auditableClient, null);

Identifier sIdentifier1 = Identifier.create (com.ibm.team.workitem.common.model.IState.class, String.valueOf(IWorkflowInfo.OPEN_STATES));
AttributeExpression projectAreaExpression1 = new AttributeExpression(queryableAttribute1, AttributeOperation.EQUALS, sIdentifier1);

Term term = new Term(Operator.AND);
term.add(projectAreaExpression1);
IQueryResult<IResolvedResult<IWorkItem>> result = queryClient.getResolvedExpressionResults(projectArea, term, IWorkItem.SMALL_PROFILE);

IAttribute idAttribute = workItemClient.findAttribute(projectArea, IWorkItem.ID_PROPERTY, null);
while (result.hasNext(null)) {
IResolvedResult<IWorkItem> resolved = result.next(null);
wi = resolved.getItem();
System.out.println(wi.getValue(idAttribute));
}




I also tried this:

AttributeExpression projectAreaExpression1 = new AttributeExpression(queryableAttribute1, AttributeOperation.EQUALS, new StatusVariable(IWorkflowInfo.OPEN_STATES));



They all doesn't work. Am I using query API incorrect?

One answer



permanent link
SEC Servizi (97123156) | answered Sep 02 '15, 9:22 a.m.
Am I using query API incorrect?
See https://jazz.net/forum/questions/41555/building-a-query-for-work-items-in-closed-state-group/131452
Cheers.

Your answer


Register or to post your answer.