org.silverpeas.password.rule
Class AbstractPasswordRule

java.lang.Object
  extended by org.silverpeas.password.rule.AbstractPasswordRule
All Implemented Interfaces:
PasswordRule
Direct Known Subclasses:
AtLeastXDigitPasswordRule, AtLeastXLowercasePasswordRule, AtLeastXSpecialCharPasswordRule, AtLeastXUppercasePasswordRule, BlankForbiddenPasswordRule, MaxLengthPasswordRule, MinLengthPasswordRule, SequentialForbiddenPasswordRule

public abstract class AbstractPasswordRule
extends Object
implements PasswordRule

User: Yohann Chastagnier Date: 07/01/13


Field Summary
protected static int DEFAULT_LENGTH
           
protected static ResourceLocator settings
           
 
Constructor Summary
protected AbstractPasswordRule(PasswordRuleType passwordRuleType)
           
 
Method Summary
protected  int countRegexOccur(String text, String regex)
          Counting regexpr occurences in a String
 String getDescription(String language)
          Gets the description of the rule according to a language.
protected  Integer getIntegerFromSettings(String key, Integer defaultValue)
          Gets an integer from settings
protected  String getString(String key, String language, String... params)
          Gets a string message according to the given language.
 PasswordRuleType getType()
          Gets the type password rule.
 boolean isCombined()
          Indicates if the rule is combined one.
 boolean isRequired()
          Indicates if the rule is required.
protected  int random(int maxValue)
          Returns a random integer value included between 0 and (given maxValue - 1).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.silverpeas.password.rule.PasswordRule
check, getValue, random
 

Field Detail

DEFAULT_LENGTH

protected static final int DEFAULT_LENGTH
See Also:
Constant Field Values

settings

protected static ResourceLocator settings
Constructor Detail

AbstractPasswordRule

protected AbstractPasswordRule(PasswordRuleType passwordRuleType)
Method Detail

getType

public PasswordRuleType getType()
Description copied from interface: PasswordRule
Gets the type password rule.

Specified by:
getType in interface PasswordRule
Returns:

getDescription

public String getDescription(String language)
Description copied from interface: PasswordRule
Gets the description of the rule according to a language.

Specified by:
getDescription in interface PasswordRule
Returns:

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:

getString

protected String getString(String key,
                           String language,
                           String... params)
Gets a string message according to the given language.

Parameters:
key -
language -
params -
Returns:

getIntegerFromSettings

protected Integer getIntegerFromSettings(String key,
                                         Integer defaultValue)
Gets an integer from settings

Parameters:
key -
defaultValue -
Returns:

countRegexOccur

protected int countRegexOccur(String text,
                              String regex)
Counting regexpr occurences in a String

Parameters:
text -
regex -
Returns:


Copyright © 2016 Silverpeas. All Rights Reserved.