001/*
002 * (C) Copyright 2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id$
020 */
021
022package org.nuxeo.ecm.platform.comment.api;
023
024import java.io.Serializable;
025import java.util.List;
026
027import org.nuxeo.ecm.core.api.DocumentModel;
028
029/**
030 * @author <a href="mailto:glefter@nuxeo.com">George Lefter</a>
031 */
032public interface CommentableDocument extends Serializable {
033
034    /**
035     * Returns all comments for this document.
036     *
037     * @return the list of comments
038     */
039    List<DocumentModel> getComments();
040
041    /**
042     * Returns the comments for this document that are replied to a parent comment.
043     *
044     * @param parent the parent comment
045     * @return the comments for the parent comment
046     */
047    List<DocumentModel> getComments(DocumentModel parent);
048
049    /**
050     * Removes a comment from the document comment list.
051     *
052     * @param comment
053     */
054    void removeComment(DocumentModel comment);
055
056    /**
057     * Creates a new comment.
058     *
059     * @param comment
060     */
061    DocumentModel addComment(DocumentModel comment);
062
063    /**
064     * Creates a new comment as a reply to an existing comment.
065     *
066     * @param parent the parent comment, which must exist
067     * @param comment the comment to be added
068     */
069    DocumentModel addComment(DocumentModel parent, DocumentModel comment);
070
071}