@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);
    }
  }
  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());
    }
  }
Beispiel #3
0
  public static Set<Long> getThreadSubscriptionClassPKs(long userId) {
    List<Subscription> subscriptions =
        SubscriptionLocalServiceUtil.getUserSubscriptions(userId, MBThread.class.getName());

    Set<Long> classPKs = new HashSet<Long>(subscriptions.size());

    for (Subscription subscription : subscriptions) {
      classPKs.add(subscription.getClassPK());
    }

    return classPKs;
  }
Beispiel #4
0
  public static Set<Long> getCategorySubscriptionClassPKs(long userId) throws SystemException {

    List<Subscription> subscriptions =
        SubscriptionLocalServiceUtil.getUserSubscriptions(userId, MBCategory.class.getName());

    Set<Long> classPKs = new HashSet<Long>(subscriptions.size());

    for (Subscription subscription : subscriptions) {
      classPKs.add(subscription.getClassPK());
    }

    return classPKs;
  }
Beispiel #5
0
  @Override
  public Set<Long> getFileEntryTypeSubscriptionClassPKs(long userId) throws SystemException {

    List<Subscription> subscriptions =
        SubscriptionLocalServiceUtil.getUserSubscriptions(userId, DLFileEntryType.class.getName());

    Set<Long> classPKs = new HashSet<Long>(subscriptions.size());

    for (Subscription subscription : subscriptions) {
      classPKs.add(subscription.getClassPK());
    }

    return classPKs;
  }