@Override public void deleteSubscription(Subscription subscription) throws PortalException, SystemException { // Subscription subscriptionPersistence.remove(subscription); // Social AssetEntry assetEntry = assetEntryPersistence.fetchByC_C(subscription.getClassNameId(), subscription.getClassPK()); if (assetEntry != null) { String className = PortalUtil.getClassName(subscription.getClassNameId()); socialActivityLocalService.addActivity( subscription.getUserId(), assetEntry.getGroupId(), className, subscription.getClassPK(), SocialActivityConstants.TYPE_UNSUBSCRIBE, StringPool.BLANK, 0); socialEquityLogLocalService.deactivateEquityLogs( subscription.getUserId(), className, subscription.getClassPK(), ActionKeys.SUBSCRIBE, StringPool.BLANK); } }
public void deleteGroupKBArticles(long groupId) throws PortalException, SystemException { // KB articles List<KBArticle> kbArticles = getSiblingKBArticles( groupId, KBArticleConstants.DEFAULT_PARENT_RESOURCE_PRIM_KEY, WorkflowConstants.STATUS_ANY, QueryUtil.ALL_POS, QueryUtil.ALL_POS, new KBArticlePriorityComparator()); for (KBArticle kbArticle : kbArticles) { deleteKBArticle(kbArticle); } // Subscriptions Group group = groupLocalService.getGroup(groupId); List<Subscription> subscriptions = subscriptionLocalService.getSubscriptions( group.getCompanyId(), KBArticle.class.getName(), groupId); for (Subscription subscription : subscriptions) { unsubscribeGroupKBArticles(subscription.getUserId(), groupId); } }
public void unsubscribe(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); if (!themeDisplay.isSignedIn()) { return; } long[] subscriptionIds = StringUtil.split(ParamUtil.getString(actionRequest, "subscriptionIds"), 0L); for (long subscriptionId : subscriptionIds) { if (subscriptionId <= 0) { continue; } Subscription subscription = SubscriptionLocalServiceUtil.getSubscription(subscriptionId); if (themeDisplay.getUserId() != subscription.getUserId()) { throw new PrincipalException(); } SubscriptionLocalServiceUtil.deleteSubscription(subscription); } }
protected void deleteSubscriptions(KBArticle kbArticle) throws PortalException, SystemException { List<Subscription> subscriptions = subscriptionLocalService.getSubscriptions( kbArticle.getCompanyId(), KBArticle.class.getName(), kbArticle.getResourcePrimKey()); for (Subscription subscription : subscriptions) { unsubscribeKBArticle(subscription.getUserId(), subscription.getClassPK()); } }
protected void importSubscription(Subscription subscription, long calendarBookingId) throws SystemException { addSubscription( counterLocalService.increment(), subscription.getCompanyId(), subscription.getUserId(), subscription.getUserName(), subscription.getCreateDate(), subscription.getModifiedDate(), classNameLocalService.getClassNameId(CalendarBooking.class), calendarBookingId, subscription.getFrequency()); }