It's all about the answers!

Ask a question

Modify buidforge projects in Build definition


Vijay Reddy Gaddam (562441) | asked Nov 28 '14, 4:41 a.m.
edited Nov 28 '14, 10:11 a.m. by Ralph Schoon (58.7k23642)
 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.

2 answers



permanent link
Ryan Ruscett (1.0k413) | answered Nov 28 '14, 10:06 a.m.
 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. 

permanent link
Ralph Schoon (58.7k23642) | answered Nov 28 '14, 10:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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.

Comments
Vijay Reddy Gaddam commented Dec 08 '14, 12:38 a.m. | edited Dec 08 '14, 12:42 a.m.

 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.


Ralph Schoon commented Dec 08 '14, 3:03 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


Vijay Reddy Gaddam commented Dec 08 '14, 6:57 a.m. | edited Dec 08 '14, 6:57 a.m.

  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.


Ralph Schoon commented Dec 08 '14, 7:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.

Your answer


Register or to post your answer.