Class PdcClassificationEntity

  • All Implemented Interfaces:
    Serializable, WebEntity

    public class PdcClassificationEntity
    extends Object
    implements WebEntity
    The PdC classification entity represents the web entity of the classification of a Silverpeas's resource on the classification plan (PdC). As such, it publishes only some of the business classification attributes. The PdC classificiation is identified in the web by its unique identifier, its URI. The PdC is a semantic referential that is made up of one or more axis, each of them representing a semantic concept. A classification on the PdC is then a set of positions of the resource content on the different axis; each position provides an atomic semantic information about the resource. A position can be a semantic value of an axis as well a set of values on different axis.
    See Also:
    Serialized Form
    • Method Detail

      • undefinedClassification

        public static PdcClassificationEntity undefinedClassification()
        Creates a non-defined PdC classification. Resources that are not classified on the PdC have a such undefined classification as they have no classification positions on the PdC axis.
        Returns:
        a web entity representing an undefined PdC classification.
      • aPdcClassificationEntity

        public static PdcClassificationEntity aPdcClassificationEntity​(List<ClassifyPosition> fromPositions,
                                                                       String inLanguage,
                                                                       URI atURI)
        Creates a web entity from the specified positions on the PdC in the specified language and identified by the specified URI.
        Parameters:
        fromPositions - list of Classify Position of this entity.
        inLanguage - the language in which the entity should be translated.
        atURI - the URI identified the classification in the web.
        Returns:
        a PdcClassificationEntity instance.
      • aPdcClassificationEntity

        public static PdcClassificationEntity aPdcClassificationEntity​(PdcClassification classification,
                                                                       String inLanguage,
                                                                       URI atURI)
        Creates a web entity of the specified classification on the PdC in the specified language and identified by the specified URI.
        Parameters:
        classification - the classification on the PdC for which the web entity should represent.
        inLanguage - the language in which the entity should be translated.
        atURI - the URI identified the classification in the web.
        Returns:
        a PdcClassificationEntity instance.
      • fromJSON

        public static PdcClassificationEntity fromJSON​(String classification)
        Converts the specified JSON representation of a classification on the PdC into an instance of a classification entity.
        Parameters:
        classification - the JSON representation of a classification on the PdC.
        Returns:
        a PdcClassificationEntity instance.
        Throws:
        DecodingException - if an error occurs during the conversion.
      • toJSON

        public String toJSON()
        Converts this entity into its JSON representation. Actually, the marshalling of the web entities are managed by the JAX-RS framework. This method is dedicated to be used in some particular circumstances in which there is an explicit need to have a JSON representation of this entity out of the JAX-RS context.
        Returns:
        a JSON representation of this classification entity (as string).
      • inLanguage

        public static String inLanguage​(String language)
        A convenient method to enhance the readability of creators.
        Parameters:
        language - the language in which the terms in the classification are.
        Returns:
        the language
      • atURI

        public static URI atURI​(URI uri)
        A convenient method to enhance the readability of creators.
        Parameters:
        uri - the URI at which the classification is published.
        Returns:
        the classification URI.
      • fromPositions

        public static List<ClassifyPosition> fromPositions​(List<ClassifyPosition> positions)
        A convenient method to enhance the readability of creators.
        Parameters:
        positions - a list of classify positions.
        Returns:
        the classify positions.
      • fromPdcClassification

        public static PdcClassification fromPdcClassification​(PdcClassification classification)
        A convenient method to enhance the readability of creators.
        Parameters:
        classification - PdC classification.
        Returns:
        the PdC classification.
      • isUndefined

        public boolean isUndefined()
        This web entity represents the undefined classification of a resource on the PdC.
        Returns:
        true if this web entity is the representation of the undefined classification, false otherwise.
      • getURI

        public URI getURI()
        Description copied from interface: WebEntity
        Gets the URI at which this web entity is published and can be accessed.
        Specified by:
        getURI in interface WebEntity
        Returns:
        the web entity URI.
      • withSynonymsFrom

        public PdcClassificationEntity withSynonymsFrom​(UserThesaurusHolder userThesaurus)
                                                 throws ThesaurusException
        Sets this classification entity with the synonyms of each position value that are present in the specified user thesaurus.
        Parameters:
        userThesaurus - a holder of the thesaurus of the user that asked for this PdC classification.
        Returns:
        itself.
        Throws:
        ThesaurusException - if an error occurs while getting the synonyms of the values of the different classification positions.
      • getClassificationPositions

        public List<PdcPositionEntity> getClassificationPositions()
        Gets all the positions on the PdC axis that defines this resource classification.
        Returns:
        the list of a Web representation of each classification positions in this classification.
      • getPdcPositions

        public List<PdcPosition> getPdcPositions()
        Gets all the positions on the PdC axis that defines this resource classification as PdcPosition instances.
        Returns:
        a list of PdcPosition instances representing each of them a position on the PdC.
      • isModifiable

        public boolean isModifiable()
        Is the PdC classification represented by this web entity can be changed?
        Returns:
        true if the represented PdC classification is modifiable, false otherwise.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • setClassificationPositions

        public void setClassificationPositions​(List<PdcPositionEntity> positions)
      • setModifiable

        protected void setModifiable​(boolean modifiable)