Package org.silverpeas.components.community.web

## Class CommunityMembershipResource

- java.lang.Object
- - org.silverpeas.core.web.rs.RESTWebService
  - - org.silverpeas.components.community.web.CommunityWebResource
    - - org.silverpeas.components.community.web.CommunityMembershipResource

- All Implemented Interfaces:
    `org.silverpeas.core.web.rs.ProtectedWebResource`, `org.silverpeas.core.web.rs.WebAuthenticationValidation`, `org.silverpeas.core.web.rs.WebAuthorizationValidation`, `org.silverpeas.core.web.SilverpeasWebResource`

      @WebService
      @Path("community/{componentInstanceId}/memberships")
      @Authorized
      public class CommunityMembershipResource
      extends CommunityWebResource

  The memberships to a community of users exposed as a resource through the Web. If the community of users for which memberships are asked doesn't exist, then `NotFoundException` is thrown.
  Author:
    mmoquillon

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.silverpeas.components.community.web.CommunityWebResource

      `CommunityWebResource.WebFunction<R>`

    - ### Nested classes/interfaces inherited from class org.silverpeas.core.web.rs.RESTWebService

      `org.silverpeas.core.web.rs.RESTWebService.WebProcess<R extends Object>, org.silverpeas.core.web.rs.RESTWebService.WebTreatment<R extends Object>`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected static String` | `RESOURCE_NAME` |

    - ### Fields inherited from class org.silverpeas.components.community.web.CommunityWebResource

      `NO_PAGINATION`

    - ### Fields inherited from class org.silverpeas.core.web.rs.RESTWebService

      `RESPONSE_HEADER_ARRAYSIZE`

    - ### Fields inherited from interface org.silverpeas.core.web.SilverpeasWebResource

      `BASE_PATH`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CommunityMembershipResource()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `CommunityMembershipEntities` | `getActualMemberships​(String page)` | Gets all the actual memberships to the community of users.
    `CommunityMembershipEntities` | `getAllMemberships​(String page)` | Gets all the memberships to the community of users, whatever the status of them.
    `String` | `getComponentId()` |
    `CommunityMembershipEntity` | `getMembership​(String memberId)` | Gets a given existing membership to the community of users or throw `NotFoundException` if no such membership exists.
    `CommunityMembershipEntities` | `getPendingMemberships​(String page)` | Gets all the memberships to the community of users pending for validation.
    `protected String` | `getResourceBasePath()` | Gets the relative base path at which are all exposed the resources in the community application.
    `CommunityMembershipEntity` | `getUserMembership​(String userId)` | Gets the membership of the specified user or throw `NotFoundException` if no such membership to the community of users exists.
    `protected org.silverpeas.core.web.WebResourceUri` | `initWebResourceUri()` |

    - ### Methods inherited from class org.silverpeas.components.community.web.CommunityWebResource

      `getCommunityUriBuilder, getUserRoles, getWebManager, initURIBuilder, process`

    - ### Methods inherited from class org.silverpeas.core.web.rs.RESTWebService

      `createWebResourceUri, fromPage, getBundle, getBundleLocation, getHighestUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getSilverpeasContext, getUri, getUser, getUserPreferences, identifiedBy, identifiedBy, initContext, isUserDefined, process`

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

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

    - ### Methods inherited from interface org.silverpeas.core.web.rs.ProtectedWebResource

      `validateUserAuthorization`

    - ### Methods inherited from interface org.silverpeas.core.web.rs.WebAuthenticationValidation

      `validateUserAuthentication`

- - ### Field Detail

    - #### RESOURCE_NAME

          protected static final String RESOURCE_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CommunityMembershipResource

          public CommunityMembershipResource()

  - ### Method Detail

    - #### getComponentId

          public String getComponentId()

    - #### getResourceBasePath

          protected String getResourceBasePath()

      Description copied from class: `CommunityWebResource`
      Gets the relative base path at which are all exposed the resources in the community application.
      Overrides:
        `getResourceBasePath` in class `CommunityWebResource`
      Returns:
        the base path of the resource relative to the URI at which are all exposed the REST-based web services in Silverpeas.

    - #### initWebResourceUri

          protected org.silverpeas.core.web.WebResourceUri initWebResourceUri()

      Overrides:
        `initWebResourceUri` in class `org.silverpeas.core.web.rs.RESTWebService`

    - #### getAllMemberships

          @GET
          @Path("all")
          @Produces("application/json")
          public CommunityMembershipEntities getAllMemberships​(@QueryParam("page")
                                                               String page)

      Gets all the memberships to the community of users, whatever the status of them.
      Parameters:
        `page` - a pagination page to restrict the memberships to get.
      Returns:
        a web entity representing a paginated collection of memberships.

    - #### getPendingMemberships

          @GET
          @Path("pending")
          @Produces("application/json")
          public CommunityMembershipEntities getPendingMemberships​(@QueryParam("page")
                                                                   String page)

      Gets all the memberships to the community of users pending for validation.
      Parameters:
        `page` - a pagination page to restrict the memberships to get.
      Returns:
        a web entity representing a paginated collection of memberships.

    - #### getActualMemberships

          @GET
          @Path("members")
          @Produces("application/json")
          public CommunityMembershipEntities getActualMemberships​(@QueryParam("page")
                                                                  String page)

      Gets all the actual memberships to the community of users. These memberships are those they are committed; in other term, the memberships of the members of the community of users.
      Parameters:
        `page` - a pagination page to restrict the memberships to get.
      Returns:
        a web entity representing a paginated collection of memberships.

    - #### getUserMembership

          @GET
          @Path("users/{userId}")
          @Produces("application/json")
          public CommunityMembershipEntity getUserMembership​(@PathParam("userId")
                                                             String userId)

      Gets the membership of the specified user or throw `NotFoundException` if no such membership to the community of users exists.
      Parameters:
        `userId` - the unique identifier of the user.
      Returns:
        the web entity representing a membership to the community of users.

    - #### getMembership

          @GET
          @Path("all/{membershipId}")
          @Produces("application/json")
          public CommunityMembershipEntity getMembership​(@PathParam("membershipId")
                                                         String memberId)

      Gets a given existing membership to the community of users or throw `NotFoundException` if no such membership exists.
      Parameters:
        `memberId` - the unique identifier of a membership.
      Returns:
        the web entity representing a membership to the community of users.