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.
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.
2 answers
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..
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..