Class SuggestionBoxResource

  • 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("suggestionbox/{componentInstanceId}/{suggestionBoxId}")
    @Authorized
    public class SuggestionBoxResource
    extends AbstractSuggestionBoxResource
    A REST Web resource giving suggestion data.
    Author:
    Yohann Chastagnier
    • Constructor Detail

      • SuggestionBoxResource

        public SuggestionBoxResource()
    • Method Detail

      • getSuggestion

        @GET
        @Path("suggestions/{suggestionId}")
        @Produces("application/json")
        public SuggestionEntity getSuggestion​(@PathParam("suggestionId")
                                              String suggestionId)
        Gets the JSON representation of an suggestion. If it doesn't exist, a 404 HTTP code is returned.
        Parameters:
        suggestionId - the identifier of the suggestion
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked suggestion.
        See Also:
        RESTWebService.WebProcess.execute()
      • deleteSuggestion

        @DELETE
        @Path("suggestions/{suggestionId}")
        public void deleteSuggestion​(@PathParam("suggestionId")
                                     String suggestionId)
        Deletes the suggestion identified by the specified identifier. If it doesn't exist, a 404 HTTP code is returned.
        Parameters:
        suggestionId - the identifier of the suggestion.
      • publishSuggestion

        @PUT
        @Path("suggestions/{suggestionId}/publish")
        @Produces("application/json")
        public SuggestionEntity publishSuggestion​(@PathParam("suggestionId")
                                                  String suggestionId)
        Publishes the suggestion identified by the specified identifier. If it doesn't exist, a 404 HTTP code is returned.
        Parameters:
        suggestionId - the identifier of the suggestion.
        Returns:
        the response to the HTTP PUT request with the JSON representation of the published suggestion.
      • getSuggestionsInDraft

        @GET
        @Path("suggestions/inDraft")
        @Produces("application/json")
        public Collection<SuggestionEntity> getSuggestionsInDraft()
        Gets the JSON representation of a list of suggestion that are in draft for the user behind the service call.
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked list of suggestions.
        See Also:
        SuggestionBoxWebManager.getSuggestionsInDraftFor(SuggestionBox, User), RESTWebService.WebProcess.execute()
      • getSuggestionsOutOfDraft

        @GET
        @Path("suggestions/outOfDraft")
        @Produces("application/json")
        public Collection<SuggestionEntity> getSuggestionsOutOfDraft()
        Gets the JSON representation of a list of suggestion that are out of draft for the user behind the service call.
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked list of suggestions.
        See Also:
        SuggestionBoxWebManager.getSuggestionsInDraftFor(SuggestionBox, User), RESTWebService.WebProcess.execute()
      • getSuggestionsInPendingValidation

        @GET
        @Path("suggestions/pendingValidation")
        @Produces("application/json")
        public Collection<SuggestionEntity> getSuggestionsInPendingValidation()
        Gets the JSON representation of a list of suggestion that are pending validation.
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked list of suggestions.
        See Also:
        SuggestionBoxWebManager.getSuggestionsInPendingValidation(SuggestionBox), RESTWebService.WebProcess.execute()
      • getPublishedSuggestions

        @GET
        @Path("suggestions/published")
        @Produces("application/json")
        public Collection<SuggestionEntity> getPublishedSuggestions​(@QueryParam("author")
                                                                    String authorId,
                                                                    @QueryParam("page")
                                                                    String page,
                                                                    @QueryParam("sortby")
                                                                    String property)
        Gets the JSON representation of a list of suggestions that are published, bu default sorted by date of validation (from the newer to the older).
        Parameters:
        authorId - if this parameter is set, then the suggestions to get will be those proposed by the author with the specified user unique identifier.
        page - if this parameter is set, then the pagination is activated and only the published suggestions matching the specified pagination criterion are sent back. The parameter is semicolon-separated criterion: the first part is the page number and the second part is the count of suggestions to sent back.
        property - the property by which the asked published suggestions should be sorted. If no such property exists for the suggestions, then no sorting is performed.
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked list of suggestions.
        See Also:
        SuggestionBoxWebManager.getPublishedSuggestions(SuggestionBox), RESTWebService.WebProcess.execute()
      • getLastComments

        @GET
        @Path("suggestions/lastComments")
        @Produces("application/json")
        public Collection<SuggestionCommentEntity> getLastComments​(@QueryParam("count")
                                                                   int count)
        Gets the JSON representation of a list of the last comments that were posted on the suggestions of the current suggestion box. The comments are sorted in descent order, that is to say from the newer to the older one.
        Parameters:
        count - the number of comments to return. If this parameter isn't set, then only the first 5 last comments are sent back.
        Returns:
        a collection of comments on the suggestions, ready to be serialized in JSON.