1 16 package org.outerj.daisy.repository.commonimpl.comment; 17 18 import org.outerj.daisy.repository.comment.CommentManager; 19 import org.outerj.daisy.repository.comment.Comment; 20 import org.outerj.daisy.repository.comment.Comments; 21 import org.outerj.daisy.repository.comment.CommentVisibility; 22 import org.outerj.daisy.repository.RepositoryException; 23 import org.outerj.daisy.repository.VariantKey; 24 import org.outerj.daisy.repository.variant.Branch; 25 import org.outerj.daisy.repository.variant.Language; 26 import org.outerj.daisy.repository.commonimpl.AuthenticatedUser; 27 28 public class CommentManagerImpl implements CommentManager { 29 private CommonCommentManager commonCommentManager; 30 private AuthenticatedUser user; 31 32 public CommentManagerImpl(CommonCommentManager commonCommentManager, AuthenticatedUser user) { 33 this.commonCommentManager = commonCommentManager; 34 this.user = user; 35 } 36 37 public Comment addComment(long documentId, long branchId, long languageId, CommentVisibility visibility, String commentText) throws RepositoryException { 38 return commonCommentManager.addComment(documentId, branchId, languageId, visibility, commentText, user); 39 } 40 41 public Comment addComment(long documentId, CommentVisibility visibility, String commentText) throws RepositoryException { 42 return addComment(documentId, Branch.MAIN_BRANCH_ID, Language.DEFAULT_LANGUAGE_ID, visibility, commentText); 43 } 44 45 public void deleteComment(long documentId, long branchId, long languageId, long commentId) throws RepositoryException { 46 commonCommentManager.deleteComment(documentId, branchId, languageId, commentId, user); 47 } 48 49 public void deleteComment(long documentId, long commentId) throws RepositoryException { 50 deleteComment(documentId, Branch.MAIN_BRANCH_ID, Language.DEFAULT_LANGUAGE_ID, commentId); 51 } 52 53 public void deleteComment(Comment comment) throws RepositoryException { 54 commonCommentManager.deleteComment(comment, user); 55 } 56 57 public Comments getComments(long documentId, long branchId, long languageId) throws RepositoryException { 58 return commonCommentManager.getComments(documentId, branchId, languageId, user); 59 } 60 61 public Comments getComments(VariantKey variantKey) throws RepositoryException { 62 return getComments(variantKey.getDocumentId(), variantKey.getBranchId(), variantKey.getLanguageId()); 63 } 64 65 public Comments getComments(long documentId) throws RepositoryException { 66 return getComments(documentId, Branch.MAIN_BRANCH_ID, Language.DEFAULT_LANGUAGE_ID); 67 } 68 69 public Comments getComments(CommentVisibility visibility) throws RepositoryException { 70 return commonCommentManager.getComments(visibility, user); 71 } 72 73 public Comments getComments() throws RepositoryException { 74 return commonCommentManager.getComments(user); 75 } 76 } 77 | Popular Tags |