com.endeca.portal.metadata.framework
Class FrameworkSettingManager

java.lang.Object
  extended by com.endeca.portal.metadata.AbstractMetadataManager<FrameworkSetting>
      extended by com.endeca.portal.metadata.framework.FrameworkSettingManager
All Implemented Interfaces:
MetadataManager<FrameworkSetting>

public class FrameworkSettingManager
extends AbstractMetadataManager<FrameworkSetting>
implements MetadataManager<FrameworkSetting>

Encapsulates DB-interaction methods specific to Discovery Framework settings

Author:
Endeca Technologies, Inc.

Field Summary
static java.lang.String TYPE_FRAMEWORK
          Represents the "type" value for DF-core settings
static java.lang.String TYPE_FRAMEWORK_KEYPREFIX
          Represents the key prefix for all framework settings
 
Method Summary
 java.util.List<FrameworkSetting> getAllFrameworkSettings()
          Returns all Discovery Framework core settings.
 FrameworkSetting getFrameworkSettingByKey(java.lang.String key)
          Returns a Discovery Framework core setting by its key.
 java.lang.String getFrameworkSettingValueByKey(java.lang.String key, java.lang.String defaultValue)
          Returns the value of a Discovery Framework core setting by its key.
static FrameworkSettingManager getInstance()
          Gets a FrameworkSettingManager instance.
 FrameworkSetting getOrSetFrameworkRecordByKey(java.lang.String key, FrameworkSetting defaultSetting)
          Returns a Discovery Framework core setting if it exists and writes (then returns) a specified record to the db otherwise
 FrameworkSetting objectFromMetadataRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)
          Converts a Liferay record to a Framework Setting
<S extends MetadataProperty>
S
propertyFromMetadataPropertyRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord record)
          Returns null; Framework settings do not have child Metadata Properties
 
Methods inherited from class com.endeca.portal.metadata.AbstractMetadataManager
getObject, getObjectById, getObjects, getProperties, getProperty, handleObjectPropertyPersistence, objectsFromMetadataRecords, persist, persist, persistProperties, persistProperty, propertiesFromMetadataPropertyRecords, removeObjectById, removePropertyById
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_FRAMEWORK

public static final java.lang.String TYPE_FRAMEWORK
Represents the "type" value for DF-core settings

See Also:
Constant Field Values

TYPE_FRAMEWORK_KEYPREFIX

public static final java.lang.String TYPE_FRAMEWORK_KEYPREFIX
Represents the key prefix for all framework settings

See Also:
Constant Field Values
Method Detail

getFrameworkSettingByKey

public FrameworkSetting getFrameworkSettingByKey(java.lang.String key)
Returns a Discovery Framework core setting by its key.

Parameters:
key - the key of the setting to retrieve
Returns:
the metadata object

getAllFrameworkSettings

public java.util.List<FrameworkSetting> getAllFrameworkSettings()
Returns all Discovery Framework core settings.

Returns:
the list of metadata objects

getFrameworkSettingValueByKey

public java.lang.String getFrameworkSettingValueByKey(java.lang.String key,
                                                      java.lang.String defaultValue)
Returns the value of a Discovery Framework core setting by its key.

Parameters:
key - the key of the setting to retrieve
defaultValue - the value to use if the setting was not found
Returns:
the value (or the specified default)

getOrSetFrameworkRecordByKey

public FrameworkSetting getOrSetFrameworkRecordByKey(java.lang.String key,
                                                     FrameworkSetting defaultSetting)
                                              throws MetadataException
Returns a Discovery Framework core setting if it exists and writes (then returns) a specified record to the db otherwise

Parameters:
key - the key of the setting to retrieve
defaultSetting - the record to write if the setting was not found
Returns:
the metadata object
Throws:
MetadataException - if a record could not be retrieved or set

getInstance

public static FrameworkSettingManager getInstance()
Gets a FrameworkSettingManager instance. Currently creates a new instance every time, but could be modified to work from a singleton.

Returns:
the instance

objectFromMetadataRecord

public FrameworkSetting objectFromMetadataRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)
Converts a Liferay record to a Framework Setting

Specified by:
objectFromMetadataRecord in interface MetadataManager<FrameworkSetting>
Specified by:
objectFromMetadataRecord in class AbstractMetadataManager<FrameworkSetting>
Parameters:
record - the base Liferay record
Returns:
the Metadata Object
See Also:
MetadataManager.objectFromMetadataRecord(MetadataRecord)

propertyFromMetadataPropertyRecord

public <S extends MetadataProperty> S propertyFromMetadataPropertyRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord record)
Returns null; Framework settings do not have child Metadata Properties

Specified by:
propertyFromMetadataPropertyRecord in interface MetadataManager<FrameworkSetting>
Specified by:
propertyFromMetadataPropertyRecord in class AbstractMetadataManager<FrameworkSetting>
Type Parameters:
S - an instance of a Metadata Property extension
Parameters:
record - the base Liferay record
Returns:
the Metadata Property
See Also:
MetadataManager.propertyFromMetadataPropertyRecord(MetadataPropertyRecord)