Class ClassificationManager

  • All Implemented Interfaces:
    JPropertiesListener

    public class ClassificationManager
    extends java.lang.Object
    implements JPropertiesListener
    Manager class for all classification related controls.
    Since:
    10.0.8 / JCMS-10746
    • Field Detail

      • CLASSIFICATION_ADMIN_ACL

        public static final java.lang.String CLASSIFICATION_ADMIN_ACL
        Name of the ACL authorizing classification level administration
        See Also:
        Constant Field Values
      • PROP_ENABLED

        public static final java.lang.String PROP_ENABLED
        Name of property to check if classification is enabled.
        See Also:
        Constant Field Values
      • PROP_MAXIMUM_LEVEL

        public static final java.lang.String PROP_MAXIMUM_LEVEL
        Name of property from which maximum level is read.
        See Also:
        Constant Field Values
      • PROP_BASELINE_LEVEL

        public static final java.lang.String PROP_BASELINE_LEVEL
        Name of property from which the reference level is read.
        See Also:
        Constant Field Values
      • MAXIMUM_LEVEL_DEFAULT

        public static final int MAXIMUM_LEVEL_DEFAULT
        Default configuration of maximum level.
        See Also:
        Constant Field Values
      • BASELINE_LEVEL_DEFAULT

        public static final int BASELINE_LEVEL_DEFAULT
        Default configuration of the baseline level.
        See Also:
        Constant Field Values
      • PROP_MEMBER_CLEARANCE_ENABLED

        public static final java.lang.String PROP_MEMBER_CLEARANCE_ENABLED
        Name of boolean property used to read whether member clearance is enabled.

        It includes all associated features, such as publication read right using member authorization, UIs.

        See Also:
        Constant Field Values
      • MEMBER_CLEARANCE_ENABLED_DEFAULT

        public static final boolean MEMBER_CLEARANCE_ENABLED_DEFAULT
        Default value for member authorization features.
        See Also:
        Constant Field Values
      • PROP_PREFIX_FEATURE_MAXIMUM_LEVEL

        public static final java.lang.String PROP_PREFIX_FEATURE_MAXIMUM_LEVEL
        Name of property prefix from which maximum level of each feature is read.
        See Also:
        Constant Field Values
      • PROP_PREFIX_CONSTRAINT_START_LEVEL

        public static final java.lang.String PROP_PREFIX_CONSTRAINT_START_LEVEL
        Name of property prefix from which the start level used of each constraint is read.
        See Also:
        Constant Field Values
    • Method Detail

      • propertiesChange

        public void propertiesChange​(JProperties properties)
        Description copied from interface: JPropertiesListener
        Invoked after properties have been modified in JCMS and save on disk.

        You cannot alter the value received in parameters.

        Note that properties parameter may be null, a limited set of site properties, or all site properties.

        To check that a property has been modified, reload the "current" property instead using channel.getProperties or channel.getProperty.

        Specified by:
        propertiesChange in interface JPropertiesListener
        Parameters:
        properties - the properties which have been submitted to change
      • isEnabled

        public boolean isEnabled()
        Check if classification is enabled.
        Returns:
        true if maximum level is higher than 0, false otherwise
      • getMaximumLevel

        public int getMaximumLevel()
        Retrieve the maximum classification level value possible
        Returns:
        the value configured with property "classification.max-level"
      • isMemberClearanceEnabled

        public boolean isMemberClearanceEnabled()
        Check if member clearance is enabled.

        It includes all associated features, such as publication read right using member clearance level, UIs.

        Returns:
        true if classification and member clearance is enabled, false otherwise.
      • canAccessClassificationAdmin

        public boolean canAccessClassificationAdmin​(Member mbr)
        Check if the specified member is authorized to access classification admin console.
        Parameters:
        mbr - the mbr to check
        Returns:
        true if authorized false otherwise
      • showClassification

        public boolean showClassification​(Member mbr)
        Check if any UI related to classification should be presented to the specified Member
        Parameters:
        mbr - the Member for which check is performed, null accepted
        Returns:
        true if classification UI should be displayed, false to hide them completely
      • getClassificationLabelHtml

        public java.lang.String getClassificationLabelHtml​(java.lang.String lang,
                                                           int level)
        Retrieve an HTML I18N representation of the specified classification level, in the specified language.

        Implementation detail : the HTML label returned will not be suitable for inline presentation (e.g. inside a span) as it will be presented using a badge. For such use case, use the inline parameter of method getClassificationLabelHtml(String, int, boolean).

        Parameters:
        lang - the language in which you want the I18N label
        level - a classification level
        Returns:
        a I18N property name
      • getClassificationLabelHtml

        public java.lang.String getClassificationLabelHtml​(java.lang.String lang,
                                                           int level,
                                                           boolean inline)
        Retrieve an HTML I18N representation of the specified classification level, in the specified language.
        Parameters:
        lang - the language in which you want the I18N label
        level - a classification level
        inline - set to true when the label is displayed inside other text (span... ), it will be displayed as a "label". Set to false when displayed for itself it will be displayed as a "badge".
        Returns:
        a I18N property name
      • getClassificationLabel

        public java.lang.String getClassificationLabel​(java.lang.String lang,
                                                       int level)
        Retrieve the I18N label for specified classification level, in the specified language.
        Parameters:
        lang - the language in which you want the I18N label
        level - a classification level
        Returns:
        a I18N property name
      • getClassificationLabelProperty

        public java.lang.String getClassificationLabelProperty​(int level)
        Retrieve the I18N label property suitable to build a label for specified classification level.
        Parameters:
        level - a classification level
        Returns:
        a I18N property name
      • getClassificationLevelSettings

        public EnumerateSettings getClassificationLevelSettings()
        Retrieve a settings suitable to edit a classification level.
        Returns:
        a new EnumerateSettings instance
      • getClassificationLevelSettings

        public EnumerateSettings getClassificationLevelSettings​(int maxLevel)
        Retrieve a settings suitable to edit a classification level.
        Parameters:
        maxLevel - the maximum level to display, use 0 (or any negative value) to display all possible levels
        Returns:
        a new EnumerateSettings instance
      • getClassificationLevelSettings

        public EnumerateSettings getClassificationLevelSettings​(int minLevel,
                                                                int maxLevel)
        Retrieve a settings suitable to edit a classification level.
        Parameters:
        minLevel - the minimum level to display
        maxLevel - the maximum level to display, use 0 (or any negative value) to display all possible levels (above the minimum specified)
        Returns:
        a new EnumerateSettings instance
      • getClassificationDescriptionProperty

        public java.lang.String getClassificationDescriptionProperty​(int level)
        Retrieve the I18N property suitable to build a description for specified classification level.
        Parameters:
        level - a classification level
        Returns:
        a I18N property name
      • getClassificationTooltip

        public java.lang.String getClassificationTooltip​(int level)
        Retrieve the I18N HTML tooltip suitable to present the description for specified classification level (if it exists).
        Parameters:
        level - a classification level
        Returns:
        a I18N property name or empty string if their is no description for this level
      • getEffectiveClearanceLevel

        public int getEffectiveClearanceLevel​(Member mbr)
        Retrieve the maximum classification level authorized for the specified member.

        Parameters:
        mbr - the Member for which computation is performed.
        Returns:
        a value between 1 and the maximum level configured with property "classification.max-level"