com.endeca.portal.metadata.attributes
Class AttributeSet

java.lang.Object
  extended by com.endeca.portal.metadata.AbstractMetadata
      extended by com.endeca.portal.metadata.MetadataObject
          extended by com.endeca.portal.metadata.attributes.AttributeSet
All Implemented Interfaces:
Metadata

public class AttributeSet
extends MetadataObject

Specialization of Metadata Object to represent an attribute set, which consists of a display name and a list of ordered mappings to individual attributes that are associated with the set.

Author:
Endeca Technologies, Inc.

Constructor Summary
AttributeSet()
          Constructor: initializes the object and sets it immediately to be a DF core type
AttributeSet(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)
          Constructor that initializes the object, assigns a given MetadataRecord to its underlying object, and sets its type The underlying object is not persisted to the database; that must be done explicitly if you want it to be persisted.
AttributeSet(java.lang.String displayName, java.lang.String locale, java.lang.String dataSourceId)
          Convenience constructor that inits the object and sets a an locale-specific display name property and the data source ID.
 
Method Summary
 void addAttributeMapping(java.lang.String attributeName)
          Maps an attribute to this set
 void addAttributeMappings(java.util.List<java.lang.String> attributeNames)
          Maps a list of attributes to this set
 java.util.List<AttributeSetMapping> getAttributeMappings()
          Gets all attribute mapping Metadata Properties for this attribute set object
 AttributeSetDisplayName getDisplayName(java.lang.String locale)
          Gets the display name Metadata Property associated with this attribute set object for a specified locale
 java.lang.String getDisplayNameValue(java.lang.String locale)
          Gets the display name for this attribute set object for a specified locale
 java.lang.String getDisplayNameValue(java.lang.String requestLocale, java.lang.String defaultLocale)
          Convenience method to return a display name for this attribute set - looks first for a display name for the request locale, then for the container's default locale, then finally uses the key.
 int getOrderIndex()
          Returns the ordering index of this set within the list of all sets for this datasource.
 java.lang.String getType()
          Returns "ATTR_SET"
 boolean isCatchall()
          Indicates whether or not this attribute set is the default "catchall" set.
 void removeAttributeMapping(java.lang.String attributeName)
          Removes an attribute mapping from this set
 void removeAttributeMappings(java.util.List<java.lang.String> attributeNames)
          Removes a list of attributes from this set
 void replaceAttributeMappings(java.util.List<java.lang.String> attributeMappings)
           
 void setAttributeMappings(java.util.List<AttributeSetMapping> attributeMappings)
           
 void setCatchall(boolean isCatchall)
          Sets whether or not this attribute set is the default "catchall" set.
 void setDisplayName(java.lang.String displayName, java.lang.String locale)
          Sets the display name Metadata Property associated with this attribute set object for a specified locale.
 void setOrderIndex(int orderIndex)
          Sets the ordering index of this set within the list of all sets for this datasource.
 
Methods inherited from class com.endeca.portal.metadata.MetadataObject
addProperties, addProperty, equals, getProperties, getProperties, getSourceRecord, init, removeAllProperties, removeProperties, removeProperties, removeProperty, setSourceRecord
 
Methods inherited from class com.endeca.portal.metadata.AbstractMetadata
getDescription, getFeature, getKey, getLastUpdated, getLocale, getObjectId, getRel, getSource, getValue, setDescription, setFeature, setKey, setLastUpdated, setLocale, setObjectId, setRel, setSource, setValue, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeSet

public AttributeSet()
Constructor: initializes the object and sets it immediately to be a DF core type


AttributeSet

public AttributeSet(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)
Constructor that initializes the object, assigns a given MetadataRecord to its underlying object, and sets its type The underlying object is not persisted to the database; that must be done explicitly if you want it to be persisted.

Parameters:
record - the source MetadataRecord

AttributeSet

public AttributeSet(java.lang.String displayName,
                    java.lang.String locale,
                    java.lang.String dataSourceId)
Convenience constructor that inits the object and sets a an locale-specific display name property and the data source ID. The provided display name also becomes the "key" identifier in the main metadata table (which of course can be changed by calling AbstractMetadata.setKey(String)).

Parameters:
displayName - the name of the attribute set for the specified locale
locale - the locale for the display name
dataSourceId - the data source ID
Method Detail

getDisplayName

public AttributeSetDisplayName getDisplayName(java.lang.String locale)
Gets the display name Metadata Property associated with this attribute set object for a specified locale

Parameters:
locale - the locale
Returns:
the display name Metadata Property, or null if none exists

getDisplayNameValue

public java.lang.String getDisplayNameValue(java.lang.String locale)
Gets the display name for this attribute set object for a specified locale

Parameters:
locale - the locale
Returns:
the display name value, or null if none exists

getDisplayNameValue

public java.lang.String getDisplayNameValue(java.lang.String requestLocale,
                                            java.lang.String defaultLocale)
Convenience method to return a display name for this attribute set - looks first for a display name for the request locale, then for the container's default locale, then finally uses the key.

Parameters:
requestLocale - the request locale
defaultLocale - the default locale
Returns:
the display name value, or null if none exists

setDisplayName

public void setDisplayName(java.lang.String displayName,
                           java.lang.String locale)
Sets the display name Metadata Property associated with this attribute set object for a specified locale. If a display name already exists for the specified locale, it will be overwritten.

Parameters:
displayName - the display name
locale - the locale

getAttributeMappings

public java.util.List<AttributeSetMapping> getAttributeMappings()
Gets all attribute mapping Metadata Properties for this attribute set object

Returns:
the list of attribute mappings

addAttributeMapping

public void addAttributeMapping(java.lang.String attributeName)
Maps an attribute to this set

Parameters:
attributeName - the name of the attribute to add to this set

addAttributeMappings

public void addAttributeMappings(java.util.List<java.lang.String> attributeNames)
Maps a list of attributes to this set

Parameters:
attributeNames - a list of the attribute names to add to this set

removeAttributeMapping

public void removeAttributeMapping(java.lang.String attributeName)
Removes an attribute mapping from this set

Parameters:
attributeName - the name of the attribute to remove

removeAttributeMappings

public void removeAttributeMappings(java.util.List<java.lang.String> attributeNames)
Removes a list of attributes from this set

Parameters:
attributeNames - a list of the attribute names to remove from this set

setAttributeMappings

public void setAttributeMappings(java.util.List<AttributeSetMapping> attributeMappings)
Parameters:
attributeMappings -

replaceAttributeMappings

public void replaceAttributeMappings(java.util.List<java.lang.String> attributeMappings)
Parameters:
attributeMappings -

isCatchall

public boolean isCatchall()
Indicates whether or not this attribute set is the default "catchall" set. The "catchall" set includes, at runtime, all attributes that are not explicitly part of any other set. Note: it is the responsibility of the attribute settings portlet or any other consumers of this interface to ensure that there is only one catchall set for a given datasource.

Returns:
true if this is the catchall set

setCatchall

public void setCatchall(boolean isCatchall)
Sets whether or not this attribute set is the default "catchall" set.

Parameters:
isCatchall - true if this is the catchall set

getOrderIndex

public int getOrderIndex()
Returns the ordering index of this set within the list of all sets for this datasource. Returns AttributeSetManager.MAX_ORDER_INDEX if the index could not be parsed as an integer.

Returns:
the ordering index
See Also:
AttributeSetManager.MAX_ORDER_INDEX

setOrderIndex

public void setOrderIndex(int orderIndex)
Sets the ordering index of this set within the list of all sets for this datasource.

Parameters:
orderIndex - the ordering index

getType

public java.lang.String getType()
Returns "ATTR_SET"

Specified by:
getType in interface Metadata
Specified by:
getType in class MetadataObject
Returns:
the type of metadata this object represents
See Also:
Metadata.getType()