com.endeca.portal.metadata.attributes
Class AttributeDisplayNameManager

java.lang.Object
  extended by com.endeca.portal.metadata.AbstractMetadataManager<AttributeDisplayName>
      extended by com.endeca.portal.metadata.attributes.AttributeDisplayNameManager
All Implemented Interfaces:
MetadataManager<AttributeDisplayName>

public class AttributeDisplayNameManager
extends AbstractMetadataManager<AttributeDisplayName>
implements MetadataManager<AttributeDisplayName>

Encapsulates DB-interaction methods specific to display names for attributes

Author:
Endeca Technologies, Inc.

Field Summary
static java.lang.String TYPE_ATTR_DISPLAY_NAME
          Represents the "type" value for an attribute's display name
 
Method Summary
 java.util.List<AttributeDisplayName> getAllDisplayNames()
          Returns all attribute display names.
 AttributeDisplayName getDisplayNameByKey(java.lang.String dataSourceId, java.lang.String key)
          Returns an attribute display name, associated with a given data source, by its key
 java.util.List<AttributeDisplayName> getDisplayNamesByDataSource(java.lang.String dataSourceId)
          Returns a list of attribute display names associated with a given data source
 java.lang.String getDisplayNameValueByKey(java.lang.String dataSourceId, java.lang.String key, java.lang.String defaultValue)
          Returns the value of an attribute display name, associated with a given data source, by its key.
static AttributeDisplayNameManager getInstance()
          Gets a AttributeDisplayNameManager instance.
 AttributeDisplayName getOrSetDisplayNameByKey(java.lang.String dataSourceId, java.lang.String key, AttributeDisplayName defaultAttrDispName)
          Returns an attribute display name, associated with a given data source, if it exists and writes (then returns) a specified record to the db otherwise
 AttributeDisplayName objectFromMetadataRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)
          Given a base Liferay record, return a Metadata Object; subclasses must implement this method.
<S extends MetadataProperty>
S
propertyFromMetadataPropertyRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord record)
          Returns null; Attribute display names 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_ATTR_DISPLAY_NAME

public static final java.lang.String TYPE_ATTR_DISPLAY_NAME
Represents the "type" value for an attribute's display name

See Also:
Constant Field Values
Method Detail

getAllDisplayNames

public java.util.List<AttributeDisplayName> getAllDisplayNames()
Returns all attribute display names.

Returns:
the list of display name Metadata Objects

getDisplayNamesByDataSource

public java.util.List<AttributeDisplayName> getDisplayNamesByDataSource(java.lang.String dataSourceId)
Returns a list of attribute display names associated with a given data source

Parameters:
dataSourceId - the data source ID
Returns:
a list of display name Metadata Objects

getDisplayNameByKey

public AttributeDisplayName getDisplayNameByKey(java.lang.String dataSourceId,
                                                java.lang.String key)
Returns an attribute display name, associated with a given data source, by its key

Parameters:
dataSourceId - the data source ID
key - the name of the attribute for which a display name should be retrieved
Returns:
the display name Metadata Object

getDisplayNameValueByKey

public java.lang.String getDisplayNameValueByKey(java.lang.String dataSourceId,
                                                 java.lang.String key,
                                                 java.lang.String defaultValue)
Returns the value of an attribute display name, associated with a given data source, by its key.

Parameters:
dataSourceId - the data source ID
key - the name of the attribute for which a display name should be retrieved
defaultValue - the value to use if the attribute display name was not found
Returns:
the value (or the specified default)

getOrSetDisplayNameByKey

public AttributeDisplayName getOrSetDisplayNameByKey(java.lang.String dataSourceId,
                                                     java.lang.String key,
                                                     AttributeDisplayName defaultAttrDispName)
                                              throws MetadataException
Returns an attribute display name, associated with a given data source, if it exists and writes (then returns) a specified record to the db otherwise

Parameters:
dataSourceId - the data source ID
key - the name of the attribute for which a display name should be retrieved
defaultAttrDispName - the object to write if the attribute display name was not found
Returns:
the display name Metadata Object
Throws:
MetadataException - if a record could not be retrieved or set

getInstance

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

Returns:
the instance

objectFromMetadataRecord

public AttributeDisplayName objectFromMetadataRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)
Description copied from class: AbstractMetadataManager
Given a base Liferay record, return a Metadata Object; subclasses must implement this method.

Specified by:
objectFromMetadataRecord in interface MetadataManager<AttributeDisplayName>
Specified by:
objectFromMetadataRecord in class AbstractMetadataManager<AttributeDisplayName>
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; Attribute display names do not have child Metadata Properties

Specified by:
propertyFromMetadataPropertyRecord in interface MetadataManager<AttributeDisplayName>
Specified by:
propertyFromMetadataPropertyRecord in class AbstractMetadataManager<AttributeDisplayName>
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)