Package org.silverpeas.components.community.model

# Class CommunityMembership

java.lang.Object
org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<E,I>
org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity<CommunityMembership,org.silverpeas.core.persistence.datasource.model.identifier.UuidIdentifier>
org.silverpeas.components.community.model.CommunityMembership

All Implemented Interfaces:
  `Serializable`, `org.silverpeas.core.persistence.datasource.model.Entity<CommunityMembership,org.silverpeas.core.persistence.datasource.model.identifier.UuidIdentifier>`, `org.silverpeas.core.persistence.datasource.model.IdentifiableEntity`

@Entity public class CommunityMembership extends org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity<CommunityMembership,org.silverpeas.core.persistence.datasource.model.identifier.UuidIdentifier>
Membership of a given user in a community of users. Memberships are managed by the `CommunityOfUsers` to which they are related, and they are provided by the `CommunityMembershipsProvider` which ensures the synchronization between the memberships to a community and the users playing a role in the community space.

All along the life of his membership, the status of his membership in the community can change. When a community requires a validation step for memberships requests, the user asking such a thing has his membership created with a pending status. Otherwise, his membership is committed automatically. Once his membership committed, a user becomes then a member of the community of users. This means he has rights to access the content of the community space, which is a collaborative space with a community of users. To become a member of a community for a space, a user has to ask to join this community to the administrators. As a member of a community of a space, the user can navigate within the space's tree according to his access rights. A user is said to be a member of a given community space if and only if he plays a role in this space.

Author:
  mmoquillon
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `CommunityMembership()`
  Constructs an empty member of nothing.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  `CommunityOfUsers`
  `getCommunity()`
  Gets the community to which this membership belongs.
  `OffsetDateTime`
  `getJoiningDate()`
  Gets the date at which the user has effectively joined the community.
  `org.silverpeas.core.admin.user.model.SilverpeasRole`
  `getMemberRole()`
  Gets the role the user related by this membership plays in the community space.
  `MembershipStatus`
  `getStatus()`
  Gets the current status of this membership.
  `org.silverpeas.core.admin.user.model.User`
  `getUser()`
  Gets the user related to this membership.
  `int`
  `hashCode()`

  ### Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity

  `createdBy, createdBy, createdBy, getCreationDate, getCreator, getCreatorId, getLastUpdateDate, getLastUpdater, getLastUpdaterId, getVersion, hasBeenModified, lastUpdatedBy, markAsModified, performBeforePersist, performBeforeRemove, performBeforeUpdate, setCreationDate, setCreator, setLastUpdateDate, setLastUpdater, setVersion, updatedBy, updatedBy`

  ### Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity

  `getId, getNativeId, isPersisted, setId`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.silverpeas.core.persistence.datasource.model.IdentifiableEntity

  `getId, isPersisted`

- ## Constructor Details

  - ### CommunityMembership

    protected CommunityMembership()
    Constructs an empty member of nothing. To be used by the persistence engine when fetching members objects from the database.

- ## Method Details

  - ### getCommunity

    @Nonnull public CommunityOfUsers getCommunity()
    Gets the community to which this membership belongs.
    Returns:
      the community of this user.

  - ### getUser

    @Nonnull public org.silverpeas.core.admin.user.model.User getUser()
    Gets the user related to this membership.
    Returns:
      the user related to this membership

  - ### getStatus

    @Nonnull public MembershipStatus getStatus()
    Gets the current status of this membership.
    Returns:
      the membership status.

  - ### getJoiningDate

    public OffsetDateTime getJoiningDate()
    Gets the date at which the user has effectively joined the community. The date at which his membership has been committed. If the membership of the user to the community hasn't yet been committed, then null is returned.
    Returns:
      the date and time in UTC or null if this membership hasn't been committed.

  - ### getMemberRole

    public org.silverpeas.core.admin.user.model.SilverpeasRole getMemberRole()
    Gets the role the user related by this membership plays in the community space. In the case the user plays several roles, only the highest one is returned.
    Returns:
      the (highest) role the user plays in the community space. If the user isn't more a member of the community, then null is returned.

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity<CommunityMembership,org.silverpeas.core.persistence.datasource.model.identifier.UuidIdentifier>`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity<CommunityMembership,org.silverpeas.core.persistence.datasource.model.identifier.UuidIdentifier>`