org.apache.sling.sample.slingshot.comments.impl

## Class CommentsServiceImpl

- java.lang.Object
- - org.apache.sling.sample.slingshot.comments.impl.CommentsServiceImpl

All Implemented Interfaces:
  CommentsService

    public class CommentsServiceImpl
    extends Object
    implements CommentsService

Implementation of the comments service

### Field Summary

Fields
`static String` `RESOURCETYPE_COMMENTS` The resource type for the comments holder.

### Constructor Summary

Constructors
Constructor and Description
`CommentsServiceImpl()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addComment(org.apache.sling.api.resource.Resource resource, Comment c)` Add a comment to the resource
`String` `getCommentsResourcePath(org.apache.sling.api.resource.Resource resource)` Return the path to the comments resource for a resource.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### RESOURCETYPE_COMMENTS

    public static final String RESOURCETYPE_COMMENTS

The resource type for the comments holder.

See Also:
  Constant Field Values

### Constructor Detail

#### CommentsServiceImpl

    public CommentsServiceImpl()

### Method Detail

#### getCommentsResourcePath

    public String getCommentsResourcePath(org.apache.sling.api.resource.Resource resource)

Description copied from interface: `CommentsService`
Return the path to the comments resource for a resource.

Specified by:
  `getCommentsResourcePath` in interface `CommentsService`
Parameters:
  `resource` - The content resource, this is usually an entry.
Returns:
  The path to the comments resource or `null` if the passed in content resource is not part of Slingshot.
See Also:
  `CommentsService.getCommentsResourcePath(org.apache.sling.api.resource.Resource)`

#### addComment

    public void addComment(org.apache.sling.api.resource.Resource resource,
                           Comment c)
                    throws org.apache.sling.api.resource.PersistenceException

Description copied from interface: `CommentsService`
Add a comment to the resource

Specified by:
  `addComment` in interface `CommentsService`
Parameters:
  `resource` - The resource
  `c` - The commoent
Throws:
  `org.apache.sling.api.resource.PersistenceException` - If the comment can't be added
See Also:
  `CommentsService.addComment(org.apache.sling.api.resource.Resource, org.apache.sling.sample.slingshot.comments.Comment)`