/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. package com.google.ie.business.service;
  16. import com.google.ie.business.domain.Comment;
  17. import com.google.ie.business.domain.Idea;
  18. import com.google.ie.business.domain.Project;
  19. import com.google.ie.business.domain.User;
  20. import com.google.ie.dto.RetrievalInfo;
  21. import java.util.List;
  22. /**
  23. * A service specification for the Comment entity.
  24. *
  25. * @author ssbains
  26. */
  27. public interface CommentService {
  28. /**
  29. * Adds the comment submitted by the a user.<Br>
  30. * <p>
  31. * This method will save the comment on an Idea or on a Project being
  32. * developed by a team.
  33. * </p>
  34. *
  35. * @param comment The Comment object to be saved.
  36. * @param user The User object representing the comment creator.
  37. * @return Saved comment.
  38. */
  39. Comment addComment(Comment comment, User user);
  40. /**
  41. * Retrieves the list of comment objects corresponding to the
  42. * {@link RetrievalInfo}.
  43. *
  44. * To retrieve the comments of an {@link Idea}, first parameter must be a
  45. * valid Idea key.
  46. *
  47. * To retrieve the comments of a {@link Project}, first parameter must be
  48. * valid Project key.
  49. *
  50. * @param key An Idea or a Project key for which comments are
  51. * being fetched.
  52. * @param retrievalInfo The RetrievalInfo object containing the information
  53. * for comments retrieval.
  54. * @return List of comments object.
  55. */
  56. <T extends Comment> List<T> getComments(String key, RetrievalInfo retrievalInfo);
  57. /**
  58. * Flag a comment to be objectionable etc.
  59. *
  60. * @param commentKey key of the flagged comment.
  61. * @param user user object flagging the object.
  62. * @return true if flagged successfully else false.
  63. */
  64. String flagComment(String commentKey, User user);
  65. /**
  66. * Get Comment with the given key.
  67. *
  68. * @param entityKey Key of comment.
  69. * @return the comment entity.
  70. */
  71. Comment getCommentById(String entityKey);
  72. /**
  73. * Update comment with the given comment entity.
  74. *
  75. * @param comment the {@link Comment} entity.
  76. */
  77. void updateComment(Comment comment);
  78. }