KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > repository > commonimpl > comment > CommentManagerImpl


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

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 JavaDoc commentText) throws RepositoryException {
38         return commonCommentManager.addComment(documentId, branchId, languageId, visibility, commentText, user);
39     }
40
41     public Comment addComment(long documentId, CommentVisibility visibility, String JavaDoc 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