Commenting on a Resource
You can also comment on a resource using the registry. The following lines of code illustrate how to create a comment object and call the registry instance:
Comment c1 = new Comment(); c1.setText("This is my comment"); String commentPath = registry.addComment("/c1/c2/r2", c1);
The above lines of code will add a comment to the resource named: "c1/c2/r2 ."
Edit a Comment
You can also make changes to comments you have already made using the registry instance. Here, you need the path and new text for the comment which is being added. For example, to change from "This is my comment" to "This is cool," do the following:
registry.editComment(commentPath, "This is cool"); // Here commentPath have a value something like "/c1/c2/r2;comment:1"
Remove a Comment
A comment can be removed using the comment path. The following code shows how this is done:
registry.removeComment(commentpath);
Retrieving Comments Made About a Resource
Comments about a specific resource can be retrieved using the following code:
registry.getComments("/c1/c2/r2");
See also Comments and Ratings to learn how to manage commenting using the Management Console.