How to get IQueryableAttribute for Team area ?
Hello team
I am trying to create the query using query expressions .
I could able to query the project area ,type and planned for using below code ,But i am unable to query the team area using query expression ??
Could you please suggest .
IQueryableAttribute projectAttribute = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE)
.findAttribute(projectArea, IWorkItem.PROJECT_AREA_PROPERTY, auditableCommon, monitor);
IQueryableAttribute typeAttibute = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(projectArea,
IWorkItem.TYPE_PROPERTY, auditableCommon, monitor);
IQueryableAttribute plannedForAttribute = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(projectArea,IWorkItem.TARGET_PROPERTY, auditableCommon, monitor);
IQueryableAttribute teamAttribute = QueryableAttributes.getFactory(ITeamArea.ITEM_TYPE).findAttribute(projectArea,ITeamArea.TEAM_DATA_PROPERTY_ID,auditableCommon, monitor);
// Creating an Expression
Expression projectAreaExp = new AttributeExpression(projectAttribute, AttributeOperation.EQUALS, projectArea);
Expression storytypeExp = new AttributeExpression(typeAttibute, AttributeOperation.EQUALS, "com.ibm.team.apt.workItemType.story");
Expression plannedForExp = new AttributeExpression(plannedForAttribute, AttributeOperation.EQUALS,null);
Expression teamAreaExp = new AttributeExpression(teamAttribute, AttributeOperation.TEAM_AREA_EQUALS,"ESA-LMT");
But team area i am not able to fetch ??Any hints
Accepted answer
If you had a proper setup (setup the SDK and plain Java together) you would basically be able to see that there is no (built in) attribute for the team area similar to the project area: com.ibm.team.workitem.common.model.IWorkItem.PROJECT_AREA_PROPERTY .
The reason is, that there is no attribute for this. Everything with Team Area in work item editor presentations or query editors is just made up. The only relationship (in built in attributes) of a work item and a team area I am aware of is the work item category (Filed Against) com.ibm.team.workitem.common.model.IWorkItem.CATEGORY_PROPERTY.
As far as I can tell, if you want to find work items "belonging" to a team area, you will have to find the categories associated to the team area and use them in the query.
Comments
I had the time and checked how that is done in the API. See the section "Synthetic Attributes" in https://rsjazz.wordpress.com/2012/11/19/using-expressions-for-automation/ for how that works and where to look.
1 vote
Thank you very much ! It works like a charm
Welcome, it was a revelation to find that one. The question has come up before.
As a side note, I was taking a look at the code, and it appears that TeamArea is the only queryable synthetic attribute.
Yea. Realized that later on as well. Leave it to the reader to realize it as well. And you never know if there will be a new one in the future. Stranger things have happened.