@Override public void unfollowThread(final long threadId) throws DataSourceException { try { SubscriptionLocalServiceUtil.deleteSubscription(currentUserId, MBThread.class.getName(), threadId); } catch (final NestableException e) { LOG.error(String.format("Cannot unfollow thread %d", threadId), e); throw new DataSourceException(e); } }
subscriptions.addAll(SubscriptionLocalServiceUtil.getSubscriptions( mbMessage.getCompanyId(), MBThread.class.getName(), mbMessage.getThreadId())); .deleteSubscription(subscription .getSubscriptionId()); } catch (NestableException e) {
@Override public void followThread(final long threadId) throws DataSourceException { if (isLoggedInUser()) { try { SubscriptionLocalServiceUtil.addSubscription(currentUserId, UserLocalServiceUtil.getUser(currentUserId) .getGroupId(), MBThread.class.getName(), threadId); } catch (final NestableException e) { LOG.error(String.format("Cannot follow thread %d", threadId), e); throw new DataSourceException(e); } catch (final NullPointerException e) { LOG.error(String.format("Cannot follow thread %d", threadId), e); } } }
@Override public boolean isFollowingThread(final long threadId) { boolean result = false; if (isLoggedInUser()) { try { final com.liferay.portal.model.User user = UserLocalServiceUtil .getUser(currentUserId); result = SubscriptionLocalServiceUtil.isSubscribed( user.getCompanyId(), user.getUserId(), MBThread.class.getName(), threadId); } catch (final NestableException e) { LOG.error(String .format("Cannot check if user is following thread %d", threadId), e); } } return result; }