org.dartra.standard
Class StandardUser

java.lang.Object
  extended byorg.dartra.standard.PersistentObject
      extended byorg.dartra.standard.StandardUser
All Implemented Interfaces:
Persistent, User

public class StandardUser
extends PersistentObject
implements User

Standard implementation of the User interface.

Author:
Erwin Vervaet, Maarten De Cock

Constructor Summary
StandardUser(java.lang.String userId, java.lang.String name, java.lang.String password)
          Create a new user with given id, name and password (unencrypted).
StandardUser(java.lang.String userId, java.lang.String name, java.lang.String password, boolean female, boolean leftHanded)
          Create a new user with given id, name and password (unencrypted).
StandardUser(java.lang.String userId, java.lang.String name, java.lang.String password, boolean female, boolean leftHanded, boolean encryptedPassword)
          Create a new user with given id, name and password.
 
Method Summary
 void addDartsSet(DartsSet dartsSet)
          Adds a DartsSet to the collection owned by the user.
 boolean checkPassword(java.lang.String pw)
          Check the password for the user.
protected  java.lang.String encryptPassword(java.lang.String password)
          Encrypt given password.
 DartsSet getDartsSet(int index)
          Returns the DartsSet at the given index.
 java.util.Vector getDartsSets()
          Returns the collection of darts sets owned by the user.
 java.lang.String getPassword()
          Get the password of the user, probably in an incrypted form.
 java.lang.String getUserId()
          Return the user id (which is unique) of this user.
 java.lang.String getUserName()
          Returns the username of this user.
 boolean isFemale()
          Returns true when this user is female, false otherwise (for males).
 boolean isLeftHanded()
          Is this a left handed user?
 void setPassword(java.lang.String pw)
          Set the password of the user.
 void setUserName(java.lang.String name)
          Set the username of this user.
 java.lang.String toString()
           
 
Methods inherited from class org.dartra.standard.PersistentObject
getId, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.dartra.framework.Persistent
getId, setId
 

Constructor Detail

StandardUser

public StandardUser(java.lang.String userId,
                    java.lang.String name,
                    java.lang.String password)

Create a new user with given id, name and password (unencrypted). This defaults to a male, right handed player.


StandardUser

public StandardUser(java.lang.String userId,
                    java.lang.String name,
                    java.lang.String password,
                    boolean female,
                    boolean leftHanded)

Create a new user with given id, name and password (unencrypted). You should also specify the gender and the handed-ness of the player.


StandardUser

public StandardUser(java.lang.String userId,
                    java.lang.String name,
                    java.lang.String password,
                    boolean female,
                    boolean leftHanded,
                    boolean encryptedPassword)

Create a new user with given id, name and password. You should also specify the gender and the handed-ness of the player.

When encryptedPassword is true, the given password is taken to be already encrypted. When false, it will be incrypted. This constuctor is intended for use in the DAOs.

Method Detail

encryptPassword

protected java.lang.String encryptPassword(java.lang.String password)

Encrypt given password.

Subclasses can redefine this method to do proper password encryption. This implementation does not encrypt the password.


getUserId

public java.lang.String getUserId()
Description copied from interface: User

Return the user id (which is unique) of this user.

Specified by:
getUserId in interface User

setUserName

public void setUserName(java.lang.String name)
Description copied from interface: User

Set the username of this user.

Specified by:
setUserName in interface User

getUserName

public java.lang.String getUserName()
Description copied from interface: User

Returns the username of this user.

Specified by:
getUserName in interface User

setPassword

public void setPassword(java.lang.String pw)
Description copied from interface: User

Set the password of the user.

Specified by:
setPassword in interface User

getPassword

public java.lang.String getPassword()
Description copied from interface: User

Get the password of the user, probably in an incrypted form.

Specified by:
getPassword in interface User

checkPassword

public boolean checkPassword(java.lang.String pw)
Description copied from interface: User

Check the password for the user.

Specified by:
checkPassword in interface User

toString

public java.lang.String toString()

getDartsSets

public java.util.Vector getDartsSets()
Description copied from interface: User

Returns the collection of darts sets owned by the user. The resulting collection contains DartsSet objects.

Specified by:
getDartsSets in interface User

getDartsSet

public DartsSet getDartsSet(int index)
Description copied from interface: User

Returns the DartsSet at the given index.

Specified by:
getDartsSet in interface User

addDartsSet

public void addDartsSet(DartsSet dartsSet)
Description copied from interface: User

Adds a DartsSet to the collection owned by the user.

Specified by:
addDartsSet in interface User

isFemale

public boolean isFemale()
Description copied from interface: User

Returns true when this user is female, false otherwise (for males).

Specified by:
isFemale in interface User

isLeftHanded

public boolean isLeftHanded()
Description copied from interface: User

Is this a left handed user?

Specified by:
isLeftHanded in interface User