com.silverpeas.pdc.web
Class PdcPredefinedClassificationResource

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

@Service
@RequestScoped
@Authorized
public class PdcPredefinedClassificationResource
extends RESTWebService

A REST Web resource that represents the predefined classifications on the PdC to classify the contents that are published into a given node of a given component instance or in a whole component instance. A predefined classification on the PdC can be created and attached either to a component instance or to a a node of a component instance. It then can be used as a default classification to automatically classify the contents or as a classification template from which the contents can be classified on the PdC. A predefined classification associated with a given node or with a given component instance follows the hierarchical structure of the node tree; it is also applicable to all contents in the children of the given node (or of all nodes in the component instance) in the case they aren't associated explicitly with a predefined classification. So, when classifying on the PdC of a content published in a given node, a predefined classification is then looked for backward in the hierarchical tree of nodes, from the given node up to the component instance itself; once found, this predefined classification will be used to classify the content. Similarly, when editing a predefined classification associated with a node, it is sought backward in the hierarchical tree of nodes but the predefined classification found will be modified only for the given node. A node in a component instance is a generic way in Silverpeas to categorize hierarchically the contents; they are divided into a tree of nodes. A node can represent a topic, a tag or a folder for example. A classification on the PdC is defined by a set of different positions on the axis of the PdC. A position is a set of one or more values of axis. A classification can be modifiable or not. By default, a predefined classification is set as unmodifiable whereas the classification of a content is modifiable by default. 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
PdcPredefinedClassificationResource()
           
 
Method Summary
 javax.ws.rs.core.Response createPredefinedPdcClassification(String nodeId, PdcClassificationEntity classification)
          Creates a new predefined classification for the specified node.
 String getComponentId()
          Gets the identifier of the component instance to which the requested resource belongs to.
 PdcClassificationEntity getPredefinedPdCClassificationForContentsInNode(String nodeId)
          Gets the predefined classification on the PdC that is set for the contents in the node identified by the query part of the request URI.
 PdcClassificationEntity updatePredefinedPdcClassification(String nodeId, PdcClassificationEntity classification)
          Updates the predefined classification for the specified node.
 
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

PdcPredefinedClassificationResource

public PdcPredefinedClassificationResource()
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.

getPredefinedPdCClassificationForContentsInNode

public PdcClassificationEntity getPredefinedPdCClassificationForContentsInNode(String nodeId)
Gets the predefined classification on the PdC that is set for the contents in the node identified by the query part of the request URI. If no node identifier is provided in the URI, the predefined classification set for the whole component instance is sought. A node in a component instance is a generic way in Silverpeas to categorize hierarchically the contents of the component instance. If no predefined classification on the PdC is defined for the requested node, a predefined one is then looked backward among the parent nodes up to the component instance itself. 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 requested predefined PdC classification. If no predefined classification is defined along the path of the nodes up to the component instance, then an empty classification is sent back.

createPredefinedPdcClassification

public javax.ws.rs.core.Response createPredefinedPdcClassification(String nodeId,
                                                                   PdcClassificationEntity classification)
Creates a new predefined classification for the specified node. If the JSON representation of the classification 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 classification, a 403 is returned. If the resource referred by the URI already exists, a 409 HTTP core is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.

Parameters:
nodeId - the unique identifier of the node with which the classification to create is associated. Can be null, in that case, the classification is associated with the component instance.
classification - the predefined classification to create. The entity is passed within the request and it is serialized in JSON.
Returns:
the response with the status of the classification creation and, in the case of a successful operation, the new created PdC classification.

updatePredefinedPdcClassification

public PdcClassificationEntity updatePredefinedPdcClassification(String nodeId,
                                                                 PdcClassificationEntity classification)
Updates the predefined classification for the specified node. If no predefined classification is associated with the specified node, it inherits of the predefined classification of its closest parent node. So, as the updated predefined position on the PdC concerns only the specified node (and not the parent node), it is actually updated in the new predefined classification that is created for the specified node from of the one of the parent node. 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:
nodeId - the unique identifier of a node.
classification - 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.