org.openwms.core.domain.preferences
Class ModulePreference

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

public class ModulePreference
extends AbstractPreference

A ModulePreference is used to store configuration settings in Module scope.

The table model of an ModulePreference spans an unique key over the columns C_TYPE, C_OWNER and C_KEY.

It's counterpart in the context of JAXB is the modulePreference element.

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 ModulePreferences.
 
Fields inherited from class org.openwms.core.domain.AbstractEntity
FIND_ALL, FIND_BY_ID
 
Constructor Summary
ModulePreference()
          Create a new ModulePreference.
ModulePreference(String owner, String key)
          Create a new ModulePreference.
 
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 ModulePreferences. Name is "ModulePreference.findAll" .

See Also:
Constant Field Values
Constructor Detail

ModulePreference

public ModulePreference()
Create a new ModulePreference. Only defined by the JAXB implementation.


ModulePreference

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

Parameters:
owner - The name of the owning module
key - the key
Throws:
IllegalArgumentException - when key or owner is null or empty
Method Detail

getKey

public String getKey()
Get the key.

Returns:
the key

getOwner

public String getOwner()
Get the owner.

Returns:
the owner

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. Uses the type, owner and the key to create a PreferenceKey instance.

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 the type, owner and the key for the 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 the type, owner and the key 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.