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

Update Build Definitions that match with a pattern

Hello,

I need update the properties of some Builds Definitions which ID match with a pattern.

I've wrote a program that find the Build Definitions and get the properties that I want to update by means a working copy,

but the problem is How can I save the changes in the Build Definition Object?

Here is the Program:

IBuildDefinitionQueryModel BuildDefs_QueryModel = IBuildDefinitionQueryModel.ROOT;

IItemQuery query = IItemQuery.FACTORY.newInstance(BuildDefs_QueryModel);
query.filter(BuildDefs_QueryModel.id()._like(query.newStringArg()));

String[] parameters = new String[] { pattern };

IProgressMonitor monitor = new NullProgressMonitor();
ITeamBuildClient buildClient = (ITeamBuildClient) teamRepository.getClientLibrary(ITeamBuildClient.class);


IItemQueryPage queryPage = buildClient.queryItems(query, parameters, IQueryService.ITEM_QUERY_MAX_PAGE_SIZE, monitor);


if (queryPage.getSize() == 0) {
System.out.println("Zero builds Definions found with pattern '" + pattern + "'");
} else {
System.out.println("Found " + queryPage.getSize() + " builds with pattern '" + pattern + "':");

List<?> buildResults = teamRepository.itemManager().fetchCompleteItems(queryPage.getItemHandles(), IItemManager.DEFAULT, monitor);


for (Object result : buildResults) {
IBuildDefinition buildDef = (IBuildDefinition) result;
System.out.println("Build: "+ buildDef.getId());
System.out.println("\t\tfetchDestination: "+ buildDef.getProperty("team.scm.fetchDestination"));


IBuildDefinition WorkCopy_buildDef = (IBuildDefinition) buildDef.getWorkingCopy();

WorkCopy_buildDef.setProperty("team.scm.fetchDestination", "My value for TEST");


System.out.println("-------------------");

}
}

0 votes



2 answers

Permanent link
I'm working with RTC 3.0

0 votes


Permanent link
Finally I've got the solution!!!! :D

with the save method of ITeamBuildClient

Great!!!

0 votes

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

Question asked: May 30 '12, 6:36 a.m.

Question was seen: 4,990 times

Last updated: May 30 '12, 6:36 a.m.

Confirmation Cancel Confirm