Class QuestionResource

java.lang.Object
org.silverpeas.core.web.rs.RESTWebService
org.silverpeas.components.questionreply.web.QuestionReplyBaseWebService
org.silverpeas.components.questionreply.web.QuestionResource
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}/questions") @Authorized public class QuestionResource extends QuestionReplyBaseWebService
A REST Web resource representing a given question. It is a web service that provides access to a question 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>, org.silverpeas.core.web.rs.RESTWebService.WebTreatment<R>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
     

    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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<QuestionEntity>
    Converts the specified list of questions into their corresponding web entities.
    protected QuestionEntity
    asWebEntity(Question question, URI questionURI)
    Converts the question into its corresponding web entity.
    Gets all the questions asked in the application.
    Gets all the questions classified into the specified category.
     
    getQuestion(String onQuestionId)
    Gets the JSON representation of the specified existing question.
    Gets the questions whose the unique identifier is among the specified ones.
    protected 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, 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
  • Field Details

    • componentId

      @PathParam("componentId") protected String componentId
  • Constructor Details

    • QuestionResource

      public QuestionResource()
  • Method Details

    • getComponentId

      public String getComponentId()
    • getQuestion

      @NotFound @GET @Path("{questionId}") @Produces("application/json") public QuestionEntity getQuestion(@PathParam("questionId") String onQuestionId)
      Gets the JSON representation of the specified existing question. If the question 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.
    • getQuestions

      @GET @Produces("application/json") public List<QuestionEntity> getQuestions(@QueryParam("ids") Set<String> ids)
      Gets the questions whose the unique identifier is among the specified ones.
      Parameters:
      ids - the unique identifiers of the questions to get.
      Returns:
      a list with the asked questions the user can see.
    • getAllQuestions

      @GET @Path("all") @Produces("application/json") public List<QuestionEntity> getAllQuestions()
      Gets all the questions asked in the application.
      Returns:
      a list with all the questions the user can see.
    • getAllQuestionsByCategory

      @GET @Path("category/{categoryId}") @Produces("application/json") public List<QuestionEntity> getAllQuestionsByCategory(@PathParam("categoryId") String categoryId)
      Gets all the questions classified into the specified category.
      Parameters:
      categoryId - the unique identifier of the category.
      Returns:
      a list with all the questions of the category the user can see.
    • identifiedBy

      protected URI identifiedBy(URI uri)
    • asWebEntities

      protected List<QuestionEntity> asWebEntities(List<Question> questions)
      Converts the specified list of questions into their corresponding web entities.
      Parameters:
      questions - the questions to convert.
      Returns:
      a list with the corresponding question entities.
    • asWebEntity

      protected QuestionEntity asWebEntity(Question question, URI questionURI)
      Converts the question into its corresponding web entity.
      Parameters:
      question - the question to convert.
      questionURI - the URI of the question.
      Returns:
      the corresponding question entity.