Пример #1
0
  @Override
  public boolean isSubscribedToFolder(
      long companyId, long groupId, long userId, long folderId, boolean recursive)
      throws PortalException, SystemException {

    List<Long> ancestorFolderIds = new ArrayList<Long>();

    if (folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
      Folder folder = DLAppLocalServiceUtil.getFolder(folderId);

      if (recursive) {
        ancestorFolderIds = folder.getAncestorFolderIds();

        ancestorFolderIds.add(groupId);
      }

      ancestorFolderIds.add(0, folderId);
    } else {
      ancestorFolderIds.add(groupId);
    }

    long[] folderIdsArray = ArrayUtil.toLongArray(ancestorFolderIds);

    return SubscriptionLocalServiceUtil.isSubscribed(
        companyId, userId, Folder.class.getName(), folderIdsArray);
  }