cz.muni.fi.rtc.teacherWorkbench.model
Class PasswordGenerator

java.lang.Object
  extended by cz.muni.fi.rtc.teacherWorkbench.model.PasswordGenerator

public class PasswordGenerator
extends java.lang.Object

Password generator

Author:
honza

Field Summary
static int DEFAULT_LENGTH
           
 
Constructor Summary
PasswordGenerator()
          Creates new password generator.
PasswordGenerator(char[] possible)
          Generates new password generator.
 
Method Summary
 java.lang.String generatePassword()
          Generates password of default length.
 java.lang.String generatePassword(int length)
          Generates random password of given length
static java.util.Collection<ImportedPerson> generatePasswordsForPeople(java.util.Collection<ImportedPerson> people)
          Generates passwords for the users.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LENGTH

public static final int DEFAULT_LENGTH
See Also:
Constant Field Values
Constructor Detail

PasswordGenerator

public PasswordGenerator()
Creates new password generator. All alpha numeric values are possible for the password


PasswordGenerator

public PasswordGenerator(char[] possible)
Generates new password generator.

Parameters:
possible - Array of chars the password will be generated from
Method Detail

generatePassword

public java.lang.String generatePassword(int length)
                                  throws EmptyPossibleCharsException
Generates random password of given length

Parameters:
length - Password length
Returns:
Random password
Throws:
EmptyPossibleCharsException - if the array of possible chars is empty

generatePassword

public java.lang.String generatePassword()
                                  throws EmptyPossibleCharsException
Generates password of default length. Default length is taken from DEFAULT_LENGTH constant

Returns:
Random password
Throws:
EmptyPossibleCharsException - if the array of possible chars is empty

generatePasswordsForPeople

public static java.util.Collection<ImportedPerson> generatePasswordsForPeople(java.util.Collection<ImportedPerson> people)
Generates passwords for the users.

Parameters:
people - People to have password generated
Returns:
People with generated passwords