Package org.silverpeas.components.community.repository

# Interface CommunityOfUsersRepository

All Superinterfaces:
  `org.silverpeas.core.persistence.datasource.repository.EntityRepository<CommunityOfUsers>`

All Known Implementing Classes:
  `CommunityOfUsersJpaRepository`

public interface CommunityOfUsersRepository extends org.silverpeas.core.persistence.datasource.repository.EntityRepository<CommunityOfUsers>
This repository manages the persistence of communities of users. It abstracts the nature of the datasource in which are stored the communities as well as the persistence engine used to manage the access to such a datasource.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static CommunityOfUsersRepository`
  `get()`
  Gets the single instance of this repository.
  `List<CommunityOfUsers>`
  `getAllByUserId(String userId)`
  Gets all the community of users the specified user is currently a member.
  `Optional<CommunityOfUsers>`
  `getByComponentInstanceId(String componentInstanceId)`
  Gets the community of users managed by the specified component instance.
  `Optional<CommunityOfUsers>`
  `getBySpaceId(String spaceId)`
  Gets the community of users of the specified collaborative space.

  ### Methods inherited from interface org.silverpeas.core.persistence.datasource.repository.EntityRepository

  `contains, delete, delete, deleteByComponentInstanceId, deleteById, deleteById, findByCriteria, flush, getAll, getById, getById, getById, save, save, save`

- ## Method Details

  - ### get

    static CommunityOfUsersRepository get()
    Gets the single instance of this repository.

  - ### getByComponentInstanceId

    Optional<CommunityOfUsers> getByComponentInstanceId(String componentInstanceId)
    Gets the community of users managed by the specified component instance.
    Parameters:
      `componentInstanceId` - the unique identifier of a component instance.
    Returns:
      an `Optional` with the `CommunityOfUsers` instance or an empty `Optional` if no such component instance exists.

  - ### getBySpaceId

    Optional<CommunityOfUsers> getBySpaceId(String spaceId)
    Gets the community of users of the specified collaborative space.
    Parameters:
      `spaceId` - the unique identifier of a space.
    Returns:
      an `Optional` with the `CommunityOfUsers` instance or an empty `Optional` if no such space exists or if the space doesn't have any community.

  - ### getAllByUserId

    List<CommunityOfUsers> getAllByUserId(String userId)
    Gets all the community of users the specified user is currently a member.
    Parameters:
      `userId` - the unique identifier of a user.
    Returns:
      a list of communities to which the given user is a member.