View Javadoc
1   /*
2    * Copyright (C) 2003-2007 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.services.cms.comments;
18  
19  import java.util.List;
20  
21  import javax.jcr.Node;
22  
23  /**
24   * Manages comments related to the content.
25   *
26   * @LevelAPI Experimental
27   */
28  public interface CommentsService {
29  
30    /**
31     * Adds comment to a document.
32     * This method uses variables to store values which are commented from the current user for all language types
33     * of this document.
34     * @param document The document node that is commented.
35     * @param commentor Name of the current user.
36     * If <code>null</code>, the commentor is considered as "anonymous".
37     * @param email Email of the current user.
38     * This param can be <code>null</code>.
39     * @param site Site of the current user.
40     * This param can be <code>null</code>.
41     * @param comment Content of the comment.
42     * @param language Language of the document that is commented.
43     * @see Node
44     * @throws Exception
45     */
46    public void addComment(Node document,
47                           String commentor,
48                           String email,
49                           String site,
50                           String comment,
51                           String language) throws Exception;
52  
53    /**
54     * Updates comment for a document.
55     *
56     * @param commentNode Node of the comment that will be updated.
57     * @param newComment The new comment that is set for the node.
58     * @throws Exception
59     */
60    public void updateComment(Node commentNode, String newComment) throws Exception;
61  
62    /**
63     * Deletes comment of a document by a given comment node.
64     *
65     * @param commentNode The given comment node.
66     * @throws Exception
67     */
68    public void deleteComment(Node commentNode) throws Exception;
69  
70    /**
71     * Gets all comments of a specified document node.
72     *
73     * @param document The document node that is commented.
74     * @param language Language of the document that is commented.
75     * @see Node
76     * @throws Exception
77     */
78    public List<Node> getComments(Node document, String language) throws Exception ;
79  
80  }