Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.endeca.portal.metadata.attributes
Class AttributeSetManager

    java.lang.Object
      com.endeca.portal.metadata.AbstractMetadataManager<AttributeSet>
          com.endeca.portal.metadata.attributes.AttributeSetManager

All Implemented Interfaces:
  MetadataManager<AttributeSet>

    public class AttributeSetManager

extends AbstractMetadataManager<AttributeSet>
implements MetadataManager<AttributeSet>

Encapsulates DB-interaction methods specific to attribute sets

Author:
  Endeca Technologies, Inc.

Field Summary
`static java.lang.String` | `DEFAULT_CATCHALL_NAME` Defines the default name for the "catchall" set
`static java.lang.String` | `FEATURE_CATCHALL` Represents the "catchall" feature for attribute sets
`static int` | `MAX_ORDER_INDEX` the order index (rel) to use if none is found or specified
`static java.lang.String` | `TYPE_ATTR_SET` Represents the "type" value for an attribute set
`static java.lang.String` | `TYPE_ATTRIBUTE_MAPPING_PROPERTY` Represents the "type" value for the attribute mapping property of an attribute set
`static java.lang.String` | `TYPE_DISPLAY_NAME_PROPERTY` Represents the "type" value for the display name property of an attribute set

Method Summary
`AttributeSet` | `addAttributeSet(java.lang.String attributeSetName, java.lang.String dataSourceId)` Adds a new attribute set for a given data source
`java.util.List<AttributeSet>` | `getAllAttributeSets()` Returns all attribute set metadata objects
`AttributeSet` | `getAttributeSetByFeature(java.lang.String dataSourceId, java.lang.String feature)` Returns an attribute set by feature for a specified data source
`AttributeSet` | `getAttributeSetById(long id)` Returns an attribute set metadata object by ID
`AttributeSet` | `getAttributeSetByName(java.lang.String dataSourceId, java.lang.String name)` Returns an attribute set by name for a specified data source
`java.util.List<AttributeSet>` | `getAttributeSetsByDataSource(java.lang.String dataSourceId)` Returns a list of attribute display names associated with a given data source.
`AttributeSet` | `getCatchallSet(java.lang.String dataSourceId)` Returns the "catchall" set for a given data source
`static AttributeSetManager` | `getInstance()` Gets a AttributeSetManager instance.
`AttributeSet` | `getOrSetAttributeSetByFeature(java.lang.String dataSourceId, java.lang.String feature, AttributeSet defaultAttrSet)` Returns an attribute set associated with a given data source, if it exists and writes (then returns) a specified record to the db otherwise
`AttributeSet` | `getOrSetAttributeSetByName(java.lang.String dataSourceId, java.lang.String name, AttributeSet defaultAttrSet)` Returns an attribute set associated with a given data source, if it exists and writes (then returns) a specified record to the db otherwise
`AttributeSet` | `getOrSetCatchallSet(java.lang.String dataSourceId)` Returns the "catchall" set for a given datasource, and creates a default one if it does not exist
`
`<S extends MetadataProperty> java.util.List<S>`
` | `getProperties(MetadataPropertyQuery query)` Retrieves a list of Metadata Properties from a Metadata Property Query
`void` | `handleObjectPropertyPersistence(AttributeSet sourceObject, AttributeSet returnObject)` Handles persistence processing for all properties associated with this object.
`AttributeSet` | `objectFromMetadataRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)` Given a base Liferay record, return a Metadata Object; subclasses must implement this method.
`AttributeSet` | `persist(AttributeSet attrSet)` Handles persistence processing for a single attribute sets.
`java.util.List<AttributeSet>` | `persist(java.util.List<AttributeSet> metadataObjectList)` Handles persistence processing for the list of attribute sets.
`
`<S extends MetadataProperty> java.util.List<S>`
` | `persistProperties(java.util.List<S> metadataPropertyList)` Writes a list of Metadata Properties to the database.
`
`<S extends MetadataProperty> S`
` | `propertyFromMetadataPropertyRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord record)` Returns the appropriate type of Metadata Property for the supplied base Liferay record.
`void` | `removeAttributeSetById(long attributeSetId)` Removes an attribute set by its ID

Methods inherited from class com.endeca.portal.metadata.AbstractMetadataManager
`getObject, getObjectById, getObjects, getProperty, objectsFromMetadataRecords, 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_SET

    public static final java.lang.String TYPE_ATTR_SET

  Represents the "type" value for an attribute set

  See Also:
    Constant Field Values

### TYPE_DISPLAY_NAME_PROPERTY

    public static final java.lang.String TYPE_DISPLAY_NAME_PROPERTY

  Represents the "type" value for the display name property of an attribute set

  See Also:
    Constant Field Values

### TYPE_ATTRIBUTE_MAPPING_PROPERTY

    public static final java.lang.String TYPE_ATTRIBUTE_MAPPING_PROPERTY

  Represents the "type" value for the attribute mapping property of an attribute set

  See Also:
    Constant Field Values

### FEATURE_CATCHALL

    public static final java.lang.String FEATURE_CATCHALL

  Represents the "catchall" feature for attribute sets

  See Also:
    Constant Field Values

### DEFAULT_CATCHALL_NAME

    public static final java.lang.String DEFAULT_CATCHALL_NAME

  Defines the default name for the "catchall" set

  See Also:
    Constant Field Values

### MAX_ORDER_INDEX

    public static final int MAX_ORDER_INDEX

  the order index (rel) to use if none is found or specified

  See Also:
    Constant Field Values

Method Detail

### getAttributeSetById

    public AttributeSet getAttributeSetById(long id)

  Returns an attribute set metadata object by ID

  Parameters:
    `id` - the attribute set ID
  Returns:
    the Attribute Set with the matching ID or null if none is found.

### getAllAttributeSets

    public java.util.List<AttributeSet> getAllAttributeSets()

  Returns all attribute set metadata objects

  Returns:
    the complete list of attribute sets

### getAttributeSetsByDataSource

    public java.util.List<AttributeSet> getAttributeSetsByDataSource(java.lang.String dataSourceId)

  Returns a list of attribute display names associated with a given data source. Note that this method always returns a catchall set; it will create one if it doesn't exist.

  Parameters:
    `dataSourceId` - the Data Source ID
  Returns:
    the list of attribute sets

### getAttributeSetByName

    public AttributeSet getAttributeSetByName(java.lang.String dataSourceId,
                                              java.lang.String name)

  Returns an attribute set by name for a specified data source

  Parameters:
    `dataSourceId` - the Data Source ID
    `name` - the name of the attribute set
  Returns:
    the attribute set object

### getAttributeSetByFeature

    public AttributeSet getAttributeSetByFeature(java.lang.String dataSourceId,
                                                 java.lang.String feature)

  Returns an attribute set by feature for a specified data source

  Parameters:
    `dataSourceId` - the Data Source ID
    `feature` - the feature of the attribute set
  Returns:
    the attribute set object

### getOrSetAttributeSetByName

    public AttributeSet getOrSetAttributeSetByName(java.lang.String dataSourceId,
                                                   java.lang.String name,
                                                   AttributeSet defaultAttrSet)
                                            throws MetadataException

  Returns an attribute set 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
    `name` - the name of the attribute set
    `defaultAttrSet` - the object to write if the attribute set was not found
  Returns:
    the attribute set that was created or retrieved
  Throws:
    `MetadataException`

### getOrSetAttributeSetByFeature

    public AttributeSet getOrSetAttributeSetByFeature(java.lang.String dataSourceId,
                                                      java.lang.String feature,
                                                      AttributeSet defaultAttrSet)
                                               throws MetadataException

  Returns an attribute set 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
    `feature` - the feature of the attribute set
    `defaultAttrSet` - the object to write if the attribute set was not found
  Returns:
    the attribute set that was created or retrieved
  Throws:
    `MetadataException`

### getCatchallSet

    public AttributeSet getCatchallSet(java.lang.String dataSourceId)

  Returns the "catchall" set for a given data source

  Parameters:
    `dataSourceId` - the Data Source ID
  Returns:
    the catchall set

### getOrSetCatchallSet

    public AttributeSet getOrSetCatchallSet(java.lang.String dataSourceId)
                                     throws MetadataException

  Returns the "catchall" set for a given datasource, and creates a default one if it does not exist

  Parameters:
    `dataSourceId` - the datasource
  Returns:
    the catchall set
  Throws:
    `MetadataException`

### addAttributeSet

    public AttributeSet addAttributeSet(java.lang.String attributeSetName,
                                        java.lang.String dataSourceId)
                                 throws MetadataException

  Adds a new attribute set for a given data source

  Parameters:
    `attributeSetName` - the name of the attribute set to create
    `dataSourceId` - the Data Source ID
  Returns:
    the persisted Attribute Set
  Throws:
    `MetadataException`

### removeAttributeSetById

    public void removeAttributeSetById(long attributeSetId)
                                throws MetadataException

  Removes an attribute set by its ID

  Parameters:
    `attributeSetId` - the attribute set's ID
  Throws:
    `MetadataException`

### handleObjectPropertyPersistence

    public void handleObjectPropertyPersistence(AttributeSet sourceObject,
                                                AttributeSet returnObject)
                                         throws MetadataException

  Handles persistence processing for all properties associated with this object. Sets the order (via the "rel" field) of each AttributeSetMapping property prior to persistence.

  Overrides:
    `handleObjectPropertyPersistence` in class `AbstractMetadataManager<AttributeSet>`
  Parameters:
    `sourceObject` - the object being persisted
    `returnObject` - the object that will be returned to the persistence caller
  Throws:
    `MetadataException`
  See Also:
    `AbstractMetadataManager.handleObjectPropertyPersistence(com.endeca.portal.metadata.MetadataObject, com.endeca.portal.metadata.MetadataObject)`

### persist

    public java.util.List<AttributeSet> persist(java.util.List<AttributeSet> metadataObjectList)
                                         throws MetadataException

  Handles persistence processing for the list of attribute sets. Sets the order of each AttributeSet and the order of each attribute in the set (via the "rel" field) prior to persistence.

  Overrides:
    `persist` in class `AbstractMetadataManager<AttributeSet>`
  Parameters:
    `metadataObjectList` - the list of Metadata Objects representing the records to be persisted
  Returns:
    the list persisted Metadata Objects
  Throws:
    `MetadataException` - if there was an error persisting the data
  See Also:
    `AbstractMetadataManager.persist(java.util.List)`

### persist

    public AttributeSet persist(AttributeSet attrSet)
                         throws MetadataException

  Handles persistence processing for a single attribute sets. Sets the order (via the "rel" field) of each attribute in the set prior to persistence.

  Overrides:
    `persist` in class `AbstractMetadataManager<AttributeSet>`
  Parameters:
    `attrSet` - the Metadata Object representing the record to be persisted
  Returns:
    the persisted Metadata Object
  Throws:
    `MetadataException` - if there was an error persisting the data
  See Also:
    `AbstractMetadataManager.persist(com.endeca.portal.metadata.MetadataObject)`

### persistProperties

    public <S extends MetadataProperty> java.util.List<S> persistProperties(java.util.List<S> metadataPropertyList)
                                                                 throws MetadataException

  Description copied from class: `AbstractMetadataManager`
  Writes a list of Metadata Properties to the database. This method is not transactional: if some of the records in the list fail during the persistence operation, this will not keep the other records in the list from being saved. When this happens, a MetadataException will be thrown, the message of which will list the IDs of the properties that failed.

  Overrides:
    `persistProperties` in class `AbstractMetadataManager<AttributeSet>`
  Type Parameters:
    `S` - an instance of a Metadata Property extension
  Parameters:
    `metadataPropertyList` - the list of Metadata Properties representing the records to be persisted
  Returns:
    the list persisted Metadata Properties
  Throws:
    `MetadataException` - if there was an error persisting the data

### getInstance

    public static AttributeSetManager getInstance()

  Gets a AttributeSetManager instance. Currently creates a new instance every time, but could be modified to work from a singleton.

  Returns:
    the instance

### objectFromMetadataRecord

    public AttributeSet 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<AttributeSet>`
  Specified by:
    `objectFromMetadataRecord` in class `AbstractMetadataManager<AttributeSet>`
  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 the appropriate type of Metadata Property for the supplied base Liferay record.

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

### getProperties

    public <S extends MetadataProperty> java.util.List<S> getProperties(MetadataPropertyQuery query)

  Description copied from class: `AbstractMetadataManager`
  Retrieves a list of Metadata Properties from a Metadata Property Query

  Overrides:
    `getProperties` in class `AbstractMetadataManager<AttributeSet>`
  Type Parameters:
    `S` - class of the metadata property associated with the object managed by this manager
  Parameters:
    `query` - the query
  Returns:
    a list of Metadata Properties

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD