Programmatically Adding a Discussion to a Folder

I have a workflow which, depending upon certain conditions, needs to automatically create a discussion thread in a folder.  Using Documentum Collaboration Services in Webtop this is as simple as a few clicks.  It turned out to be rather simple in Java too; however, unearthing the right combination to objects and methods proved to be the challenge.  The only documentation I could find regarding the Collaboration API is a dated (5.3 SP2) Documentum Collaboration Edition API and Developer Guide and on the old Documentum Component Exchange.

Following are the highlights from the code I eventually developed to perform the creation of the discussion thread in an automatic workflow activity.  I have notated the “gotchas” I discovered.  This code was written for Content Server 6.5 SP2 with Documentum Collaborative Services installed.

//make sure the collaboration.jar is in your build path

// get comment manager service
ICommentManager commMgr = (ICommentManager) DfClient.getLocalClient().newService(ICommentManager.class.getName(),session.getSessionManager());

// create the TOPIC -- this is the container for the discussion threads
// the name of the topic MUST be 'topic' or it won't show up in
// the container
topic = commMgr.createTopic("topic",folder_where_the_topic_should_be_linked.getObjectId(),true);

// create the discussion thread (comment)
// even though the comment is created from the topic object, you
// MUST provide the object id of the folder where the topic exists
sysComment = (IDfSysObject) topic.createComment(folder_where_the_topic_is_linked.getObjectId());
sysComment.setTitle("comment name");
sysComment.setObjectName("comment name");
IRichText richText = ((IComment) sysComment).getBody();
richText.setContentAsText("this is the body");;

Topics (dmc_topic) are folders and the comments (dmc_comment) are content-less objects (hidden by default).  They are stored in the “/System/Topics” folder.


About Scott
I have been implementing Documentum solutions since 1997. In 2005, I published a book about developing Documentum solutions for the Documentum Desktop Client (ISBN 0595339689). In 2010, I began this blog as a record of interesting and (hopefully) helpful bits of information related to Documentum, and as a creative outlet.

6 Responses to Programmatically Adding a Discussion to a Folder

  1. Sam says:

    Hi Scott,

    Thank you very much for sharing the code. I followed your instructions in adding collaboration.jar. The code compiles without any error, but am getting the runtime error

    “ClassNotFoundException:”. Please let me know if I am missing anything.




    • Scott says:

      Sam, make sure the collaboration.jar file is in your run-time class path as well as the compile-time class path. If you are using this code as a workflow method, the jar file may need to go into the Java Method Server’s lib folder. (I can’t remember for sure and, unfortunately, don’t have access to that project anymore).


      • Sam says:

        Thank you very much for your reply. After I added the classfolder it started working. The issue I am now having is creating a DISCUSSION topic in CenterStage. Any guidance is highly appreciated.


      • Scott says:

        Sam, glad you got it working. I don’t have any insights for CenterStage; I would hope the DFC interface is the same. If you learn something worth sharing, let me know.


  2. Eshan Nanda says:

    I need to add discussion to a document.. When I am using the code written above, I am getting an error :
    THREAD: main; MSG: [DFC_BOF_CANNOT_FIND_OBJECT] Business object does not exist in docbase final; ERRORCODE: ff; NEXT: null

    where final is the name of the repository.. Please suggest


  3. Pingback: “The Basics” Series | dm_misc: Miscellaneous Documentum Information

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: