org.openwms.core.domain.system
Class AbstractPreference

java.lang.Object
  extended by org.openwms.core.domain.AbstractEntity
      extended by org.openwms.core.domain.system.AbstractPreference
All Implemented Interfaces:
Serializable, DomainObject<Long>
Direct Known Subclasses:
ApplicationPreference, ModulePreference, RolePreference, UserPreference

public abstract class AbstractPreference
extends AbstractEntity
implements DomainObject<Long>

An AbstractPreference is a superclass for all other preference classes within the application.

It encapsulates some common behavior of preference types.

Since:
0.1
Version:
$Revision: 1583 $
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 AbstractPreferences.
 
Fields inherited from class org.openwms.core.domain.AbstractEntity
FIND_ALL, FIND_BY_ID
 
Constructor Summary
protected AbstractPreference()
          Accessed by persistence provider.
 
Method Summary
 boolean equals(Object obj)
           Compare the uid property field.
 String getDescription()
          Return the description of the AbstractPreference.
protected abstract  Object[] getFields()
          Return all fields as an array of objects.
 Float getFloatValue()
          Get the floatValue of the AbstractPreference.
 Long getId()
          Return the technical key value.
 int getMaximum()
          Return the possible maximum value of the AbstractPreference.
 int getMinimum()
          Return the possible minimum value of the AbstractPreference.
abstract  PreferenceKey getPrefKey()
          Return a PreferenceKey of this preference.
 String getPropertiesAsString()
          Return all fields as concatenated String.
abstract  PropertyScope getType()
          Return the particular type of the preference.
 String getValue()
          Return the value of the AbstractPreference.
 long getVersion()
          Return the value of the optimistic locking field.
 int hashCode()
           Use the uid to calculate the hashCode.
 boolean isFromFile()
          Check whether the preference was originally imported from a file.
 boolean isNew()
          Check whether the instance is a transient or persisted one.
 void setDescription(String description)
          Set a description for the AbstractPreference.
 void setFloatValue(Float floatValue)
          Set the floatValue of the AbstractPreference.
 void setFromFile(boolean fromFile)
          Set the fromFile.
 void setMaximum(int maximum)
          Set a possible maximum value for the AbstractPreference.
 void setMinimum(int minimum)
          Set a possible minimum value for the AbstractPreference.
 void setValue(String value)
          Set the value of the AbstractPreference.
 
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 AbstractPreferences. Name is "AbstractPreference.findAll" .

See Also:
Constant Field Values
Constructor Detail

AbstractPreference

protected AbstractPreference()
Accessed by 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

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

getVersion

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

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

getValue

public String getValue()
Return the value of the AbstractPreference.

Returns:
The value of the AbstractPreference

setValue

public void setValue(String value)
Set the value of the AbstractPreference.

Parameters:
value - The value to set

getFloatValue

public Float getFloatValue()
Get the floatValue of the AbstractPreference.

Returns:
The floatValue of the preference

setFloatValue

public void setFloatValue(Float floatValue)
Set the floatValue of the AbstractPreference.

Parameters:
floatValue - The floatValue to set

getDescription

public String getDescription()
Return the description of the AbstractPreference.

Returns:
The description as String

setDescription

public void setDescription(String description)
Set a description for the AbstractPreference.

Parameters:
description - The description to set

getMinimum

public int getMinimum()
Return the possible minimum value of the AbstractPreference.

Returns:
The possible minimum value

setMinimum

public void setMinimum(int minimum)
Set a possible minimum value for the AbstractPreference.

Parameters:
minimum - The possible minimum value to set

getMaximum

public int getMaximum()
Return the possible maximum value of the AbstractPreference.

Returns:
The possible maximum value

setMaximum

public void setMaximum(int maximum)
Set a possible maximum value for the AbstractPreference.

Parameters:
maximum - The possible maximum value to set

isFromFile

public boolean isFromFile()
Check whether the preference was originally imported from a file.

Returns:
true if imported from a file, otherwise false

setFromFile

public void setFromFile(boolean fromFile)
Set the fromFile.

Parameters:
fromFile - The fromFile to set.

getPropertiesAsString

public String getPropertiesAsString()
Return all fields as concatenated String.

Returns:
fields as String

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.

Overrides:
hashCode in class AbstractEntity
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.

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

getFields

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

Returns:
fields as array

getType

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

Returns:
The type of the preference

getPrefKey

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

Returns:
A PreferenceKey


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