001
014
015 package com.liferay.portal.kernel.comment;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
019 import com.liferay.portal.kernel.util.Function;
020 import com.liferay.portal.kernel.util.ProxyFactory;
021 import com.liferay.portal.security.permission.PermissionChecker;
022 import com.liferay.portal.service.ServiceContext;
023
024
027 public class CommentManagerUtil {
028
029 public static long addComment(
030 long userId, long groupId, String className, long classPK,
031 String body,
032 Function<String, ServiceContext> serviceContextFunction)
033 throws PortalException {
034
035 return getCommentManager().addComment(
036 userId, groupId, className, classPK, body, serviceContextFunction);
037 }
038
039 public static long addComment(
040 long userId, long groupId, String className, long classPK,
041 String userName, String subject, String body,
042 Function<String, ServiceContext> serviceContextFunction)
043 throws PortalException {
044
045 return getCommentManager().addComment(
046 userId, groupId, className, classPK, userName, subject, body,
047 serviceContextFunction);
048 }
049
050 public static long addComment(
051 long userId, String className, long classPK, String userName,
052 long parentCommentId, String subject, String body,
053 Function<String, ServiceContext> serviceContextFunction)
054 throws PortalException {
055
056 return getCommentManager().addComment(
057 userId, className, classPK, userName, parentCommentId, subject,
058 body, serviceContextFunction);
059 }
060
061 public static void addDiscussion(
062 long userId, long groupId, String className, long classPK,
063 String userName)
064 throws PortalException {
065
066 getCommentManager().addDiscussion(
067 userId, groupId, className, classPK, userName);
068 }
069
070 public static void deleteComment(long commentId) throws PortalException {
071 getCommentManager().deleteComment(commentId);
072 }
073
074 public static void deleteDiscussion(String className, long classPK)
075 throws PortalException {
076
077 getCommentManager().deleteDiscussion(className, classPK);
078 }
079
080 public static void deleteGroupComments(long groupId)
081 throws PortalException {
082
083 getCommentManager().deleteGroupComments(groupId);
084 }
085
086 public static Comment fetchComment(long commentId) {
087 return getCommentManager().fetchComment(commentId);
088 }
089
090 public static CommentManager getCommentManager() {
091 PortalRuntimePermission.checkGetBeanProperty(CommentManagerUtil.class);
092
093 return _commentManager;
094 }
095
096 public static int getCommentsCount(String className, long classPK) {
097 return getCommentManager().getCommentsCount(className, classPK);
098 }
099
100 public static Discussion getDiscussion(
101 long userId, long groupId, String className, long classPK,
102 Function<String, ServiceContext> serviceContextFunction)
103 throws PortalException {
104
105 return getCommentManager().getDiscussion(
106 userId, groupId, className, classPK, serviceContextFunction);
107 }
108
109 public static DiscussionPermission getDiscussionPermission(
110 PermissionChecker permissionChecker) {
111
112 return getCommentManager().getDiscussionPermission(permissionChecker);
113 }
114
115 public static DiscussionStagingHandler getDiscussionStagingHandler() {
116 return getCommentManager().getDiscussionStagingHandler();
117 }
118
119 public static boolean hasDiscussion(String className, long classPK)
120 throws PortalException {
121
122 return getCommentManager().hasDiscussion(className, classPK);
123 }
124
125 public static void moveDiscussionToTrash(String className, long classPK) {
126 getCommentManager().moveDiscussionToTrash(className, classPK);
127 }
128
129 public static void restoreDiscussionFromTrash(
130 String className, long classPK) {
131
132 getCommentManager().restoreDiscussionFromTrash(className, classPK);
133 }
134
135 public static void subscribeDiscussion(
136 long userId, long groupId, String className, long classPK)
137 throws PortalException {
138
139 getCommentManager().subscribeDiscussion(
140 userId, groupId, className, classPK);
141 }
142
143 public static void unsubscribeDiscussion(
144 long userId, String className, long classPK)
145 throws PortalException {
146
147 getCommentManager().unsubscribeDiscussion(userId, className, classPK);
148 }
149
150 public static long updateComment(
151 long userId, String className, long classPK, long commentId,
152 String subject, String body,
153 Function<String, ServiceContext> serviceContextFunction)
154 throws PortalException {
155
156 return getCommentManager().updateComment(
157 userId, className, classPK, commentId, subject, body,
158 serviceContextFunction);
159 }
160
161 private static final CommentManager _commentManager =
162 ProxyFactory.newServiceTrackedInstance(CommentManager.class);
163
164 }