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

How to get all the build definitions under a project area?

Hi, I'm a new user for RTC Client API.
I want to retrieve all the buildresults under a specific project area.
(Like on Eclipse GUI, I can see all the buildresults which belong to a specific project area.)

The interface ITeamBuildClient  has two related functions: getBuildDefinition and getBuildResultContributions.
The former needs builddefition name and the latter needs IBuildResultHandle. 

I've read BuildJavaProgrammingExamples which querying buildresult with tags.

So now I still don't know how to get all the builddefinitons without any tags or ids.

Could anyone help for this problem?

Thank you very much!

0 votes


Accepted answer

Permanent link
You have to query for the list

here is similar code for BuildEngines..

hint IBuildDefinitionQueryModel

        ITeamRepository repo = (ITeamRepository) iprja.getOrigin();
        // get the data interface
        ITeamBuildClient buildClient = (ITeamBuildClient) repo.getClientLibrary(ITeamBuildClient.class);

        try
        {
            IBuildEngineQueryModel queryModel = IBuildEngineQueryModel.ROOT;
            // create a query for build engines
            IItemQuery query = IItemQuery.FACTORY.newInstance(queryModel);
            // objects of build engine type
            IPredicate isBuildEngineType = queryModel._isTypeOf(IBuildEngine.ITEM_TYPE);
            // allocate space for the parameter
            IItemHandleInputArg[] itemHandleArgs = new IItemHandleInputArg[] { query.newItemHandleArg() };
            // the query filter           
            IPredicate filter = ((BuildEngineQueryModel) queryModel).processArea()._in(itemHandleArgs);
            // set the query filter using the combined predicates             
            query.filter(isBuildEngineType._and(filter));
            // 1 parameter  required
            IItemQueryPage queryPage = buildClient.queryItems(query, new Object[] { iprja }, IQueryService.ITEM_QUERY_MAX_PAGE_SIZE, null);

            // if there are buildengines defined
            if (queryPage.getResultSize() != 0)
                while (queryPage != null)
                {
                    IFetchResult fetchResult = null;
                    if (allProperties == true)
                    {
                        fetchResult = repo.itemManager().fetchCompleteItemsPermissionAware(queryPage.getItemHandles(), IItemManager.DEFAULT, null);
                    }
                    else
                    {
Yung-Hsiang Chan selected this answer as the correct answer

0 votes

Comments

Thanks! 

I got it!!!

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

Question asked: Oct 06 '14, 11:21 p.m.

Question was seen: 4,684 times

Last updated: Oct 07 '14, 2:28 a.m.

Confirmation Cancel Confirm