com.softslate.commerce.businessobjects.core
Class SettingsBean

java.lang.Object
  extended by com.softslate.commerce.businessobjects.core.BaseBusinessObject
      extended by com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
          extended by com.softslate.commerce.businessobjects.core.SettingsBean
All Implemented Interfaces:
BusinessObject, BusinessProcessor, Settings, java.io.Serializable

public class SettingsBean
extends BaseBusinessProcessor
implements Settings, java.io.Serializable

Represents various settings used by the application. Settings for the application are stored in the sscSetting database table. The various settings represent everything from the default colors and fonts used by the display templates, to the names of the Java classes that implement various business object interfaces for the application.

An instance of SettingsBean is created in the Struts layer. It is initialized there through initialize(), which populates the map property with the results of a query on the sscSetting table. For each setting, an entry in the map is created with the setting code used as the key and its value as the key's value.

The SettingsBean instance created in the Struts layer is passed throughout the application to look up needed settings. The application's BusinessObjectFactory initializes each business object with the SettingsBean immediately after it creates it.

Author:
David Tobey
See Also:
Serialized Form

Field Summary
(package private) static org.apache.commons.logging.Log log
           
private  java.util.Map map
           
private static long serialVersionUID
           
 
Constructor Summary
SettingsBean()
           
 
Method Summary
 java.util.Map addSetting(java.util.Map parameters)
           
 Settings copyAndAlter(java.util.Map settingsToAlter)
          Returns a new Settings object that is a copy of this one, but with certain values altered, as represented in the incoming Map.
 Settings copyAndAlter(java.lang.String name, java.lang.String value)
          Returns a new Settings object that is a copy of this one, but with a given element altered.
 void deleteSetting(java.util.Map parameters)
           
 void editDeleteUserSettings(java.util.Map parameters)
           
 java.util.Map editSetting(java.util.Map parameters)
           
 java.util.Map getMap()
          Retrieves the map of settings values for this Settings instance.
 java.lang.Object getValue(java.lang.String key)
          Gets the value of a given key in this Settings' map.
 void initialize()
          Initializes this Settings instance.
 Setting loadSettingFromID(java.util.Map parameters)
           
 java.util.Collection loadSettings()
           
 java.util.Map loadSettingsAndCount(java.util.Map parameters)
           
 Settings processSettings(java.util.Map parameters)
           
 void setMap(java.util.Map map)
          Sets the map of settings values for this Settings instance.
 void setValue(java.lang.String key, java.lang.Object value)
          Sets the value of a given key in this Settings' map.
 
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
formatDateTime, formatPrice, getAppComponents, getAppSettings, getAttributeIDs, getBusinessObjectFactory, getDaoFactory, getProductIDs, getSettings, getUser, initialize, loadMatchingSkus, parseDateTime, parseResponseData, prepareRequestData, sendHTTPPost, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setSettings, setUser, updateOrderTotals, updateOrderTotals, utils
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

log

static org.apache.commons.logging.Log log

map

private java.util.Map map
See Also:
getMap()
Constructor Detail

SettingsBean

public SettingsBean()
Method Detail

getMap

public java.util.Map getMap()
Description copied from interface: Settings
Retrieves the map of settings values for this Settings instance. The keys of this Map correspond to the code field of the sscSetting database table. The values correspond to value field (integerValue, smallValue, mediumValue, or textValue) that corresponds with the value of the valueType field.

Specified by:
getMap in interface Settings
Returns:
The Map of settings keys and values for this Settings instance.

setMap

public void setMap(java.util.Map map)
Description copied from interface: Settings
Sets the map of settings values for this Settings instance.

Specified by:
setMap in interface Settings

setValue

public void setValue(java.lang.String key,
                     java.lang.Object value)
Description copied from interface: Settings
Sets the value of a given key in this Settings' map.

Specified by:
setValue in interface Settings
Parameters:
key - The key whose value is being set
value - The value.

getValue

public java.lang.Object getValue(java.lang.String key)
Description copied from interface: Settings
Gets the value of a given key in this Settings' map.

Specified by:
getValue in interface Settings
Parameters:
key - The key whose value is to be retrieved.
Returns:
The value of the setting.

initialize

public void initialize()
                throws java.lang.Exception
Description copied from interface: Settings
Initializes this Settings instance. Populates the map property with the results of a query on the sscSetting database table.

Specified by:
initialize in interface Settings
Throws:
java.lang.Exception

copyAndAlter

public Settings copyAndAlter(java.lang.String name,
                             java.lang.String value)
                      throws java.lang.Exception
Description copied from interface: Settings
Returns a new Settings object that is a copy of this one, but with a given element altered. The incoming name and value represent the element that is to altered and the new value for it. This is useful in custom code if in an isolated area different settings are needed to perform some custom action.

Specified by:
copyAndAlter in interface Settings
Returns:
A new Settings object with the new setting value applied to it.
Throws:
java.lang.Exception

copyAndAlter

public Settings copyAndAlter(java.util.Map settingsToAlter)
                      throws java.lang.Exception
Description copied from interface: Settings
Returns a new Settings object that is a copy of this one, but with certain values altered, as represented in the incoming Map.

Specified by:
copyAndAlter in interface Settings
Parameters:
settingsToAlter - A Map of new settings to apply to the new object.
Returns:
A new Settings object with the new setting value applied to it.
Throws:
java.lang.Exception

processSettings

public Settings processSettings(java.util.Map parameters)
                         throws java.lang.Exception
Specified by:
processSettings in interface Settings
Throws:
java.lang.Exception

loadSettings

public java.util.Collection loadSettings()
                                  throws java.lang.Exception
Specified by:
loadSettings in interface Settings
Throws:
java.lang.Exception

loadSettingsAndCount

public java.util.Map loadSettingsAndCount(java.util.Map parameters)
                                   throws java.lang.Exception
Specified by:
loadSettingsAndCount in interface Settings
Throws:
java.lang.Exception

addSetting

public java.util.Map addSetting(java.util.Map parameters)
                         throws java.lang.Exception
Specified by:
addSetting in interface Settings
Throws:
java.lang.Exception

loadSettingFromID

public Setting loadSettingFromID(java.util.Map parameters)
                          throws java.lang.Exception
Specified by:
loadSettingFromID in interface Settings
Throws:
java.lang.Exception

editSetting

public java.util.Map editSetting(java.util.Map parameters)
                          throws java.lang.Exception
Specified by:
editSetting in interface Settings
Throws:
java.lang.Exception

deleteSetting

public void deleteSetting(java.util.Map parameters)
                   throws java.lang.Exception
Specified by:
deleteSetting in interface Settings
Throws:
java.lang.Exception

editDeleteUserSettings

public void editDeleteUserSettings(java.util.Map parameters)
                            throws java.lang.Exception
Specified by:
editDeleteUserSettings in interface Settings
Throws:
java.lang.Exception


Copyright © SoftSlate, LLC 2003–2005