View Javadoc
1   /*
2    * Licensed to The Apereo Foundation under one or more contributor license
3    * agreements. See the NOTICE file distributed with this work for additional
4    * information regarding copyright ownership.
5    *
6    *
7    * The Apereo Foundation licenses this file to you under the Educational
8    * Community License, Version 2.0 (the "License"); you may not use this file
9    * except in compliance with the License. You may obtain a copy of the License
10   * at:
11   *
12   *   http://opensource.org/licenses/ecl2.txt
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
17   * License for the specific language governing permissions and limitations under
18   * the License.
19   *
20   */
21  package org.opencastproject.event.comment.persistence;
22  
23  import org.opencastproject.event.comment.EventComment;
24  import org.opencastproject.util.NotFoundException;
25  
26  import java.util.List;
27  
28  public interface EventCommentDatabaseService {
29    /**
30     * Get the available reasons for commenting on an event.
31     *
32     * @return A list of reasons of why a comment was made.
33     * @throws EventCommentDatabaseException
34     *           Thrown if there was an issue getting the comment reasons.
35     */
36    List<String> getReasons() throws EventCommentDatabaseException;
37  
38    /**
39     * Get a comment for a particular event.
40     * @param commentId
41     *          The id for the comment.
42     *
43     * @return The comment
44     * @throws NotFoundException
45     *           Thrown if the comment cannot be found.
46     * @throws EventCommentDatabaseException
47     *           Thrown if there was an issue getting the comment from the database.
48     */
49    EventComment getComment(long commentId) throws NotFoundException, EventCommentDatabaseException;
50  
51    /**
52     * Get all of the comments for an event.
53     *
54     * @param eventId
55     *          The id of the event to get the comments for (mediapackage id).
56     * @return The {@link List} of comments.
57     * @throws EventCommentDatabaseException
58     *           Thrown if there was a problem getting the comments from the database.
59     */
60    List<EventComment> getComments(String eventId) throws EventCommentDatabaseException;
61  
62    /**
63     * Delete a comment from an event.
64     * @param commentId
65     *          The id of the comment.
66     *
67     * @throws NotFoundException
68     *           Thrown if cannot find the event / comment.
69     * @throws EventCommentDatabaseException
70     *           Thrown if there is a problem deleting the comment.
71     */
72    void deleteComment(long commentId) throws NotFoundException, EventCommentDatabaseException;
73  
74    /**
75     * Delete all comments from an event.
76     * @param eventId
77     *          The id of the event.
78     *
79     * @throws NotFoundException
80     *           Thrown if cannot find the event.
81     * @throws EventCommentDatabaseException
82     *           Thrown if there is a problem deleting the comments.
83     */
84    void deleteComments(String eventId) throws NotFoundException, EventCommentDatabaseException;
85  
86    /**
87     * Update a comment.
88     * @param comment
89     *          The new comment status to update to.
90     *
91     * @return The comment updated.
92     * @throws EventCommentDatabaseException
93     *           Thrown if there is a problem updating the comment.
94     */
95    EventComment updateComment(EventComment comment) throws EventCommentDatabaseException;
96  }