001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.comment;
016    
017    import com.liferay.portal.kernel.comment.BaseDiscussionPermission;
018    import com.liferay.portal.kernel.comment.CommentManager;
019    import com.liferay.portal.kernel.comment.Discussion;
020    import com.liferay.portal.kernel.comment.DiscussionComment;
021    import com.liferay.portal.kernel.comment.DiscussionPermission;
022    import com.liferay.portal.kernel.util.Function;
023    import com.liferay.portal.security.permission.PermissionChecker;
024    import com.liferay.portal.service.ServiceContext;
025    
026    /**
027     * @author Andr?? de Oliveira
028     */
029    public class DummyCommentManagerImpl implements CommentManager {
030    
031            @Override
032            public void addComment(
033                    long userId, long groupId, String className, long classPK, String body,
034                    Function<String, ServiceContext> serviceContextFunction) {
035            }
036    
037            @Override
038            public long addComment(
039                    long userId, long groupId, String className, long classPK,
040                    String userName, String subject, String body,
041                    Function<String, ServiceContext> serviceContextFunction) {
042    
043                    return 0;
044            }
045    
046            @Override
047            public long addComment(
048                    long userId, String className, long classPK, String userName,
049                    long parentCommentId, String subject, String body,
050                    Function<String, ServiceContext> serviceContextFunction) {
051    
052                    return 0;
053            }
054    
055            @Override
056            public void addDiscussion(
057                    long userId, long groupId, String className, long classPK,
058                    String userName) {
059            }
060    
061            @Override
062            public void deleteComment(long commentId) {
063            }
064    
065            @Override
066            public void deleteDiscussion(String className, long classPK) {
067            }
068    
069            @Override
070            public int getCommentsCount(String className, long classPK) {
071                    return 0;
072            }
073    
074            @Override
075            public Discussion getDiscussion(
076                    long userId, long groupId, String className, long classPK,
077                    Function<String, ServiceContext> serviceContextFunction) {
078    
079                    return _discussion;
080            }
081    
082            @Override
083            public DiscussionPermission getDiscussionPermission(
084                    PermissionChecker permissionChecker) {
085    
086                    return _discussionPermission;
087            }
088    
089            @Override
090            public boolean hasDiscussion(String className, long classPK) {
091                    return false;
092            }
093    
094            @Override
095            public void subscribeDiscussion(
096                    long userId, long groupId, String className, long classPK) {
097            }
098    
099            @Override
100            public void unsubscribeDiscussion(
101                    long userId, String className, long classPK) {
102            }
103    
104            @Override
105            public long updateComment(
106                    long userId, String className, long classPK, long commentId,
107                    String subject, String body,
108                    Function<String, ServiceContext> serviceContextFunction) {
109    
110                    return 0;
111            }
112    
113            private static final Discussion _discussion = new Discussion() {
114    
115                    @Override
116                    public boolean isMaxCommentsLimitExceeded() {
117                            return true;
118                    }
119    
120                    @Override
121                    public DiscussionComment getRootDiscussionComment() {
122                            return null;
123                    }
124    
125            };
126    
127            private static final DiscussionPermission _discussionPermission =
128                    new BaseDiscussionPermission() {
129    
130                            @Override
131                            public boolean hasAddPermission(
132                                    long companyId, long groupId, String className, long classPK) {
133    
134                                    return false;
135                            }
136    
137                            @Override
138                            public boolean hasDeletePermission(long commentId) {
139    
140                                    return false;
141                            }
142    
143                            @Override
144                            public boolean hasUpdatePermission(long commentId) {
145    
146                                    return false;
147                            }
148    
149                            @Override
150                            public boolean hasViewPermission(
151                                    long companyId, long groupId, String className, long classPK) {
152    
153                                    return false;
154                            }
155    
156                    };
157    
158    }