com.silverpeas.pdc.web
Class PdcClassificationResource

java.lang.Object
  extended by com.silverpeas.web.RESTWebService
      extended by com.silverpeas.pdc.web.PdcClassificationResource

@Service
@RequestScoped
@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 com.silverpeas.web.RESTWebService
RESTWebService.WebProcess<RETURN_VALUE>, RESTWebService.WebTreatment<RETURN_VALUE>
 
Field Summary
 
Fields inherited from class com.silverpeas.web.RESTWebService
RESPONSE_HEADER_ARRAYSIZE, REST_WEB_SERVICES_URI_BASE
 
Constructor Summary
PdcClassificationResource()
           
 
Method Summary
 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.
 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 com.silverpeas.web.RESTWebService
getBundle, getBundleLocation, getGreaterUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getUriInfo, getUserDetail, getUserPreferences, getUserRoles, process, validateUserAuthentication, validateUserAuthorization
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PdcClassificationResource

public PdcClassificationResource()
Method Detail

getComponentId

public String getComponentId()
Description copied from class: RESTWebService
Gets the identifier of the component instance to which the requested resource belongs to.

Specified by:
getComponentId in class RESTWebService
Returns:
the identifier of the Silverpeas component instance.

getContentId

protected String getContentId()

getPdCClassification

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

public void deletePdcPosition(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

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

public PdcClassificationEntity updatePdcPosition(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.


Copyright © 2016 Silverpeas. All Rights Reserved.