Interface PdcClassificationService

  • All Known Implementing Classes:
    DefaultPdcClassificationService

    public interface PdcClassificationService
    The service aiming at classifying the contents in Silverpeas on the classification plan (named PdC). The classification of a content in Silverpeas consists to position it on the PdC; it is the process to attribute some semantic metadata to the content. The metadata then can be used to find any contents that satisfies a search of information by keywords. As some contents can not to be positioned on the PdC (it is not mandatory), they can be not detected in the search. The classification of a content on the PdC can be done in one of the two ways:
    • the contributor can position explicitly the content on the PdC,
    • a predefined classification is used either to classify automatically the content or as a template to classify the content.
    A predefined classification on the PdC can be created for a given node in a Silverpeas component instance or for the whole component instance. The predefined classification is a way to facilitate or to impose the classification on the PdC of the contents when they are published. A node in Silverpeas is a way to hierarchically categorize a content. A node can represent for example a topic. A node is part of a hierarchic tree and it can then contain both some contents and some nodes. So, a predefined classification on the PdC associated with a node is set for all the contents in its children nodes. Therefore, if a predefined classification is not found for a given node, then it is seeked back upto the root node (that is the component instance ifself).
    • Method Detail

      • findAPreDefinedClassification

        PdcClassification findAPreDefinedClassification​(String nodeId,
                                                        String instanceId)
        Finds a predefined classification on the PdC that was set for any new contents in the specified node of the specified component instance. If the specified node isn't defined, then the predefined classification associated with the whole component instance is seeked. If no predefined classification is found for the specified node, then it is seeked back upto the root node (that is the component instance ifself). In the case no predefined classification is set for the whole component instance, an empty classification is then returned. To get the predefined classification that is set exactly for the specified node (if any), then use the getPreDefinedClassification(java.lang.String, java.lang.String method.
        Parameters:
        nodeId - the unique identifier of the node.
        instanceId - the unique identifier of the Silverpeas component instance.
        Returns:
        a predefined classification on the PdC ready to be used to classify a content published in the specified node or an empty classification.
      • getPreDefinedClassification

        PdcClassification getPreDefinedClassification​(String nodeId,
                                                      String instanceId)
        Gets the predefined classification on the PdC that was set for any new contents in the specified node of the specified component instance. If the specified node isn't defined, then the predefined classification associated with the whole component instance is get. In the case no predefined classification is set for the specified node or for the component instance, then a none classification is then returned.
        Parameters:
        nodeId - the unique node identifier.
        instanceId - the unique component instance identifier.
        Returns:
        a predefined classification on the PdC associated with the specified node or with the specified component instance or an empty classification.
      • getPreDefinedClassification

        PdcClassification getPreDefinedClassification​(String instanceId)
        Gets the predefined classification on the PdC that was set for any new contents managed in the specified component instance. This method is for the component instances that don't support the categorization. In the case no predefined classification is set for the whole component instance, a none classification is then returned.
        Parameters:
        instanceId - the unique identifier of the Silverpeas component instance.
        Returns:
        a predefined classification on the PdC ready to be used to classify a content published within the component instance or an empty classification.
      • savePreDefinedClassification

        PdcClassification savePreDefinedClassification​(PdcClassification classification)
        Saves the specified predefined classification on the PdC. If a predefined classification already exists for the node (if any) and the component instance to which this classification is related, then it is replaced by the specified one. If the specified classification is empty (all positions were deleted), then it is deleted and the NONE_CLASSIFICATION is sent back. The node (if any) and the component instance for which this classification has to be saved are indicated by the specified classification itself. If no node is refered by it, then the predefined classification will serv for the whole component instance.
        Parameters:
        classification - either the saved predefined classification or NONE_CLASSIFICATION.
      • deletePreDefinedClassification

        void deletePreDefinedClassification​(String nodeId,
                                            String instanceId)
        Deletes the predefined classification set for the specified node in the specified component instance. If the specified node is null, then the predefined classification set for the whole component instance is deleted.
        Parameters:
        nodeId - the unique identifier of the node for which the predefined classification has to be deleted.
        instanceId - the unique identifier of the component instance to which the node belongs.
      • classifyContent

        void classifyContent​(Contribution content,
                             PdcClassification withClassification,
                             boolean alertSubscribers)
        Classifies the specified content on the PdC with the specified classification. If the content is already classified, then the given classification replaces the existing one. The content must exist in Silverpeas before being classified. If an error occurs while classifying the content, a runtime exception PdcRuntimeException is thrown.
        Parameters:
        content - the Silverpeas content to classify.
        withClassification - the classification with which the content is positioned on the PdC.
        alertSubscribers - indicates if subscribers must be notified or not
        Throws:
        PdcRuntimeException - on error.
      • axisValuesDeleted

        void axisValuesDeleted​(List<PdcAxisValue> deletedValues)
        Some values come to be removed from the PdC. Triggers the update of all concerned classifications taken in charge by this service (for instance, only the predefined classifications). For each value, according to its level in the hierarchical tree representing the PdC's axis, the correct update behaviour is selected for a given classification:
        • The value is a root one of the axis: the value is removed from any positions of the classification. If the position is empty (it has no values) it is then removed. If the classification is then empty, it is removed.
        • The value is a leaf in a branch: the value is replaced by its mother value in any positions of the classification.
        Parameters:
        deletedValues - the values that are removed from a PdC's axis.
      • axisDeleted

        void axisDeleted​(String axisId)
        An axis comes to be removed from the PdC. Triggers the update of all concerned classifications taken in charge by this service (for instance, only the predefined classifications). The classifications are updated as following:
        • For each position the values related to the axis are removed.
        • If a position is empty, it is removed.
        • If a classification is empty, it is removed.
        Parameters:
        axisId - the unique identifier of the axis.