Package org.silverpeas.core.webapi.pdc
Class PdcClassificationResource
- java.lang.Object
-
- org.silverpeas.core.web.rs.RESTWebService
-
- org.silverpeas.core.webapi.pdc.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.silverpeas.core.web.rs.RESTWebService
RESTWebService.WebProcess<R>, RESTWebService.WebTreatment<R>
-
-
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 PdcClassificationResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.void
deletePdcPosition(int positionId)
Deletes the specified existing position by its unique identifier.String
getComponentId()
Gets the identifier of the component instance to which the requested resource belongs to.protected String
getContentId()
PdcClassificationEntity
getPdCClassification()
Gets classification on the PdC of the resource identified by the requested URI.protected String
getResourceBasePath()
Gets the base path of the web resource relative to the root path of all the web resources in Silverpeas as given bySilverpeasWebResource.getBasePath()
.PdcClassificationEntity
updatePdcPosition(String positionId, PdcPositionEntity modifiedPosition)
Updates an existing position on the PdC into the classification of the resource identified by the requested URI.-
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
-
-
-
-
Method Detail
-
getResourceBasePath
protected String getResourceBasePath()
Description copied from class:RESTWebService
Gets the base path of the web resource relative to the root path of all the web resources in Silverpeas as given bySilverpeasWebResource.getBasePath()
.- Specified by:
getResourceBasePath
in classRESTWebService
- Returns:
- the relative path that identifies this REST web service among all other REST web services.
-
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.
-
-