Package org.silverpeas.components.resourcesmanager.web

## Class ResourceManagerResource

- java.lang.Object
- - org.silverpeas.core.web.rs.RESTWebService
  - - org.silverpeas.components.resourcesmanager.web.AbstractResourceManagerResource
    - - org.silverpeas.components.resourcesmanager.web.ResourceManagerResource

- 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("resourceManager/{componentInstanceId}")
      @Authorized
      public class ResourceManagerResource
      extends AbstractResourceManagerResource

  A REST Web resource giving reservation and resource data.
  Author:
    Yohann Chastagnier

- - ### Nested Class Summary

    - ### 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 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
    --- | ---
    `ResourceManagerResource()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ResourceCategoryEntity` | `getCategory​(long categoryId)` | Gets the JSON representation of a category.
    `ReservationEntity` | `getReservation​(long reservationId)` | Gets the JSON representation of a reservation event.
    `Collection<ReservationEntity>` | `getReservations​(org.silverpeas.core.date.period.PeriodType periodType, int year, int month, int day)` | Gets the JSON representation of a list of reservation event.
    `Collection<ReservationEntity>` | `getReservations​(org.silverpeas.core.date.period.PeriodType periodType, int year, int month, int day, String userId)` | Gets the JSON representation of a list of reservation event.
    `Collection<ReservationEntity>` | `getReservationsByCategory​(org.silverpeas.core.date.period.PeriodType periodType, int year, int month, int day, long categoryId)` | Gets the JSON representation of a list of reservation event.
    `Collection<ReservationEntity>` | `getReservationsByCategory​(org.silverpeas.core.date.period.PeriodType periodType, int year, int month, int day, String userId, long categoryId)` | Gets the JSON representation of a list of reservation event.
    `Collection<ReservationEntity>` | `getReservationsByResource​(org.silverpeas.core.date.period.PeriodType periodType, int year, int month, int day, long resourceId)` | Gets the JSON representation of a list of reservation event.
    `Collection<ReservationEntity>` | `getReservationsByResource​(org.silverpeas.core.date.period.PeriodType periodType, int year, int month, int day, String userId, long resourceId)` | Gets the JSON representation of a list of reservation event.
    `Collection<ReservationEntity>` | `getReservationsForValidation​(org.silverpeas.core.date.period.PeriodType periodType, int year, int month, int day)` | Gets the JSON representation of a list of reservation event that has to be validated.
    `ResourceEntity` | `getResource​(long resourceId)` | Gets the JSON representation of a resource.
    `Collection<ReservedResourceEntity>` | `getResourcesOfReservation​(long reservationId)` | Gets the JSON representation of a list of resources of a reservation.

    - ### Methods inherited from class org.silverpeas.components.resourcesmanager.web.AbstractResourceManagerResource

      `asWebEntities, asWebEntities, asWebEntity, asWebEntity, asWebEntity, asWebEntity, buildReservationURI, buildResourceCategoryURI, buildResourceReservationURI, buildResourceURI, getComponentId, getResourceBasePath, getResourceManager`

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

      `createWebResourceUri, fromPage, getBundle, getBundleLocation, getHighestUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getLanguage, getOrganisationController, getSilverpeasContext, getUri, getUser, getUserPreferences, getUserRoles, identifiedBy, identifiedBy, initContext, initWebResourceUri, 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`

- - ### Constructor Detail

    - #### ResourceManagerResource

          public ResourceManagerResource()

  - ### Method Detail

    - #### getCategory

          @GET
          @Path("reservations/resources/categories/{categoryId}")
          @Produces("application/json")
          public ResourceCategoryEntity getCategory​(@PathParam("categoryId")
                                                    long categoryId)

      Gets the JSON representation of a category. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `categoryId` - the identifier od the aimed category.
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked category.

    - #### getResource

          @GET
          @Path("reservations/resources/{resourceId}")
          @Produces("application/json")
          public ResourceEntity getResource​(@PathParam("resourceId")
                                            long resourceId)

      Gets the JSON representation of a resource. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `resourceId` - the identifier od the aimed resource.
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked resource.

    - #### getReservation

          @GET
          @Path("reservations/{reservationId}")
          @Produces("application/json")
          public ReservationEntity getReservation​(@PathParam("reservationId")
                                                  long reservationId)

      Gets the JSON representation of a reservation event. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `reservationId` - the identifier od the aimed reservation.
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked reservation.

    - #### getResourcesOfReservation

          @GET
          @Path("reservations/{reservationId}/resources")
          @Produces("application/json")
          public Collection<ReservedResourceEntity> getResourcesOfReservation​(@PathParam("reservationId")
                                                                              long reservationId)

      Gets the JSON representation of a list of resources of a reservation. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `reservationId` - the identifier od the aimed reservation.
      Returns:
        the response to the HTTP GET request with the JSON representation of list of resources of a reservation.

    - #### getReservations

          @GET
          @Path("reservations/{periodType}/{year}/{month}/{day}")
          @Produces("application/json")
          public Collection<ReservationEntity> getReservations​(@PathParam("periodType")
                                                               org.silverpeas.core.date.period.PeriodType periodType,
                                                               @PathParam("year")
                                                               int year,
                                                               @PathParam("month")
                                                               int month,
                                                               @PathParam("day")
                                                               int day)

      Gets the JSON representation of a list of reservation event. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `periodType` - the aimed period
        `year` - the aimed year
        `month` - the aimed month
        `day` - the aimed day
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked list of reservation.

    - #### getReservationsByCategory

          @GET
          @Path("reservations/{periodType}/{year}/{month}/{day}/resources/categories/{categoryId}")
          @Produces("application/json")
          public Collection<ReservationEntity> getReservationsByCategory​(@PathParam("periodType")
                                                                         org.silverpeas.core.date.period.PeriodType periodType,
                                                                         @PathParam("year")
                                                                         int year,
                                                                         @PathParam("month")
                                                                         int month,
                                                                         @PathParam("day")
                                                                         int day,
                                                                         @PathParam("categoryId")
                                                                         long categoryId)

      Gets the JSON representation of a list of reservation event. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `periodType` - the aimed period
        `year` - the aimed year
        `month` - the aimed month
        `day` - the aimed day
        `categoryId` - the aimed category of resources
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked list of reservation.

    - #### getReservationsByResource

          @GET
          @Path("reservations/{periodType}/{year}/{month}/{day}/resources/{resourceId}")
          @Produces("application/json")
          public Collection<ReservationEntity> getReservationsByResource​(@PathParam("periodType")
                                                                         org.silverpeas.core.date.period.PeriodType periodType,
                                                                         @PathParam("year")
                                                                         int year,
                                                                         @PathParam("month")
                                                                         int month,
                                                                         @PathParam("day")
                                                                         int day,
                                                                         @PathParam("resourceId")
                                                                         long resourceId)

      Gets the JSON representation of a list of reservation event. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `periodType` - the aimed period
        `year` - the aimed year
        `month` - the aimed month
        `day` - the aimed day
        `resourceId` - the aimed resource
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked list of reservation.

    - #### getReservations

          @GET
          @Path("reservations/{periodType}/{year}/{month}/{day}/user/{userId}")
          @Produces("application/json")
          public Collection<ReservationEntity> getReservations​(@PathParam("periodType")
                                                               org.silverpeas.core.date.period.PeriodType periodType,
                                                               @PathParam("year")
                                                               int year,
                                                               @PathParam("month")
                                                               int month,
                                                               @PathParam("day")
                                                               int day,
                                                               @PathParam("userId")
                                                               String userId)

      Gets the JSON representation of a list of reservation event. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `periodType` - the aimed period
        `year` - the aimed year
        `month` - the aimed month
        `day` - the aimed day
        `userId` - the aimed user
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked list of reservation.

    - #### getReservationsByCategory

          @GET
          @Path("reservations/{periodType}/{year}/{month}/{day}/user/{userId}/resources/categories/{categoryId}")
          @Produces("application/json")
          public Collection<ReservationEntity> getReservationsByCategory​(@PathParam("periodType")
                                                                         org.silverpeas.core.date.period.PeriodType periodType,
                                                                         @PathParam("year")
                                                                         int year,
                                                                         @PathParam("month")
                                                                         int month,
                                                                         @PathParam("day")
                                                                         int day,
                                                                         @PathParam("userId")
                                                                         String userId,
                                                                         @PathParam("categoryId")
                                                                         long categoryId)

      Gets the JSON representation of a list of reservation event. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `periodType` - the aimed period
        `year` - the aimed year
        `month` - the aimed month
        `day` - the aimed day
        `userId` - the aimed user
        `categoryId` - the aimed category of resources
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked list of reservation.

    - #### getReservationsByResource

          @GET
          @Path("reservations/{periodType}/{year}/{month}/{day}/user/{userId}/resources/{resourceId}")
          @Produces("application/json")
          public Collection<ReservationEntity> getReservationsByResource​(@PathParam("periodType")
                                                                         org.silverpeas.core.date.period.PeriodType periodType,
                                                                         @PathParam("year")
                                                                         int year,
                                                                         @PathParam("month")
                                                                         int month,
                                                                         @PathParam("day")
                                                                         int day,
                                                                         @PathParam("userId")
                                                                         String userId,
                                                                         @PathParam("resourceId")
                                                                         long resourceId)

      Gets the JSON representation of a list of reservation event. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `periodType` - the aimed period
        `year` - the aimed year
        `month` - the aimed month
        `day` - the aimed day
        `userId` - the aimed user
        `resourceId` - the aimed resource
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked list of reservation.

    - #### getReservationsForValidation

          @GET
          @Path("reservations/{periodType}/{year}/{month}/{day}/validation")
          @Produces("application/json")
          public Collection<ReservationEntity> getReservationsForValidation​(@PathParam("periodType")
                                                                            org.silverpeas.core.date.period.PeriodType periodType,
                                                                            @PathParam("year")
                                                                            int year,
                                                                            @PathParam("month")
                                                                            int month,
                                                                            @PathParam("day")
                                                                            int day)

      Gets the JSON representation of a list of reservation event that has to be validated. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `periodType` - the aimed period
        `year` - the aimed year
        `month` - the aimed month
        `day` - the aimed day
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked list of reservation.