Class PdcAxis


  • public class PdcAxis
    extends Object
    An axis of the classification plan (named PdC). A PdC axis is defined by an identifier and it is made up of a set of values. An axis in the PdC generally defines a concept (a meaning) or a categorization of contents in Silverpeas. An axis of the PdC is a tree whose the leaves are the values. The axis can have several branches, each of them representing then an hierarchic semantic tree carrying a refinement of a meaning (of a value). For example, the values in the concept 'geography' can be a tree in which each geographic area are divided into countries -> regions or states -> departments or regions -> towns.
    • Method Detail

      • fromTheUsedAxis

        public static PdcAxis fromTheUsedAxis​(UsedAxis axis,
                                              String inLanguage,
                                              UserThesaurusHolder withThesaurus)
                                       throws ThesaurusException
        Creates a PdC axis from the specified configured axis for a specific component instance and in which the terms are expressed in the specified language and whose synonyms are set with the specified user thesaurus.
        Parameters:
        axis - an axis of the PdC potentially configured for a given Silverpeas component instance.
        inLanguage - the language to use to translate the terms of the axis.
        withThesaurus - the thesaurus to use to set the synonyms of the axis values. Null if no thesaurus are available or if no synonyms require to be set.
        Returns:
        the PdcAxis instance corresponding to the specified business axis.
        Throws:
        ThesaurusException - if an error occurs while using the thesaurus when setting up the PdC axis.
      • fromTheAxis

        public static PdcAxis fromTheAxis​(Axis axis,
                                          String inLanguage,
                                          UserThesaurusHolder withThesaurus)
                                   throws ThesaurusException
        Creates a PdC axis from the specified configured axis for a specific component instance and in which the terms are expressed in the specified language and whose synonyms are set with the specified user thesaurus.
        Parameters:
        axis - an axis of the PdC potentially configured for a given Silverpeas component instance.
        inLanguage - the language to use to translate the terms of the axis.
        withThesaurus - the thesaurus to use to set the synonyms of the axis values. Null if no thesaurus are available or if no synonyms require to be set.
        Returns:
        the PdcAxis instance corresponding to the specified business axis.
        Throws:
        ThesaurusException - if an error occurs while using the thesaurus when setting up the PdC axis.
      • getId

        public int getId()
        Gets the unique identifier of this axis in the PdC.
        Returns:
        the axis unique identifier.
      • isMandatory

        public boolean isMandatory()
        Is this axis is mandatory in the classification on the PdC.
        Returns:
        true if this axis is mandatory when classifying a content onto the PdC.
      • isInvariant

        public boolean isInvariant()
        Is this axis is invariant in the classification on the PdC. An invariant axis in a classification is an axis that can have only a single possible value per classification, whatever the positions onto the PdC.
        Returns:
        true if this axis in an invariant one when classifying a content onto the PdC.
      • getName

        public String getName()
        Gets the name of this axis.
        Returns:
        the axis name.
      • getInvariantValue

        public String getInvariantValue()
        Gets the value in the axis that is invariant.
        Returns:
        the identifier of the invariant value of the axis or an empty string if there is no invariant value.
      • getOriginValue

        public String getOriginValue()
        Gets the value that is set as the origin in this axis.
        Returns:
        the identifier of the axis origin value.
      • getType

        public int getType()
        Gets the type of this axis.
        Returns:
        the type: PRIMARY_AXIS or SECONDARY_AXIS.
      • getValues

        public List<PdcAxisValueEntity> getValues()
        Gets the values that made up this axis.
        Returns:
        an unmodifiable list of axis' values.
      • withAsPdcAxisValues

        public PdcAxis withAsPdcAxisValues​(List<PdcAxisValueEntity> values,
                                           String originValueId)
        Adds the specified values into this axis and sets the value used as origin in this axis.
        Parameters:
        originValueId - the identifier of the origin value.
        values - the PdC values to set.
        Returns:
        itself.
      • ofType

        public PdcAxis ofType​(int axisType)
        Sets the type of the axis.
        Parameters:
        axisType - the type of the axis. It accepts a value among PRIMARY_AXIS and SECONDARY_AXIS.
        Returns:
        itself.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object