How to query workitems in open state ?
![](http://jazz.net/_images/myphoto/ab8a77516781927f2fa17ec53817f29c.jpg)
I want to query workitems in open state by using client java API, but the following code doesn't work, anyone can help me?
I also tried this:
They all doesn't work. Am I using query API incorrect?
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?