PageRenderTime 11ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/main/java/com/google/ie/business/service/CommentService.java

http://thoughtsite.googlecode.com/
Java | 87 lines | 14 code | 9 blank | 64 comment | 0 complexity | 905f0f16a909b32ffd6a1c952ec26e00 MD5 | raw file
 1/* Copyright 2010 Google Inc.
 2 * 
 3 * Licensed under the Apache License, Version 2.0 (the "License");
 4 * you may not use this file except in compliance with the License.
 5 * You may obtain a copy of the License at
 6 * 
 7 *      http://www.apache.org/licenses/LICENSE-2.0
 8 * 
 9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS.
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License
14 */
15
16package com.google.ie.business.service;
17
18import com.google.ie.business.domain.Comment;
19import com.google.ie.business.domain.Idea;
20import com.google.ie.business.domain.Project;
21import com.google.ie.business.domain.User;
22import com.google.ie.dto.RetrievalInfo;
23
24import java.util.List;
25
26/**
27 * A service specification for the Comment entity.
28 * 
29 * @author ssbains
30 */
31public interface CommentService {
32    /**
33     * Adds the comment submitted by the a user.<Br>
34     * <p>
35     * This method will save the comment on an Idea or on a Project being
36     * developed by a team.
37     * </p>
38     * 
39     * @param comment The Comment object to be saved.
40     * @param user The User object representing the comment creator.
41     * @return Saved comment.
42     */
43    Comment addComment(Comment comment, User user);
44
45    /**
46     * Retrieves the list of comment objects corresponding to the
47     * {@link RetrievalInfo}.
48     * 
49     * To retrieve the comments of an {@link Idea}, first parameter must be a
50     * valid Idea key.
51     * 
52     * To retrieve the comments of a {@link Project}, first parameter must be
53     * valid Project key.
54     * 
55     * @param key An Idea or a Project key for which comments are
56     *        being fetched.
57     * @param retrievalInfo The RetrievalInfo object containing the information
58     *        for comments retrieval.
59     * @return List of comments object.
60     */
61    <T extends Comment> List<T> getComments(String key, RetrievalInfo retrievalInfo);
62
63    /**
64     * Flag a comment to be objectionable etc.
65     * 
66     * @param commentKey key of the flagged comment.
67     * @param user user object flagging the object.
68     * @return true if flagged successfully else false.
69     */
70    String flagComment(String commentKey, User user);
71
72    /**
73     * Get Comment with the given key.
74     * 
75     * @param entityKey Key of comment.
76     * @return the comment entity.
77     */
78    Comment getCommentById(String entityKey);
79
80    /**
81     * Update comment with the given comment entity.
82     * 
83     * @param comment the {@link Comment} entity.
84     */
85    void updateComment(Comment comment);
86}
87