Class DefaultPdcClassificationService

    • Constructor Detail

      • DefaultPdcClassificationService

        public DefaultPdcClassificationService()
    • Method Detail

      • findAPreDefinedClassification

        public 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 is undefined, 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 for each node in the upper level upto the root node (that is the component instance itself). In the case no predefined classification is set for the whole component instance (the root node), 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.

        Specified by:
        findAPreDefinedClassification in interface PdcClassificationService
        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

        public 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 is undefined, 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 returned.

        Specified by:
        getPreDefinedClassification in interface PdcClassificationService
        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

        public 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.
        Specified by:
        getPreDefinedClassification in interface PdcClassificationService
        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

        public 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.
        Specified by:
        savePreDefinedClassification in interface PdcClassificationService
        Parameters:
        classification - either the saved predefined classification or NONE_CLASSIFICATION.
        Returns:
        the classification on the PdC that was saved.
      • deletePreDefinedClassification

        public 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.
        Specified by:
        deletePreDefinedClassification in interface PdcClassificationService
        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

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

        public 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.
        Specified by:
        axisValuesDeleted in interface PdcClassificationService
        Parameters:
        deletedValues - the values that are removed from a PdC's axis.
      • axisDeleted

        public 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.
        Specified by:
        axisDeleted in interface PdcClassificationService
        Parameters:
        axisId - the unique identifier of the axis.
      • getNodeService

        protected NodeService getNodeService()
      • getPdcManager

        protected PdcManager getPdcManager()
      • delete

        public void delete​(String componentInstanceId)
        Deletes the resources belonging to the specified component instance. This method is invoked by Silverpeas when a component instance is being deleted.
        Specified by:
        delete in interface ComponentInstanceDeletion
        Parameters:
        componentInstanceId - the unique identifier of a component instance.