Modify buidforge projects in Build definition
I have around 730+ build definitions across 40 project areas. I need to modify all these build definitions since there is a change in the build forge project parameters.
Is there any possibility to modify the buildforge project and synchronize the properties for all the 730+ build definitions using java API.
Thanks and Regards,
Vijay Reddy.
Vijay Reddy.
2 answers
Hello,
That depends on what changes you are making. Build Forge stores everything in the database. So for example. If I wanted to set a project specific parameter. It would be represented in the database by some value depending on what it is. I could write a sql query in order to change that value for all projects in the DB.
I would need to know the param being changed first.
The RTC Plain Java Client Libraries allow to access and modify the build definitions.
https://jazz.net/wiki/bin/view/Main/BuildJavaProgrammingExamples talks about example code. This is a good entry point for how to set up for development https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/
There have also been several discussions around this topic on this forum. You can search this forum for hints, once you have managed the basics. If you have more detailed questions you can search for content. I usually use a commercial search engine with my search parameters and add site:jazz.net to limit where to search.
https://jazz.net/wiki/bin/view/Main/BuildJavaProgrammingExamples talks about example code. This is a good entry point for how to set up for development https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/
There have also been several discussions around this topic on this forum. You can search this forum for hints, once you have managed the basics. If you have more detailed questions you can search for content. I usually use a commercial search engine with my search parameters and add site:jazz.net to limit where to search.
Comments
Hi Ralph,
Thank you for the valuable suggestion.
I downloaded the source code of RTC 4.0.4 and tried to achieve what I intended in the above question(Modify build definition).
Here is the sample code What I used, But I have compilation erros:
Could you help me out what went wrong in the code please:
IItemManager itemManager = teamRepository.itemManager();
IItemQuery itemQuery = IItemQuery.FACTORY.newInstance(IBuildDefinitionQueryModel.ROOT);
ItemQueryIterator<IBuildDefinitionHandle> iter = new ItemQueryIterator<IBuildDefinitionHandle>(buildClient,
itemQuery, IQueryService.EMPTY_PARAMETERS);
List<IBuildDefinition> buildDefinitions = new LinkedList<IBuildDefinition>();
while (iter.hasNext(monitor)) {
List<IBuildDefinitionHandle> definitionHandles = iter.next(IQueryService.ITEM_QUERY_MAX_PAGE_SIZE, monitor);
List<IBuildDefinition> buildDefinitionsList = itemManager.fetchCompleteItems(definitionHandles, IItemManager.DEFAULT, monitor);
for (IBuildDefinition buildDefinition : buildDefinitionsList) {
if (buildDefinition != null) {
System.out.print(buildDefinition.getId());
IProcessAreaHandle processAreaHandle = (IProcessAreaHandle) buildDefinition.getProcessArea();
IProcessArea processArea = (IProcessArea) itemManager.fetchCompleteItem(processAreaHandle, ItemManager.DEFAULT, monitor);
System.out.println("\t" + processArea.getName());
IBuildDefinitionTemplate template = BuildConfigurationRegistry.getInstance().getBuildDefinitionTemplate("com.ibm.rational.connector.buildforge");
BuildDefinitionEditorInput input = new BuildDefinitionEditorInput(buildDefinition, processArea, teamRepository, false);
MockBuildDefinitionEditor editor = new MockBuildDefinitionEditor();
MockEditorSite site = new MockEditorSite();
editor.init(site, input);
}
}
}
Thanks and Regards,
Vijay Reddy.
Vijay Reddy.
Noone can help with compilation errors, if you don't list them. They should be easy enough to resolve by adding the correct libraries or whatever is missing.
Hi Ralph,
I have added all the libraries that are needed, But still I'm getting this error for the statement: editor.init(site, input);
Errors are:
- The method init(IEditorSite, IEditorInput) from the type BuildDefinitionEditor refers to the missing type IEditorSite
- The type org.eclipse.ui.forms.editor.SharedHeaderFormEditor cannot be resolved. It is indirectly referenced from required .class files
- The type org.eclipse.ui.PartInitException cannot be resolved. It is indirectly referenced from required .class files
- The type org.eclipse.ui.IEditorSite cannot be resolved. It is indirectly referenced from required .class files
- The type org.eclipse.ui.IEditorInput cannot be resolved. It is indirectly referenced from required .class files.
If you have any information that I might be missing any jars that are to be referred can you please list those?
Thanks and Regards,
Vijay.
Vijay.
I am fairly sure that you are trying to use a UI class that is of course not available in the plain java client libraries. You will have to create an automation that does not use the UI classes, or you will have to create an extension in the Eclipse client that correctly uses the UI.