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

Building a query for work item(s) in closed state group

Hi
I have to build a query to get collection of work item(s) in closed state group.
i tried the following but it didn't work.

IQueryableAttribute statusAttr = factory.findAttribute(projectArea, IWorkItem.STATE_PROPERTY, auditableServer, null);
expr.add(new AttributeExpression(statusAttr, AttributeOperation.EQUALS, IWorkflowInfo.CLOSED_STATES ));

please let me know how to iterate thru the closed state group to find all work item in closed state group.

thanks
Vijay.

0 votes



2 answers

Permanent link
Instead of:
expr.add(new AttributeExpression(statusAttr, AttributeOperation.EQUALS, IWorkflowInfo.CLOSED_STATES ));
	
you have to use:
expr.add(new VariableAttributeExpression(statusAttr, AttributeOperation.EQUALS, new StatusVariable(IWorkflowInfo.CLOSED_STATES));
		
Cheers.

2 votes


Permanent link
Hi Vijay.
State gruops does not seem to be part of work item profile, but there is a class you may use in order to get this property for querying (that is SyntheticAttributeIdentifiers):

>Get the state group as a querable "attribute":
IQueryableAttribute stateGroupQuerable = factory.findAttribute(projectArea, SyntheticAttributeIdentifiers.STATE_GROUP_PROPERTY, auditableCommon, monitor);

>Create your attribute Expression:
AttributeExpression(stateGroupQuerable , AttributeOperation.OPERATOR_STG_EQUALS, value);
-Where argument "value" is an object implementing IStateGroup interface, not a "String" nor a "int" you can directly get from IWorkflowInfo.
Take a look to IWorkflowManager to figure out how to get the IStateGroup value, either by a known work item state or directly by the state group id.

>Run your query!

Hope it helps. Any comment welcome..



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,937

Question asked: Aug 30 '10, 3:49 a.m.

Question was seen: 5,624 times

Last updated: Oct 22 '13, 3:30 a.m.

Confirmation Cancel Confirm