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.kernel.comment;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.util.Function;
019    import com.liferay.portal.security.permission.PermissionChecker;
020    import com.liferay.portal.service.ServiceContext;
021    
022    /**
023     * @author Andr?? de Oliveira
024     */
025    public interface CommentManager {
026    
027            public void addComment(
028                            long userId, long groupId, String className, long classPK,
029                            String body,
030                            Function<String, ServiceContext> serviceContextFunction)
031                    throws PortalException;
032    
033            public long addComment(
034                            long userId, long groupId, String className, long classPK,
035                            String userName, String subject, String body,
036                            Function<String, ServiceContext> serviceContextFunction)
037                    throws PortalException;
038    
039            public long addComment(
040                            long userId, String className, long classPK, String userName,
041                            long parentCommentId, String subject, String body,
042                            Function<String, ServiceContext> serviceContextFunction)
043                    throws PortalException;
044    
045            public void addDiscussion(
046                            long userId, long groupId, String className, long classPK,
047                            String userName)
048                    throws PortalException;
049    
050            public void deleteComment(long commentId) throws PortalException;
051    
052            public void deleteDiscussion(String className, long classPK)
053                    throws PortalException;
054    
055            public int getCommentsCount(String className, long classPK);
056    
057            public Discussion getDiscussion(
058                            long userId, long groupId, String className, long classPK,
059                            Function<String, ServiceContext> serviceContextFunction)
060                    throws PortalException;
061    
062            public DiscussionPermission getDiscussionPermission(
063                    PermissionChecker permissionChecker);
064    
065            public boolean hasDiscussion(String className, long classPK)
066                    throws PortalException;
067    
068            public void subscribeDiscussion(
069                            long userId, long groupId, String className, long classPK)
070                    throws PortalException;
071    
072            public void unsubscribeDiscussion(
073                            long userId, String className, long classPK)
074                    throws PortalException;
075    
076            public long updateComment(
077                            long userId, String className, long classPK, long commentId,
078                            String subject, String body,
079                            Function<String, ServiceContext> serviceContextFunction)
080                    throws PortalException;
081    
082    }