It's all about the answers!

Ask a question

Copy CCM process template changes to all project


Chid . (2052958) | asked Aug 24 '21, 2:15 a.m.

We have 500 ccm projects. Some of the projects don't refer to a shared process template.

New Precondition is added the template project. How to programmatically implement those changes in all projects, particularly to the projects that don't use shared process template.


Comments
Ralph Schoon commented Aug 24 '21, 2:49 a.m. | edited Aug 24 '21, 2:50 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 I am not aware of anything. Technically it might be possible to manipulate the process XML using the internal rich client platform or even using some Plain Java Client Libraries, but all the discussions I remember, suggested that to not really be supported. I would suggest to approach support. I think there should be some kind of automation capability to do this. 

One answer



permanent link
Emiliano Iannetti (385) | answered Aug 24 '21, 6:58 a.m.

Hi, I have a similar problem also I found this in the various open links:
[code]

// get it
IProjectArea project = (IProjectArea) (repo.itemManager().fetchCompleteItem(iparenthandle,IItemManager.DEFAULT, sPm));
System.out.println("have parent project name = "+ project.getName());
// get the process data
@SuppressWarnings("unchecked")
Map<string, object=""> pd = ip.getProcessData();
////  here is the xml extract
// get the process config content object
IContent processSource = (IContent) pd.get(keyname);
if (processSource != null)
{
System.out.println("have xml source");
saveXMLSource(ip, processSource, icm, sPm);
}                
[/code]
Unfortunately, however, there is also the saveXmlSource method, it is not described or at least I have not found it ...
If I can tell you, however, "massive" changes to the aforementioned file, even manually, are often counterproductive, so I would advise you, in my knowledge which is few, to change your approach if you can ...


Comments
Ralph Schoon commented Aug 24 '21, 7:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Note that being able to automate something could also mean to accidentally destroy many things. Excessive testing and backup etc are obvious.

Manipulating your process configuration can render your process broken. This could be subtile, so you might not recognize it immediately.

The missing code looks like this. Don't tell anyone I provided it.


    // save the process source for the project
    /*
     * @param ip
     * @param ic
     * @param icm
     * @param name
     * @param monitor
     /
    private static void saveXMLSource(IProjectArea ip, IContent ic, IContentManager icm, String name,
            IProgressMonitor monitor) {
        // make an output stream for the content manager
        OutputStream os = new ByteArrayOutputStream();
        // get the content of the content object.
        try {
            icm.retrieveContent(ic, os, null);

        // write xml content to file
        // project name + data name
        FileOutputStream fo = new FileOutputStream(ip.getName() + name + "." + "xml");
        // write
        fo.write(os.toString().getBytes(), 0, os.toString().length());
        // close
        fo.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
</pre>

Emiliano Iannetti commented Aug 24 '21, 8:52 a.m.

 Thank you very much, I immediately get down to the studio.


Emiliano Iannetti commented Aug 26 '21, 1:05 p.m.
Good evening and sorry for the delay.
I used your method and I have been successful but unfortunately it is not useful for the purpose even if I use it to make a backup copy of the same in "local" so at least if you need it you always have a backup ready to use.
I thought that the js were "traceable" also by the processConfiguration but unfortunately this is not the case for those but I found the solution as I wrote to you .... So thank you very much as always you are always a great help, I hope I can help someone too 'other with all my doubts.

Your answer


Register or to post your answer.