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
Class AbstractMetadataManager<T extends MetadataObject>

    java.lang.Object
      com.endeca.portal.metadata.AbstractMetadataManager<T>

Type Parameters:
  `T` - class of the metadata object managed by this manager

All Implemented Interfaces:
  MetadataManager<T>

Direct Known Subclasses:
  AttributeDisplayNameManager, AttributeSetManager, FrameworkSettingManager, SimpleMetadataManager

    public abstract class AbstractMetadataManager<T extends MetadataObject>

extends java.lang.Object
implements MetadataManager<T>

Central facade for managing low-level Metadata Objects and Properties. Each extension of this class is responsible for managing objects of a class that implements `MetadataObject`.

Author:
  Endeca Technologies, Inc.

Constructor Summary
`AbstractMetadataManager()`

Method Summary
`T` | `getObject(MetadataObjectQuery query)` Retrieves a Metadata Object from a Metadata Object Query.
`T` | `getObjectById(long objectId)` Retrieves a Metadata Object by its object ID
`java.util.List<T>` | `getObjects(MetadataObjectQuery query)` Retrieves a list of Metadata Objects from a Metadata Object Query
`
`<S extends MetadataProperty> java.util.List<S>`
` | `getProperties(MetadataPropertyQuery query)` Retrieves a list of Metadata Properties from a Metadata Property Query
`
`<S extends MetadataProperty> S`
` | `getProperty(MetadataPropertyQuery query)` Retrieves a Metadata Property from a Metadata Property Query.
`void` | `handleObjectPropertyPersistence(T sourceObject, T returnObject)` Processes a Metadata Object's list of Metadata Properties during persistence.
`abstract T` | `objectFromMetadataRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)` Given a base Liferay record, return a Metadata Object; subclasses must implement this method.
`java.util.List<T>` | `objectsFromMetadataRecords(java.util.List<com.endeca.portal.liferay.ext.metadata.model.MetadataRecord> records)` Given a list of base Liferay records, return a list of Metadata Objects in the same order.
`java.util.List<T>` | `persist(java.util.List<T> metadataObjectList)` Writes a list of Metadata Objects to the database.
`T` | `persist(T metadataObject)` Persists a Metadata Object to the database
`
`<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`
` | `persistProperty(S metadataProperty)` Persists a Metadata Property to the database
`
`<S extends MetadataProperty> java.util.List<S>`
` | `propertiesFromMetadataPropertyRecords(java.util.List<com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord> records)` Given a list of base Liferay records, return a list of Metadata Properties in the same order.
`abstract
`<S extends MetadataProperty> S`
` | `propertyFromMetadataPropertyRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord record)` Given a base Liferay record, return a Metadata Property; subclasses must implement this method.
`void` | `removeObjectById(long objectId)` Removes an Metadata Object by it's unique identifier, the object ID.
`void` | `removePropertyById(long propertyId)` Removes an Metadata Property by it's unique identifier, the property ID

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractMetadataManager

    public AbstractMetadataManager()

Method Detail

### getObjectById

    public T getObjectById(long objectId)

  Retrieves a Metadata Object by its object ID

  Parameters:
    `objectId` - the object ID
  Returns:
    the Metadata Object with the matching ID or null if none is found.

### getObject

    public T getObject(MetadataObjectQuery query)

  Retrieves a Metadata Object from a Metadata Object Query. If the query retrieves more than one record, the first one will be returned.

  Parameters:
    `query` - the query
  Returns:
    the first Metadata Object retrieved by the query, or null if none is found.

### getObjects

    public java.util.List<T> getObjects(MetadataObjectQuery query)

  Retrieves a list of Metadata Objects from a Metadata Object Query

  Parameters:
    `query` - the query
  Returns:
    a list of Metadata Objects

### removeObjectById

    public void removeObjectById(long objectId)
                          throws MetadataException

  Removes an Metadata Object by it's unique identifier, the object ID. Also removes all properties associated with the object.

  Parameters:
    `objectId` - the object ID
  Throws:
    `MetadataException`

### getProperty

    public <S extends MetadataProperty> S getProperty(MetadataPropertyQuery query)

  Retrieves a Metadata Property from a Metadata Property Query. If the query retrieves more than one record, the first one will be returned

  Type Parameters:
    `S` - class of the metadata property associated with the object managed by this manager
  Parameters:
    `query` - the query
  Returns:
    the first Metadata Property retrieved by the query, or null if none is found.

### getProperties

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

  Retrieves a list of Metadata Properties from a Metadata Property Query

  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

### removePropertyById

    public void removePropertyById(long propertyId)
                            throws MetadataException

  Removes an Metadata Property by it's unique identifier, the property ID

  Parameters:
    `propertyId` - the property ID
  Throws:
    `MetadataException`

### persist

    public T persist(T metadataObject)
                                     throws MetadataException

  Persists a Metadata Object to the database

  Parameters:
    `metadataObject` - the Metadata Object representing the record to be persisted
  Returns:
    the persisted Metadata Object
  Throws:
    `MetadataException` - if there was an error persisting the data

### persist

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

  Writes a list of Metadata Objects 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 objects that failed.

  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

### handleObjectPropertyPersistence

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

  Processes a Metadata Object's list of Metadata Properties during persistence. This method is called from `persist(MetadataObject)` and is intended to be overridden by subclasses for special handling of the Metadata Properties associated with the object being persisted. The default behavior is to iterate over each property, call `persistProperty(MetadataProperty)` and add the result of the property persistence to the return object.

  Parameters:
    `sourceObject` - the object being persisted
    `returnObject` - the object that will be returned to the persistence caller
  Throws:
    `MetadataException`

### persistProperty

    public <S extends MetadataProperty> S persistProperty(S metadataProperty)
                                               throws MetadataException

  Persists a Metadata Property to the database

  Type Parameters:
    `S` - an instance of a Metadata Property extension
  Parameters:
    `metadataProperty` - the Metadata Property representing the record to be persisted
  Returns:
    the persisted Metadata Property
  Throws:
    `MetadataException` - if there was an error persisting the data

### persistProperties

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

  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.

  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

### objectFromMetadataRecord

    public abstract T objectFromMetadataRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)

  Given a base Liferay record, return a Metadata Object; subclasses must implement this method.

  Specified by:
    `objectFromMetadataRecord` in interface `MetadataManager<T extends MetadataObject>`
  Parameters:
    `record` - the base Liferay record
  Returns:
    the Metadata Object
  See Also:
    `MetadataManager.objectFromMetadataRecord(MetadataRecord)`

### objectsFromMetadataRecords

    public java.util.List<T> objectsFromMetadataRecords(java.util.List<com.endeca.portal.liferay.ext.metadata.model.MetadataRecord> records)

  Given a list of base Liferay records, return a list of Metadata Objects in the same order.

  Parameters:
    `records` - the list of base Liferay records
  Returns:
    the list of Metadata Objects

### propertyFromMetadataPropertyRecord

    public abstract <S extends MetadataProperty> S propertyFromMetadataPropertyRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord record)

  Given a base Liferay record, return a Metadata Property; subclasses must implement this method.

  Specified by:
    `propertyFromMetadataPropertyRecord` in interface `MetadataManager<T extends MetadataObject>`
  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)`

### propertiesFromMetadataPropertyRecords

    public <S extends MetadataProperty> java.util.List<S> propertiesFromMetadataPropertyRecords(java.util.List<com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord> records)

  Given a list of base Liferay records, return a list of Metadata Properties in the same order.

  Type Parameters:
    `S` - an instance of a Metadata Property extension
  Parameters:
    `records` - the list of base Liferay records
  Returns:
    the 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