ca.bc.gov.webade.preferences
Class DefaultWebADEPreferences

java.lang.Object
  extended byca.bc.gov.webade.preferences.DefaultWebADEPreferences
All Implemented Interfaces:
java.io.Serializable, WebADEPreferences

public final class DefaultWebADEPreferences
extends java.lang.Object
implements WebADEPreferences, java.io.Serializable

Contains the set of WebADEPreference objects and the set of WebADEPreferenceSet objects for a particular target(Global, Application, Extension, WebADE, User).

Author:
jross
See Also:
Serialized Form

Constructor Summary
DefaultWebADEPreferences(WebADEPreferenceType preferenceTypeCode)
          Constructor with the preference type code for this set of preferences.
 
Method Summary
 void addPreference(java.lang.String preferenceSubType, WebADEPreference pref)
          Adds the given WebADEPreference object to the list of preferences.
 void addPreferenceSet(java.lang.String preferenceSubType, WebADEPreferenceSet prefSet)
          Adds the given WebADEPreference object to the target set of preferences identified by the set name.
 void clear()
          Removes all preferences and preferences sets from this instance.
 java.lang.Object clone()
          see java.lang.Object#clone()
 boolean equals(java.lang.Object obj)
           
 WebADEPreference getPreference(java.lang.String preferenceSubType, java.lang.String preferenceName)
          Returns the target preference, identified by sub-type and name.
 java.util.Properties getPreferencePropertiesBySubType(java.lang.String preferenceSubType)
          Returns the preferences that match the given subtype as name value pairs in a Properties object.
 java.util.Properties getPreferencePropertiesBySubType(java.lang.String preferenceSubType, boolean convertMultiValuesToDelimitedString)
          Returns the preferences that match the given subtype as name value pairs in a Properties object.
 java.util.Properties getPreferencePropertiesBySubType(java.lang.String preferenceSubType, boolean convertMultiValuesToDelimitedString, java.lang.String delimiterString)
          Returns the preferences that match the given subtype as name value pairs in a Properties object.
 java.util.List getPreferencesBySubType(java.lang.String preferenceSubType)
          Returns the preferences that match the given subtype.
 WebADEPreferenceSet getPreferenceSet(java.lang.String preferenceSubType, java.lang.String preferenceSetName)
          Returns the target preference set.
 java.util.List getPreferenceSetsBySubType(java.lang.String preferenceSubType)
          Returns the preference sets that match the given subtype.
 java.util.List getPreferenceSubTypes()
          Returns all subtypes in the .
 WebADEPreferenceType getPreferenceType()
           
 WebADEPreferences getWebADEPreferencesBySubType(java.lang.String preferenceSubType)
          Returns the WebADEPreference and WebADEPreferenceSet objects that match the given subtype.
 int hashCode()
           
 void removePreference(java.lang.String preferenceSubType, java.lang.String preferenceName)
          Removes the given preference from the list of preferences.
 void removePreferenceSet(java.lang.String preferenceSubType, java.lang.String preferenceSetName)
          Removes the given preference set from the list of preference sets.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultWebADEPreferences

public DefaultWebADEPreferences(WebADEPreferenceType preferenceTypeCode)
                         throws java.lang.NullPointerException
Constructor with the preference type code for this set of preferences.

Parameters:
preferenceTypeCode - The preference type code for all preferences in this set.
Throws:
java.lang.NullPointerException - Thrown if the preference type code parameter was null.
Method Detail

getPreferenceType

public final WebADEPreferenceType getPreferenceType()
Specified by:
getPreferenceType in interface WebADEPreferences
Returns:
Returns the preferenceTypeCode.
See Also:
WebADEPreferences.getPreferenceType()

getPreferenceSubTypes

public final java.util.List getPreferenceSubTypes()
Description copied from interface: WebADEPreferences
Returns all subtypes in the .

Specified by:
getPreferenceSubTypes in interface WebADEPreferences
Returns:
A List of WebADEPreference objects matching the sub-type.
See Also:
WebADEPreferences.getPreferenceSubTypes()

getPreference

public final WebADEPreference getPreference(java.lang.String preferenceSubType,
                                            java.lang.String preferenceName)
Description copied from interface: WebADEPreferences
Returns the target preference, identified by sub-type and name.

Specified by:
getPreference in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preference.
preferenceName - The target preference name.
Returns:
The target WebADEPreference object, or null if not found.
See Also:
WebADEPreferences.getPreference(java.lang.String, java.lang.String)

getPreferencesBySubType

public final java.util.List getPreferencesBySubType(java.lang.String preferenceSubType)
Description copied from interface: WebADEPreferences
Returns the preferences that match the given subtype.

Specified by:
getPreferencesBySubType in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preference.
Returns:
A List of WebADEPreference objects matching the sub-type.
See Also:
WebADEPreferences.getPreferencesBySubType(java.lang.String)

getPreferencePropertiesBySubType

public final java.util.Properties getPreferencePropertiesBySubType(java.lang.String preferenceSubType)
                                                            throws WebADEException
Description copied from interface: WebADEPreferences
Returns the preferences that match the given subtype as name value pairs in a Properties object. Assumes that all preference objects with the given subtype have at most one value assigned.

Specified by:
getPreferencePropertiesBySubType in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preference.
Returns:
A Properties object of String name-value pairs.
Throws:
WebADEException - Thrown if any of the WebADEPreference object with the given subtype have more than one value assigned.
See Also:
WebADEPreferences.getPreferencePropertiesBySubType(java.lang.String)

getPreferencePropertiesBySubType

public final java.util.Properties getPreferencePropertiesBySubType(java.lang.String preferenceSubType,
                                                                   boolean convertMultiValuesToDelimitedString)
                                                            throws WebADEException
Description copied from interface: WebADEPreferences
Returns the preferences that match the given subtype as name value pairs in a Properties object. Assumes that all preference objects with the given subtype have at most one value assigned.

Specified by:
getPreferencePropertiesBySubType in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preference.
convertMultiValuesToDelimitedString - Flag to convert multi-value preferences to a single comma-delimited value in the properties file (if set to true), or whether to throw an exception (if set to false).
Returns:
A Properties object of String name-value pairs.
Throws:
WebADEException - Thrown if any of the WebADEPreference object with the given subtype have more than one value assigned.
See Also:
WebADEPreferences.getPreferencePropertiesBySubType(java.lang.String, boolean)

getPreferencePropertiesBySubType

public final java.util.Properties getPreferencePropertiesBySubType(java.lang.String preferenceSubType,
                                                                   boolean convertMultiValuesToDelimitedString,
                                                                   java.lang.String delimiterString)
                                                            throws WebADEException
Description copied from interface: WebADEPreferences
Returns the preferences that match the given subtype as name value pairs in a Properties object. Assumes that all preference objects with the given subtype have at most one value assigned.

Specified by:
getPreferencePropertiesBySubType in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preference.
convertMultiValuesToDelimitedString - Flag to convert multi-value preferences to a single delimited value in the properties file (if set to true), or whether to throw an exception (if set to false).
delimiterString - The string used to delimit the multi-values string. The default value is a comma.
Returns:
A Properties object of String name-value pairs.
Throws:
WebADEException - Thrown if any of the WebADEPreference object with the given subtype have more than one value assigned.
See Also:
WebADEPreferences.getPreferencePropertiesBySubType(java.lang.String, boolean, java.lang.String)

getPreferenceSet

public final WebADEPreferenceSet getPreferenceSet(java.lang.String preferenceSubType,
                                                  java.lang.String preferenceSetName)
Description copied from interface: WebADEPreferences
Returns the target preference set. Assumes that there will be only one match for the given sub-type/set-name combination. If more than one match is found, and exception is thrown.

Specified by:
getPreferenceSet in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preference set.
preferenceSetName - The target preference set name.
Returns:
The target WebADEPreferenceSet object, or null if not found.
See Also:
WebADEPreferences.getPreferenceSet(java.lang.String, java.lang.String)

getPreferenceSetsBySubType

public final java.util.List getPreferenceSetsBySubType(java.lang.String preferenceSubType)
Description copied from interface: WebADEPreferences
Returns the preference sets that match the given subtype.

Specified by:
getPreferenceSetsBySubType in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preference set.
Returns:
A List of WebADEPreferenceSet objects matching the sub-type.
See Also:
WebADEPreferences.getPreferenceSetsBySubType(java.lang.String)

getWebADEPreferencesBySubType

public WebADEPreferences getWebADEPreferencesBySubType(java.lang.String preferenceSubType)
Description copied from interface: WebADEPreferences
Returns the WebADEPreference and WebADEPreferenceSet objects that match the given subtype.

Specified by:
getWebADEPreferencesBySubType in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preferences.
Returns:
A WebADEPreferences object containing all preferences and preference sets matching the sub-type.
See Also:
WebADEPreferences.getWebADEPreferencesBySubType(java.lang.String)

addPreference

public final void addPreference(java.lang.String preferenceSubType,
                                WebADEPreference pref)
                         throws java.lang.NullPointerException
Description copied from interface: WebADEPreferences
Adds the given WebADEPreference object to the list of preferences.

Specified by:
addPreference in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preference.
pref - The target preference to add.
Throws:
java.lang.NullPointerException - Thrown if the preference sub type parameter was null.
See Also:
WebADEPreferences.addPreference(java.lang.String, ca.bc.gov.webade.preferences.WebADEPreference)

removePreference

public final void removePreference(java.lang.String preferenceSubType,
                                   java.lang.String preferenceName)
Description copied from interface: WebADEPreferences
Removes the given preference from the list of preferences.

Specified by:
removePreference in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preference.
preferenceName - The name of the target preference.
See Also:
WebADEPreferences.removePreference(java.lang.String, java.lang.String)

addPreferenceSet

public final void addPreferenceSet(java.lang.String preferenceSubType,
                                   WebADEPreferenceSet prefSet)
                            throws java.lang.NullPointerException
Description copied from interface: WebADEPreferences
Adds the given WebADEPreference object to the target set of preferences identified by the set name.

Specified by:
addPreferenceSet in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preference.
prefSet - The target preference set to add.
Throws:
java.lang.NullPointerException - Thrown if the preference sub type parameter was null.
See Also:
WebADEPreferences.addPreferenceSet(java.lang.String, ca.bc.gov.webade.preferences.WebADEPreferenceSet)

removePreferenceSet

public final void removePreferenceSet(java.lang.String preferenceSubType,
                                      java.lang.String preferenceSetName)
Description copied from interface: WebADEPreferences
Removes the given preference set from the list of preference sets.

Specified by:
removePreferenceSet in interface WebADEPreferences
Parameters:
preferenceSubType - The sub-type containing the preference set.
preferenceSetName - The name of the target preference set.
See Also:
WebADEPreferences.removePreferenceSet(java.lang.String, java.lang.String)

clear

public final void clear()
Description copied from interface: WebADEPreferences
Removes all preferences and preferences sets from this instance.

Specified by:
clear in interface WebADEPreferences
See Also:
WebADEPreferences.clear()

equals

public boolean equals(java.lang.Object obj)
See Also:
Object.equals(java.lang.Object)

toString

public java.lang.String toString()
See Also:
Object.toString()

hashCode

public int hashCode()
See Also:
Object.hashCode()

clone

public java.lang.Object clone()
see java.lang.Object#clone()

Specified by:
clone in interface WebADEPreferences