Class PdcClassification

  • All Implemented Interfaces:
    Serializable, IdentifiableEntity

    @Entity
    public class PdcClassification
    extends BasicJpaEntity<PdcClassification,​UniqueLongIdentifier>
    A classification of a content in Silverpeas on the classification plan (named PdC). A classification of a content is made up of one or more positions on the axis of the PdC. Each position consists of one or several values on some PdC's axis. A classification cannot have two or more identical positions; each of them must be unique. It can also represent, for a Silverpeas component instance or for a node in a component instance, a predefined classification with which any published contents can be classified on the PdC. In this case, the contentId attribute is null. A classification can be or not modifiable; by default, a predefined classification, that is used to classify new contents, is not modifiable whereas a classification of a content can be modified.
    See Also:
    Serialized Form
    • Field Detail

      • NONE_CLASSIFICATION

        public static final PdcClassification NONE_CLASSIFICATION
        Represents an empty classification (id est no classification on the PdC).
    • Constructor Detail

      • PdcClassification

        protected PdcClassification()
        Creates an empty classification on the PdC, ready to be completed for a given content published in a given component instance. By default, a classification of a content is modifiable.
    • Method Detail

      • aPredefinedPdcClassificationForComponentInstance

        public static PdcClassification aPredefinedPdcClassificationForComponentInstance​(String instanceId)
        Creates an empty predefined classification for the contents that will published in the specified component instance. By default, a predefined classification isn't modifiable and serves to classify automatically new contents published in the specied component instance.
        Parameters:
        instanceId - the unique identifier of the component instance to which the predefined classification will be attached.
        Returns:
        an empty predefined classification.
      • aPdcClassificationOfContent

        public static PdcClassification aPdcClassificationOfContent​(String contentId,
                                                                    String inComponentInstanceId)
        Creates an empty classification on the PdC of the specified content published in the specified component instance. By default, the classification of a content can be updated.
        Parameters:
        contentId - the unique identifier of the content to classify.
        inComponentInstanceId - the unique identifier of the component instance in which the content is published.
        Returns:
        an empty classification on the PdC.
      • aPdcClassificationOfContent

        public static PdcClassification aPdcClassificationOfContent​(Contribution contribution)
        Creates an empty classification on the PdC of the specified content represented by the given Contribution. By default, the classification of a content can be updated.
        Parameters:
        contribution - the contribution aimed for classification.
        Returns:
        an empty classification on the PdC.
      • getPositions

        public Set<PdcPosition> getPositions()
        Gets the positions on the PdC's axis with which the content is classified. Positions on the PdC can be added or removed with the returned set.
        Returns:
        a set of positions of this classification.
      • isEmpty

        public boolean isEmpty()
        Is this classification empty?
        Returns:
        true if this classification is an empty one, false otherwise.
      • isModifiable

        public boolean isModifiable()
        Is the PdC classifications generated from this template can be changed?
        Returns:
        false if the content have to be automatically classified, true if the classifications from this template should serv as a proposition of classification.
      • modifiable

        public PdcClassification modifiable()
        Sets this PdC classification as modifiable.
        Returns:
        itself.
      • unmodifiable

        public PdcClassification unmodifiable()
        Sets this PdC classification as unmodifiable.
        Returns:
        itself.
      • getComponentInstanceId

        public String getComponentInstanceId()
      • getContentId

        public String getContentId()
      • getNodeId

        public String getNodeId()
      • isPredefined

        public boolean isPredefined()
        Is this classification on the PdC is a predefined one to classify any new contents in the given node or for the given whole component instance? If this classification serves as a template for classifying the contents in a whole component instance or in a node, then true is returned. If this classification is the one of a given content, then false is returned.
        Returns:
        true if this classification is a predefined one, false otherwise.
      • isPredefinedForTheWholeComponentInstance

        public boolean isPredefinedForTheWholeComponentInstance()
        Is this classification on the PdC is a predefined one for the contents published in the given whole component instance? If this classification serves as a template for classifying the contents in a whole component instance, then true is returned. If this classification is a predefined one dedicated to classify only the content in a given node, then false is returned. If this classification is the one of a given content, then false is returned.
        Returns:
        true if this classification is a predefined one for the whole component instance, false otherwise.
      • isPredefinedForANode

        public boolean isPredefinedForANode()
        Is this classification on the PdC is a predefined one for the contents published in a given node? If this classification serves to classify the contents published in a single node of the component instance, then true is returned. If this classification is the one of a given content, then false is returned. If this classification is the predefined one for the whole component instance, then false is returned.
        Returns:
        true if this classification is a predefined one for a given node, false otherwise.
      • updateForPdcAxisValuesDeletion

        public void updateForPdcAxisValuesDeletion​(List<PdcAxisValue> deletedValues)
        Updates this classification by removing from its positions the specified values because they will be deleted from the PdC's axis. This method is invoked at axis value deletion. Accordingly, it performs an update of this classification by applying the following algorithm for each deleted value:
        • The value is a base one of the axis: the value is removed from any positions of the classification. If a position is empty (it has no values) it is then deleted (the classification can be then found empty).
        • The value is a leaf in its value hierarchical tree: the value is replaced by its mother value in any positions of this classification.
        Parameters:
        deletedValues - the values that are removed from a PdC's axis.
      • withPositions

        public PdcClassification withPositions​(Collection<PdcPosition> thePositions)
        Sets the positions on the PdC for this classification.
        Parameters:
        thePositions - the position to set in this classification.
        Returns:
        itself.
      • withPosition

        public PdcClassification withPosition​(PdcPosition aPosition)
        Adds the specified position on the PdC in this classification.
        Parameters:
        aPosition - a position on the PdC to add in this classification.
        Returns:
        itself.
      • copy

        public PdcClassification copy()
        Copies this classification on the PdC. The copy isn't persisted and hence its identifier is not set.
        Returns:
        a copy of this classification.
      • getClassifyPositions

        public List<ClassifyPosition> getClassifyPositions()
        Gets the positions on the PdC of this classification in the form of ClassifyPosition instances. This method is for compatibility with the old way to manage the classification.
        Returns:
        a list of ClassifyPosition instances, each of them representing a position on the PdC.
      • classifyContent

        public void classifyContent​(Contribution content)
        Classifies the specified content on the PdC with this 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. Subscribers are notified if at least one of their subscription matches given classification.
        Parameters:
        content - the Silverpeas content to classify.
      • classifyContent

        public void classifyContent​(Contribution content,
                                    boolean alertSubscribers)
        Classifies the specified content on the PdC with this 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.
        alertSubscribers - indicates if subscribers must be notified or not