ca.bc.gov.webade.developer.util
Class PreferenceUtils

java.lang.Object
  extended byca.bc.gov.webade.developer.util.PreferenceUtils

public class PreferenceUtils
extends java.lang.Object

Helper class for dealing with WebADE Preferences.

Author:
Vivid Solutions Inc

Constructor Summary
PreferenceUtils()
           
 
Method Summary
static ca.bc.gov.webade.Preference findPreference(ca.bc.gov.webade.Application app, java.lang.String subType, java.lang.String setName, java.lang.String name)
          Extracts a preference from the preferences for a given Application starting with application preferences then checking global preferences.
static ca.bc.gov.webade.Preference findPreference(ca.bc.gov.webade.Preferences globalPreferences, ca.bc.gov.webade.Preferences applicationPreferences, ca.bc.gov.webade.Preferences userPreferences, java.lang.String subType, java.lang.String setName, java.lang.String name)
          Helper method for extracting a preference from WebADE preferences starting with user preferences, then application preferences, then global preferences.
static ca.bc.gov.webade.Preference findPreference(ca.bc.gov.webade.Preferences preferences, java.lang.String subType, java.lang.String setName, java.lang.String name)
          Helper method for extracting a preference from WebADE preferences.
static java.lang.String getPreferenceValue(ca.bc.gov.webade.Preference preference)
          Extracts the prefrence value form a preference assumed to hold only one value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreferenceUtils

public PreferenceUtils()
Method Detail

findPreference

public static ca.bc.gov.webade.Preference findPreference(ca.bc.gov.webade.Application app,
                                                         java.lang.String subType,
                                                         java.lang.String setName,
                                                         java.lang.String name)
                                                  throws ca.bc.gov.webade.WebADEException
Extracts a preference from the preferences for a given Application starting with application preferences then checking global preferences. Does not check user preferences.

Parameters:
app - The WebADE Application.
subType - The preference subType.
setName - The preference setName.
name - The preference name.
Returns:
The preference or null if not found.
Throws:
ca.bc.gov.webade.WebADEException - Any exception coming out of the WebADE preference calls.

findPreference

public static ca.bc.gov.webade.Preference findPreference(ca.bc.gov.webade.Preferences globalPreferences,
                                                         ca.bc.gov.webade.Preferences applicationPreferences,
                                                         ca.bc.gov.webade.Preferences userPreferences,
                                                         java.lang.String subType,
                                                         java.lang.String setName,
                                                         java.lang.String name)
                                                  throws ca.bc.gov.webade.WebADEException
Helper method for extracting a preference from WebADE preferences starting with user preferences, then application preferences, then global preferences. The first matching instance found is returned.

Parameters:
globalPreferences - Global Preferences.
applicationPreferences - Application Preferences.
userPreferences - User Preferences.
subType - The preference subType.
setName - The preference setName.
name - The preference name.
Returns:
The preference or null if not found.
Throws:
ca.bc.gov.webade.WebADEException - Any exception coming out of the WebADE preference calls.

findPreference

public static ca.bc.gov.webade.Preference findPreference(ca.bc.gov.webade.Preferences preferences,
                                                         java.lang.String subType,
                                                         java.lang.String setName,
                                                         java.lang.String name)
                                                  throws ca.bc.gov.webade.WebADEException
Helper method for extracting a preference from WebADE preferences.

Parameters:
preferences - Preferences from WebADE
subType - The preference subType
setName - The preference setName
name - The preference name
Returns:
The preference or null if not found.
Throws:
ca.bc.gov.webade.WebADEException - Any exception coming out of the WebADE preference calls.

getPreferenceValue

public static java.lang.String getPreferenceValue(ca.bc.gov.webade.Preference preference)
Extracts the prefrence value form a preference assumed to hold only one value.

Parameters:
preference -
Returns:
The first value in the value array of the given preference or null if no value found.