Class AbstractPasswordRule

    • Field Detail

      • settings

        protected static org.silverpeas.kernel.bundle.SettingBundle settings
    • Constructor Detail

      • AbstractPasswordRule

        protected AbstractPasswordRule​(PasswordRuleType passwordRuleType)
    • Method Detail

      • isRequired

        public boolean isRequired()
        Description copied from interface: PasswordRule
        Indicates if the rule is required.
        Specified by:
        isRequired in interface PasswordRule
        Returns:
      • isCombined

        public boolean isCombined()
        Description copied from interface: PasswordRule
        Indicates if the rule is combined one.
        Specified by:
        isCombined in interface PasswordRule
        Returns:
      • random

        protected int random​(int maxValue)
        Returns a random integer value included between 0 and (given maxValue - 1).
        Returns:
        a random integer value.
      • getString

        protected String getString​(String key,
                                   String language,
                                   String... params)
        Gets a string message according to the given language.
        Parameters:
        key - the key of the message template to get.
        language - the language in which the message has to be written.
        params - parameters to pass to the message.
        Returns:
        the message generated from a template and the parameters.
      • getIntegerFromSettings

        protected Integer getIntegerFromSettings​(String key,
                                                 Integer defaultValue)
        Gets an integer from settings
        Parameters:
        key - the key of the property.
        defaultValue - the default value if the property isn't defined.
        Returns:
        the property value or 0 if the value got from the settings is negative.
      • countRegexOccur

        protected int countRegexOccur​(String text,
                                      String regex)
        Counting the number of occurrences matching the specified regexp in the given text.
        Parameters:
        text - a text.
        regex - the regexp.
        Returns:
        the number of matching patterns found in the text with the regexp.