Package org.silverpeas.components.community.repository

## Interface CommunityMembershipRepository.CommunityMembershipsTable

- Enclosing interface:
    CommunityMembershipRepository

      public static interface CommunityMembershipRepository.CommunityMembershipsTable

  The table of memberships of a given community of users. This table gathers all the memberships of the users to the given community; it includes both the removed memberships, the pending ones and the committed ones. In fact, when a member is removed from a community, his membership in the table is never deleted but just updated with the status `MembershipStatus.REMOVED`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `deleteAll()` | Deletes all the memberships in this table.
    `org.silverpeas.core.util.SilverpeasList<CommunityMembership>` | `getAll​(org.silverpeas.core.admin.PaginationPage page)` | Gets all the memberships registered into this table and included in the specified pagination page.
    `List<CommunityMembership>` | `getAllMembers()` | Gets all the committed or pending memberships to the community of users.
    `Optional<CommunityMembership>` | `getByUser​(org.silverpeas.core.admin.user.model.User user)` | Gets the membership to the community of the specified user.
    `org.silverpeas.core.util.SilverpeasList<CommunityMembership>` | `getMembers​(org.silverpeas.core.admin.PaginationPage page)` | Gets the committed memberships of the specified community included in the specified pagination page.
    `org.silverpeas.core.util.SilverpeasList<CommunityMembership>` | `getPending​(org.silverpeas.core.admin.PaginationPage page)` | Gets the membership that are pending and included in the specified pagination page.
    `boolean` | `isEmpty()` | Is this table is empty?

- - ### Method Detail

    - #### deleteAll

          void deleteAll()

      Deletes all the memberships in this table. This method has to be invoked only when the community is being itself deleted. This method should be invoked only by the `CommunityInstancePreDestruction` bean.

    - #### getByUser

          Optional<CommunityMembership> getByUser​(org.silverpeas.core.admin.user.model.User user)

      Gets the membership to the community of the specified user. Only committed or pending membership is considered.
      Parameters:
        `user` - a user.
      Returns:
        either a `CommunityMembership` instance related to the specified user or nothing if the user isn't (anymore) member of the community of users.

    - #### getPending

          org.silverpeas.core.util.SilverpeasList<CommunityMembership> getPending​(@Nullable
                                                                                  org.silverpeas.core.admin.PaginationPage page)

      Gets the membership that are pending and included in the specified pagination page. If the page is null then all the pending memberships are returned.
      Parameters:
        `page` - the page from which the pending membership are got or null to get all the pending memberships from this table.
      Returns:
        a paginated list of pending memberships to the community if users.

    - #### getMembers

          org.silverpeas.core.util.SilverpeasList<CommunityMembership> getMembers​(@Nonnull
                                                                                  org.silverpeas.core.admin.PaginationPage page)

      Gets the committed memberships of the specified community included in the specified pagination page.
      Parameters:
        `page` - the page from which the memberships are got.
      Returns:
        a paginated list of committed memberships to the community of users.

    - #### getAll

          org.silverpeas.core.util.SilverpeasList<CommunityMembership> getAll​(@Nonnull
                                                                              org.silverpeas.core.admin.PaginationPage page)

      Gets all the memberships registered into this table and included in the specified pagination page. All the memberships are taken, whatever their status, and hence even those being pending, removed or refused.
      Parameters:
        `page` - the page from which the memberships are got.
      Returns:
        a paginated list of memberships to the community of users.

    - #### getAllMembers

          List<CommunityMembership> getAllMembers()

      Gets all the committed or pending memberships to the community of users. This method is mainly to be used for synchronization as no pagination is performed.
      Returns:
        a list of actual memberships of the community.

    - #### isEmpty

          boolean isEmpty()

      Is this table is empty?
      Returns:
        true if the community of users hasn't yet any memberships registered. False otherwise.