T
- class of the metadata object managed by this managerpublic abstract class AbstractMetadataManager<T extends MetadataObject> extends java.lang.Object implements MetadataManager<T>
MetadataObject
.Constructor and Description |
---|
AbstractMetadataManager() |
Modifier and Type | Method and Description |
---|---|
java.util.List<com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord> |
getMetadataPropertyRecords(MetadataPropertyQuery propertyQuery)
Retrieves the properties for a given object.
|
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> |
getProperties(MetadataPropertyQuery query)
Retrieves a list of Metadata Properties from a Metadata Property Query
|
<S extends MetadataProperty> |
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 boolean |
hasProperties()
Return true to indicate that this MetadataManager class works with MetadataObjects that have associated MetadataProperties.
|
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> |
persistProperties(java.util.List<S> metadataPropertyList)
Writes a list of Metadata Properties to the database.
|
<S extends MetadataProperty> |
persistProperty(S metadataProperty)
Persists a Metadata Property to the database
|
<S extends MetadataProperty> |
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> |
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
|
MetadataPropertyQuery |
setupPropertyQuery(MetadataPropertyQuery propertyQuery)
Called by getMetadataPropertyRecords and getProperties to massage the SQL query before execution.
|
public T getObjectById(long objectId)
objectId
- the object IDpublic T getObject(MetadataObjectQuery query)
query
- the querypublic java.util.List<T> getObjects(MetadataObjectQuery query)
query
- the querypublic void removeObjectById(long objectId) throws MetadataException
objectId
- the object IDMetadataException
public <S extends MetadataProperty> S getProperty(MetadataPropertyQuery query)
S
- class of the metadata property associated with the object managed by this managerquery
- the querypublic <S extends MetadataProperty> java.util.List<S> getProperties(MetadataPropertyQuery query)
S
- class of the metadata property associated with the object managed by this managerquery
- the querypublic void removePropertyById(long propertyId) throws MetadataException
propertyId
- the property IDMetadataException
public T persist(T metadataObject) throws MetadataException
metadataObject
- the Metadata Object representing the record to be persistedMetadataException
- if there was an error persisting the datapublic java.util.List<T> persist(java.util.List<T> metadataObjectList) throws MetadataException
metadataObjectList
- the list of Metadata Objects representing the records to be persistedMetadataException
- if there was an error persisting the datapublic void handleObjectPropertyPersistence(T sourceObject, T returnObject) throws MetadataException, com.liferay.portal.SystemException
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.sourceObject
- the object being persistedreturnObject
- the object that will be returned to the persistence callerMetadataException
com.liferay.portal.SystemException
public <S extends MetadataProperty> S persistProperty(S metadataProperty) throws MetadataException
S
- an instance of a Metadata Property extensionmetadataProperty
- the Metadata Property representing the record to be persistedMetadataException
- if there was an error persisting the datapublic <S extends MetadataProperty> java.util.List<S> persistProperties(java.util.List<S> metadataPropertyList) throws MetadataException
S
- an instance of a Metadata Property extensionmetadataPropertyList
- the list of Metadata Properties representing the records to be persistedMetadataException
- if there was an error persisting the datapublic abstract T objectFromMetadataRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataRecord record)
objectFromMetadataRecord
in interface MetadataManager<T extends MetadataObject>
record
- the base Liferay recordMetadataManager.objectFromMetadataRecord(MetadataRecord)
public java.util.List<T> objectsFromMetadataRecords(java.util.List<com.endeca.portal.liferay.ext.metadata.model.MetadataRecord> records)
records
- the list of base Liferay recordspublic abstract <S extends MetadataProperty> S propertyFromMetadataPropertyRecord(com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord record)
propertyFromMetadataPropertyRecord
in interface MetadataManager<T extends MetadataObject>
S
- an instance of a Metadata Property extensionrecord
- the base Liferay recordMetadataManager.propertyFromMetadataPropertyRecord(MetadataPropertyRecord)
public abstract boolean hasProperties()
public <S extends MetadataProperty> java.util.List<S> propertiesFromMetadataPropertyRecords(java.util.List<com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord> records)
S
- an instance of a Metadata Property extensionrecords
- the list of base Liferay recordspublic java.util.List<com.endeca.portal.liferay.ext.metadata.model.MetadataPropertyRecord> getMetadataPropertyRecords(MetadataPropertyQuery propertyQuery) throws MetadataQueryException
propertyQuery
- MetadataQueryException
public MetadataPropertyQuery setupPropertyQuery(MetadataPropertyQuery propertyQuery)
propertyQuery
- the base queryCopyright 2003, 2014, Oracle and/or its affiliates. All rights reserved.