Class PdcClassificationResource

  • All Implemented Interfaces:
    ProtectedWebResource, WebAuthenticationValidation, WebAuthorizationValidation, SilverpeasWebResource

    @WebService
    @Path("pdc/classification/{componentId:[a-zA-Z]+[0-9]+}/{contentId}")
    @Authorized
    public class PdcClassificationResource
    extends RESTWebService
    A REST Web resource that represents the classification of a Silverpeas's resource on the classification plan (named PdC). A classification on the PdC is defined by the different positions of the classified resource on the axis of the PdC. A position is then a set of one or more values in the different axis of the PdC. A classification on the PdC can be or not modifiable; by default a predefined classification used to classify new published contents isn't modifiable whereas the classification of a content can be modified. The positions of a given classification can be accessed with this Web resource by the URI of the position; classifications and positions are exposed in the Web by Silverpeas and are thus uniquely identified by an URI in the Web.
    • Constructor Detail

      • PdcClassificationResource

        public PdcClassificationResource()
    • Method Detail

      • getComponentId

        public String getComponentId()
        Description copied from interface: SilverpeasWebResource
        Gets the identifier of the component instance to which the requested resource belongs to.
        Returns:
        the identifier of the Silverpeas component instance.
      • getContentId

        protected String getContentId()
      • getPdCClassification

        @GET
        @Produces("application/json")
        public PdcClassificationEntity getPdCClassification()
        Gets classification on the PdC of the resource identified by the requested URI. The PdC classification is sent back in JSON. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to access the requested resource, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Returns:
        a web entity representing the PdC classification of the resource. The entity is serialized in JSON.
      • deletePdcPosition

        @DELETE
        @Path("{positionId}")
        public void deletePdcPosition​(@PathParam("positionId")
                                      int positionId)
        Deletes the specified existing position by its unique identifier. If the PdC position doesn't exist, nothing is done, so that the HTTP DELETE request remains idempotent as defined in the HTTP specification. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to access the resource PdC classification, a 403 is returned. If the position is the single one for the content on the PdC and the PdC contains at least one mandatory axis, a 409 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Parameters:
        positionId - the unique identifier of the position to delete in the classification of the requested resource.
      • addPdcPosition

        @POST
        @Produces("application/json")
        @Consumes("application/json")
        public javax.ws.rs.core.Response addPdcPosition​(PdcPositionEntity newPosition)
        Adds a new position on the PdC into the classification of the resource identified by the requested URI. If the JSON representation of the position isn't correct (no values), then a 400 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to access the comment, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Parameters:
        newPosition - a web entity representing the PdC position to add. The entity is passed within the request and it is serialized in JSON.
        Returns:
        the response with the status of the position adding and, in the case of a successful operation, the new PdC classification of the resource resulting of the position adding.
      • updatePdcPosition

        @PUT
        @Produces("application/json")
        @Consumes("application/json")
        @Path("{positionId}")
        public PdcClassificationEntity updatePdcPosition​(@PathParam("positionId")
                                                         String positionId,
                                                         PdcPositionEntity modifiedPosition)
        Updates an existing position on the PdC into the classification of the resource identified by the requested URI. If the JSON representation of the position isn't correct (no values), then a 400 HTTP code is returned. If the user isn't authenticated, a 401 HTTP code is returned. If the user isn't authorized to access the comment, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Parameters:
        modifiedPosition - a web entity representing the new state of the PdC position to update. The entity is passed within the request and it is serialized in JSON.
        Returns:
        the response with the status of the position update and, in the case of a successful operation, the new PdC classification of the resource resulting of the position update.