How can I add a comment to a RAM discussion using the Java API?
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
One answer
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.
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.