Package org.silverpeas.components.questionreply.web

## Class ReplyResource

- java.lang.Object
- - org.silverpeas.core.web.rs.RESTWebService
  - - org.silverpeas.components.questionreply.web.QuestionReplyBaseWebService
    - - org.silverpeas.components.questionreply.web.ReplyResource

- 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("questionreply/{componentId}/replies")
      @Authorized
      public class ReplyResource
      extends QuestionReplyBaseWebService

  A REST Web resource representing a given reply to a question. It is a web service that provides an access to a reply referenced by its URL.

- - ### 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
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected String` | `componentId` |

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected ReplyEntity[]` | `asWebEntities​(List<Reply> replies, org.silverpeas.core.admin.user.model.SilverpeasRole profile)` | Converts the specified list of replies into their corresponding web entities.
    `protected ReplyEntity` | `asWebEntity​(Reply reply, URI replyURI, org.silverpeas.core.admin.user.model.SilverpeasRole profile)` | Converts the reply into its corresponding web entity.
    `ReplyEntity[]` | `getAllRepliesForQuestion​(String onQuestionId)` | Gets the JSON representation of the specified existing question.
    `String` | `getComponentId()` |
    `ReplyEntity[]` | `getPublicRepliesForQuestion​(String onQuestionId)` |
    `protected URI` | `identifiedBy​(URI uri)` |

    - ### Methods inherited from class org.silverpeas.components.questionreply.web.QuestionReplyBaseWebService

      `getResourceBasePath`

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

      `createWebResourceUri, fromPage, getBundle, getBundleLocation, getHighestUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, 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`

- - ### Field Detail

    - #### componentId

          @PathParam("componentId")
          protected String componentId

  - ### Constructor Detail

    - #### ReplyResource

          public ReplyResource()

  - ### Method Detail

    - #### getComponentId

          public String getComponentId()

    - #### getAllRepliesForQuestion

          @GET
          @Path("question/{questionId}")
          @Produces("application/json")
          public ReplyEntity[] getAllRepliesForQuestion​(@PathParam("questionId")
                                                        String onQuestionId)

      Gets the JSON representation of the specified existing question. If the reply doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If the user isn't authorized to access the question, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `onQuestionId` - the unique identifier of the question.
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked question replies.

    - #### getPublicRepliesForQuestion

          @GET
          @Produces("application/json")
          @Path("public/question/{questionId}")
          public ReplyEntity[] getPublicRepliesForQuestion​(@PathParam("questionId")
                                                           String onQuestionId)

    - #### identifiedBy

          protected URI identifiedBy​(URI uri)

    - #### asWebEntities

          protected ReplyEntity[] asWebEntities​(List<Reply> replies,
                                                org.silverpeas.core.admin.user.model.SilverpeasRole profile)

      Converts the specified list of replies into their corresponding web entities.
      Parameters:
        `replies` - the replies to convert.
        `profile` - the profile of the user.
      Returns:
        an array with the corresponding reply entities.

    - #### asWebEntity

          protected ReplyEntity asWebEntity​(Reply reply,
                                            URI replyURI,
                                            org.silverpeas.core.admin.user.model.SilverpeasRole profile)

      Converts the reply into its corresponding web entity.
      Parameters:
        `reply` - the reply to convert.
        `replyURI` - the URI of the reply.
        `profile` - the profile of the user.
      Returns:
        the corresponding reply entity.