Class CommunityWebManager


  • @Service
    public class CommunityWebManager
    extends Object
    WEB manager which allows to centralize code to be used by REST Web Services and Web Component Controller.
    Author:
    silveryocha
    • Field Detail

      • NO_PAGINATION

        public static final org.silverpeas.core.admin.PaginationPage NO_PAGINATION
    • Constructor Detail

      • CommunityWebManager

        protected CommunityWebManager()
    • Method Detail

      • join

        public void join​(CommunityOfUsers community)
        Makes the current user joining the given community.
        Parameters:
        community - CommunityOfUsers instance representing the community.
      • validateRequestOf

        public void validateRequestOf​(org.silverpeas.core.admin.user.model.User requester,
                                      CommunityOfUsers community,
                                      boolean accept,
                                      String message)
        Validates the membership request of user given in parameters on specified community.
        Parameters:
        requester - the user behind the request to join the community.
        community - the community the user accesses.
        accept - true to accept the request, false to refuse.
        message - message linked to the acceptation or refuse.
      • endMembershipOf

        public void endMembershipOf​(CommunityOfUsers community,
                                    org.silverpeas.core.admin.user.model.User member)
        Makes the given user leaving the given community.
        Parameters:
        community - CommunityOfUsers instance representing the community.
        member - the member to manage.
      • leave

        public void leave​(CommunityOfUsers community,
                          int reason,
                          String message,
                          boolean contactInFuture)
        Makes the current user leaving the given community.
        Parameters:
        community - CommunityOfUsers instance representing the community.
        reason - the index of the reason of the leaving.
        message - a message to explain more precisely the member leaving.
        contactInFuture - boolean, true to indicate that the member accepts to be contacted in the future about its leaving.
      • setDisplayCharterOnSpaceHomepage

        public void setDisplayCharterOnSpaceHomepage​(CommunityOfUsers community,
                                                     boolean value)
        Saves into instance parameter of the given community the value of parameter 'displayCharterOnSpaceHomepage'.
        Parameters:
        community - CommunityOfUsers instance representing the community.
        value - true to display the charter, false otherwise.
      • getMembersToValidate

        public org.silverpeas.core.util.SilverpeasList<CommunityMembership> getMembersToValidate​(@Nonnull
                                                                                                 CommunityOfUsers community,
                                                                                                 @Nullable
                                                                                                 org.silverpeas.core.admin.PaginationPage page)
        Gets members pending validation of the given community.
        Parameters:
        community - CommunityOfUsers instance representing the community.
        page - the pending members to get are paginated. Indicates the page to return. If null, all the pending members are got.
        Returns:
        list of CommunityMembership instance, representing each one a pending member.
      • getMembers

        public org.silverpeas.core.util.SilverpeasList<CommunityMembership> getMembers​(@Nonnull
                                                                                       CommunityOfUsers community,
                                                                                       @Nullable
                                                                                       org.silverpeas.core.admin.PaginationPage page)
        Gets members of the given community.
        Parameters:
        community - CommunityOfUsers instance representing the community.
        page - the members to get are paginated. Indicates the page to return. If null, all the members are got.
        Returns:
        list of CommunityMembership instance, representing each one a committed member.
      • getHistory

        public org.silverpeas.core.util.SilverpeasList<CommunityMembership> getHistory​(@Nonnull
                                                                                       CommunityOfUsers community,
                                                                                       @Nullable
                                                                                       org.silverpeas.core.admin.PaginationPage page)
        Gets history of the given community.
        Parameters:
        community - CommunityOfUsers instance representing the community.
        page - the members to get are paginated. Indicates the page to return. If null, all the members are got.
        Returns:
        list of CommunityMembership instance, representing each one a membership whatever its status.
      • isMemberOf

        public boolean isMemberOf​(CommunityOfUsers community)
        Indicates if the current requester is a member.

        A member MUST be directly specified into ADMIN, PUBLISHER, WRITER or READER role of direct parent space.

        Parameters:
        community - CommunityOfUsers instance.
        Returns:
        true if member, false otherwise.
      • isMembershipPendingFor

        public boolean isMembershipPendingFor​(CommunityOfUsers community)
        Indicates if the current requester has membership pending validation.

        A member MUST be directly specified into ADMIN, PUBLISHER, WRITER or READER role of direct parent space.

        Parameters:
        community - CommunityOfUsers instance.
        Returns:
        true if member, false otherwise.
      • getUserRoleOn

        public Set<org.silverpeas.core.admin.user.model.SilverpeasRole> getUserRoleOn​(CommunityOfUsers community)
        Gets the roles the current requester has on the given community.
        Parameters:
        community - CommunityOfUsers instance.
        Returns:
        a set of SilverpeasRole.