It's all about the answers!

Ask a question

How to get IQueryableAttribute for Team area ?


vinitha dsouza (77839) | asked Nov 14 '17, 3:03 a.m.
edited Nov 14 '17, 5:23 a.m. by Ralph Schoon (55.6k23642)

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


permanent link
Ralph Schoon (55.6k23642) | answered Nov 14 '17, 5:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Nov 14 '17, 5:17 a.m.

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.

vinitha dsouza selected this answer as the correct answer

Comments
1
Ralph Schoon commented Nov 14 '17, 7:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


vinitha dsouza commented Nov 15 '17, 3:41 a.m. | edited Nov 15 '17, 3:41 a.m.

Thank you very much ! It works like a charm


Ralph Schoon commented Nov 15 '17, 3:53 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Welcome, it was a revelation to find that one. The question has come up before.


Geoffrey Clemm commented Nov 15 '17, 5:38 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 As a side note, I was taking a look at the code, and it appears that TeamArea is the only queryable synthetic attribute.


Ralph Schoon commented Nov 15 '17, 5:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.

Your answer


Register or to post your answer.