org.openwms.core.domain.system.usermanagement
Class UserPassword

java.lang.Object
  extended by org.openwms.core.domain.AbstractEntity
      extended by org.openwms.core.domain.system.usermanagement.UserPassword
All Implemented Interfaces:
Serializable, DomainObject<Long>

public class UserPassword
extends AbstractEntity
implements DomainObject<Long>

Is a representation of an User together with her password.

When an User changes her password, the current password is added to a history list of passwords. This is necessary to omit Users from setting formerly used passwords.

Since:
0.1
Version:
$Revision: 1595 $
Author:
Heiko Scherrer
See Also:
User, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openwms.core.domain.AbstractEntity
AbstractEntity.AbstractEntityListener
 
Field Summary
 
Fields inherited from class org.openwms.core.domain.AbstractEntity
FIND_ALL, FIND_BY_ID
 
Constructor Summary
protected UserPassword()
          Constructor only for the persistence provider.
  UserPassword(User user, String password)
          Create a new UserPassword.
 
Method Summary
 boolean equals(Object obj)
           Compare the uid property field.
 Long getId()
          Return the technical key value.
 String getPassword()
          Return the current password.
 Date getPasswordChanged()
          Return the date of the last password change.
 User getUser()
          Return the User of this password.
 long getVersion()
          Return the value of the optimistic locking field.
 int hashCode()
           Use the uid to calculate the hashCode.
 boolean isNew()
          Check whether the instance is a transient or persisted one.
 void setUser(User user)
          Change the User.
 String toString()
          Return the password as String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserPassword

public UserPassword(User user,
                    String password)
Create a new UserPassword.

Parameters:
user - The User to assign
password - The password as String to assign
Throws:
IllegalArgumentException - when user or password is null or empty

UserPassword

protected UserPassword()
Constructor only for the persistence provider.

Method Detail

getId

public Long getId()
Return the technical key value.

Specified by:
getId in interface DomainObject<Long>
Returns:
The technical, unique key

getUser

public User getUser()
Return the User of this password.

Returns:
The User of this password

setUser

public void setUser(User user)
Change the User.

Parameters:
user - The new User

getPassword

public String getPassword()
Return the current password.

Returns:
The current password

getPasswordChanged

public Date getPasswordChanged()
Return the date of the last password change.

Returns:
The date when the password has changed

hashCode

public int hashCode()
Use the uid to calculate the hashCode. Does not call the superclass. Uses the password and user for calculation.

Overrides:
hashCode in class AbstractEntity
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Compare the uid property field. Comparison is done with the business-key (user and password). AbstractEntity.equals(Object) is not called to avoid comparison with the UUID.

Overrides:
equals in class AbstractEntity
See Also:
AbstractEntity.equals(java.lang.Object)

toString

public String toString()
Return the password as String.

Overrides:
toString in class Object
Returns:
The password
See Also:
Object.toString()

getVersion

public long getVersion()
Return the value of the optimistic locking field.

Specified by:
getVersion in interface DomainObject<Long>
Returns:
the version number

isNew

public boolean isNew()
Check whether the instance is a transient or persisted one.

Specified by:
isNew in interface DomainObject<Long>
Returns:
true if transient (not persisted before), otherwise false


Copyright © 2005-2011 openwms.org. All Rights Reserved.