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 long 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 void deleteGroupComments(long groupId) throws PortalException;
056    
057            public Comment fetchComment(long commentId);
058    
059            public int getCommentsCount(String className, long classPK);
060    
061            public Discussion getDiscussion(
062                            long userId, long groupId, String className, long classPK,
063                            Function<String, ServiceContext> serviceContextFunction)
064                    throws PortalException;
065    
066            public DiscussionPermission getDiscussionPermission(
067                    PermissionChecker permissionChecker);
068    
069            public DiscussionStagingHandler getDiscussionStagingHandler();
070    
071            public boolean hasDiscussion(String className, long classPK)
072                    throws PortalException;
073    
074            public void moveDiscussionToTrash(String className, long classPK);
075    
076            public void restoreDiscussionFromTrash(String className, long classPK);
077    
078            public void subscribeDiscussion(
079                            long userId, long groupId, String className, long classPK)
080                    throws PortalException;
081    
082            public void unsubscribeDiscussion(
083                            long userId, String className, long classPK)
084                    throws PortalException;
085    
086            public long updateComment(
087                            long userId, String className, long classPK, long commentId,
088                            String subject, String body,
089                            Function<String, ServiceContext> serviceContextFunction)
090                    throws PortalException;
091    
092    }