It's all about the answers!

Ask a question

Query Build Definitions by Team Area


David Rostocil (911410) | asked Mar 16 '10, 3:31 p.m.
edited Mar 13 '13, 5:07 p.m. by Spencer Murata (2.3k115870)
My team manages many builds across many repositories. Given a list of repositories, I'd like to find all builds owned by my team.

It is simple and quick (~1s) to get all the build definitions in a repository using the IBuildDefinitionQueryModel. However, I would like to limit the query results to only those definitions owned by my team. I cannot find a way to build this into my query. Currently I find all the definitions in the repository and then check the definitions process area to see if it matches mine. This approach returns the correct results but is significantly slower (~5-10s). Since this page will eventually be a publicly facing aggregated list of builds 10s will not cut it. Can I add a process area to my query filter?

Should I be able to expect the RTC server to be able to handle this type of live querying for builds/results or should I look into another approach, like maintaining a separate list of hosted builds in an external database?

Thanks,
-Dave

Comments
SUNIL KUURAM commented Mar 13 '13, 2:03 p.m.

Hello Dave,

Could you advise how to use IBuildDefinitionQueryModel? I got the native SDK but I can only find this class interface to com.ibm.team.build.common.model.query.IBaseBuildDefinitionQueryModel. Not sure how to use this. I have this code snippet -

            IItemQuery itemQuery = IItemQuery.FACTORY.newInstance(IBuildDefinitionQueryModel.ROOT);


David Rostocil commented Mar 13 '13, 4:17 p.m.

 Sorry Sunil.  I wrote this code several years ago and I no longer have access to it.  Try responding to Nick's comment below.


Nick Edgar commented Mar 14 '13, 5:03 p.m.
JAZZ DEVELOPER

Hi Sunil, IBuildDefinitionQueryModel is a static member type of IBaseBuildDefinitionQueryModel:

com.ibm.team.build.common.model.query.IBaseBuildDefinitionQueryModel.IBuildDefinitionQueryModel
 
The only property exposed to filter by is the definition id, though.  The internal one at com.ibm.team.build.internal.common.model.query.BaseBuildDefinitionQueryModel.BuildDefinitionQueryModel lets you filter by owning process area and/or configuration element id, in addition to id.


Nick Edgar commented Mar 14 '13, 5:05 p.m.
JAZZ DEVELOPER

 Once the query is configured the way you want, you can run it using:

com.ibm.team.build.client.ClientFactory.getTeamBuildClient(anITeamRepository).queryItems(IItemQuery, Object[], int, IProgressMonitor), where the 2nd arg takes the values of any variable parts of the query, which should be specified as input args when configuring the query's filter.



1
Nick Edgar commented Mar 14 '13, 5:07 p.m.
JAZZ DEVELOPER

 See also https://jazz.net/wiki/bin/view/Main/BuildJavaProgrammingExamples

One answer



permanent link
Nick Edgar (6.5k711) | answered Aug 31 '12, 12:44 p.m.
JAZZ DEVELOPER
 Sorry for the long delay on this.  There are two possibiliies:
1) keep with the current approach, but avoid transferring all info about the definitions by specifying reduce list of properties when you fetch the items, e.g. fetch only build definition id and owner
2) cast down to internal com.ibm.team.build.internal.common.model.query.BaseBuildDefinitionQueryModel.processArea()
and filter on that

Your answer


Register or to post your answer.