It's all about the answers!

Ask a question

Get process configuration source via API

SUNIL KUURAM (6431923) | asked Apr 30 '13, 10:52 p.m.
Hello Everyone,

I was trying below to get the process configuration source -

 On the client:
1. Get the client library IProcessClientService.
2. From this, get the client process for the project area in question.
3. Get the config data from the client process.

Looks like the getProjectConfigurationData method requires a string ID. I tried "". No luck. Any idea what it should be?


4 answers

permanent link
Lauren Hayward Schaefer (3.3k11527) | answered May 01 '13, 8:40 a.m.
Hi Sunil,
This post might get you started:

SUNIL KUURAM commented May 01 '13, 11:35 a.m.

Many thanks for your responses.

How do I get string content from IContent? Please advise how the createStringFromContent method should be written.

String xmlSource = createStringFromContent(cnt);


sam detweiler commented May 01 '13, 11:44 a.m.

see the post below.. direct response area is too small

permanent link
sam detweiler (12.5k6194201) | answered May 01 '13, 10:37 a.m.
edited May 01 '13, 11:37 a.m.
the key string is
found by exported item;

permanent link
sam detweiler (12.5k6194201) | answered May 01 '13, 11:43 a.m.
get the icontent object, and then call save
                            IProjectArea parentProject = (IProjectArea) (repo
                                    IItemManager.DEFAULT, sPm));
                            System.out.println("have parent project name = "
                                    + parentProject.getName());
                            // get the process data
                            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);
then save the source
    // save the process source for the project
    private static void saveXMLSource(IProjectArea ip, IContent ic,
            IContentManager icm, SysoutProgressMonitor sPm)
        // make an output stream for the content manager
        OutputStream os = new ByteArrayOutputStream();
        // get the content of the content object.
            icm.retrieveContent(ic, os, sPm);

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

SUNIL KUURAM commented May 01 '13, 11:52 a.m.

Many thanks for this.

How do I populate IContentManager icm, SysoutProgressMonitor sPm ?

Appreciate your help.

permanent link
sam detweiler (12.5k6194201) | answered May 01 '13, 12:18 p.m.
edited May 01 '13, 12:18 p.m.
the Monitor part of the apis is a class object, I made my own to be able to control the output
import org.eclipse.core.runtime.*;

public class SysoutProgressMonitor implements IProgressMonitor {
then added all the required methods.

the Content Manager is accessible thru the repository object after logon
            // login &
            // get the repository object where we are connecting
            if ((repo=login(url, userid, password, sPm)) != null )
                // get the content Manager
                IContentManager icm = repo.contentManager();

Your answer

Register or to post your answer.