Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How can I add a comment to a RAM discussion using the Java API?

I want to add a comment programmatically through the Java API.  I have made a few attempts with things like

topic.createPost("title", "description") and asset.getForums()[0].getTopics()[0].setPosts(newPostArray).  I get no errors or exceptions, but my the comments in the discussion area of my asset are not updated.

Is it possible to add comments to an asset? 

I will also need to add ratings to assets as well.  Is that also possible?

Thanks,
Dennis

0 votes



One answer

Permanent link
Hi,

I think the sample in documentation works for me in 7521, here is a url for your reference:
http://pic.dhe.ibm.com/infocenter/ramhelp/v7r5m1/topic/com.ibm.ram.doc/topics/r_api_createaforum.html

My guess is that you may need to call put in the end of process to make you change in client side about forum and topics submitted to server.

Thanks.

0 votes

Comments

Ah yes, you are correct - I had forgotten the "put".  Thanks for that.

Now I have a follow-up question.  I have been able to add a new post to the topic, but the post always is authored by the person that created the session.  I would like to have that comment authored by someone else.  I have tried the following:

        RAMTopic topic = (RAMTopic)asset.getForums()[0].getTopics()[0];
        RAMPost post = topic.createPost("title", "description");
        RAMUser user = session.getUser("username@company.com");
        System.out.println("Comment author is " + user.getName());
        post.setSubmitter(user);

I have also tried extracting the posts array from the topic, adding my new post and then setting the new post array with
     topic.setPosts(newPostsArray);
but get an error "Method is not executable by the client".

I think

RAMUser user = session.getUser("username@company.com");
System.out.println("Comment author is " + user.getName());
post.setSubmitter(user); 
works. One thing need to be noticed is that one need to make sure the user has the access to asset and asset's discussion, or I am afraid that the new post will NOT be udpated.

Would you check if the user id you specified has the access to target asset and its discussion? if it is a yes, would you offer the info of the RAM repository you are using, like the version, and the user role you specify for that user id.

Thanks.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 411

Question asked: Oct 25 '14, 1:03 a.m.

Question was seen: 4,187 times

Last updated: Oct 27 '14, 1:53 a.m.

Confirmation Cancel Confirm