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

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

public class UserPreference
extends AbstractPreference

An UserPreference is used to store settings specific to an User. It is always assigned to a particular User and not accessible from, nor valid for, other Users. UserPreferences cannot be overruled by any other type of Preferences.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openwms.core.domain.AbstractEntity
AbstractEntity.AbstractEntityListener
 
Field Summary
static String NQ_FIND_ALL
          Query to find all UserPreferences.
 
Fields inherited from class org.openwms.core.domain.AbstractEntity
FIND_ALL, FIND_BY_ID
 
Constructor Summary
UserPreference(String owner, String key)
          Create a new UserPreference.
 
Method Summary
 boolean equals(Object obj)
           Compare the uid property field.
protected  Object[] getFields()
          Return all fields as an array of objects.
 String getKey()
          Get the key.
 String getOwner()
          Get the owner.
 PreferenceKey getPrefKey()
          Return a PreferenceKey of this preference.
 PropertyScope getType()
          Return the particular type of the preference.
 int hashCode()
           Use the uid to calculate the hashCode.
 
Methods inherited from class org.openwms.core.domain.system.AbstractPreference
getDescription, getFloatValue, getId, getMaximum, getMinimum, getPropertiesAsString, getValue, getVersion, isFromFile, isNew, setDescription, setFloatValue, setFromFile, setMaximum, setMinimum, setValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NQ_FIND_ALL

public static final String NQ_FIND_ALL
Query to find all UserPreferences.

See Also:
Constant Field Values
Constructor Detail

UserPreference

public UserPreference(String owner,
                      String key)
Create a new UserPreference.

Parameters:
owner - The User's username is set as owner of this preference
key - The key of this preference
Throws:
IllegalArgumentException - when owner or key is null or empty
Method Detail

getOwner

public String getOwner()
Get the owner.

Returns:
the owner.

getKey

public String getKey()
Get the key.

Returns:
the key.

getType

public PropertyScope getType()
Return the particular type of the preference.

Specified by:
getType in class AbstractPreference
Returns:
The type of the preference
See Also:
AbstractPreference.getType()

getFields

protected Object[] getFields()
Return all fields as an array of objects.

Specified by:
getFields in class AbstractPreference
Returns:
fields as array
See Also:
AbstractPreference.getFields()

getPrefKey

public PreferenceKey getPrefKey()
Return a PreferenceKey of this preference.

Specified by:
getPrefKey in class AbstractPreference
Returns:
A PreferenceKey
See Also:
AbstractPreference.getPrefKey()

hashCode

public int hashCode()
Use the uid to calculate the hashCode.

Use all fields to calculate the hashCode and don't use the hashCode of the super class.

Uses key, owner and type for hashCode calculation.

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

equals

public boolean equals(Object obj)
Compare the uid property field.

Use all fields for comparison but don't call the super class.

Comparison done with key, owner and type fields. Not delegated to super class.

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


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