Package org.alfresco.repo.domain.propval
Class AbstractPropertyValueDAOImpl
java.lang.Object
org.alfresco.repo.domain.propval.AbstractPropertyValueDAOImpl
- All Implemented Interfaces:
PropertyValueDAO
- Direct Known Subclasses:
PropertyValueDAOImpl
Abstract implementation for Property Value DAO.
This provides basic services such as caching, but defers to the underlying implementation for CRUD operations.
- Since:
- 3.2
- Author:
- Derek Hulley
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classKey for PropertyUniqueContext cacheNested classes/interfaces inherited from interface org.alfresco.repo.domain.propval.PropertyValueDAO
PropertyValueDAO.PropertyFinderCallback, PropertyValueDAO.PropertyUniqueContextCallback -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ControlDAOprotected PropertyTypeConverterprotected final org.apache.commons.logging.Log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected SerializableconstructEmptyContainer(Class<?> clazz) Returns a reconstructable instanceUtility method to convert property query results into the original value.protected abstract PropertyClassEntitycreateClass(Class<?> value) protected abstract PropertyDateValueEntitycreateDateValue(Date value) protected abstract PropertyDoubleValueEntitycreateDoubleValue(Double value) createProperty(Serializable value) Use for accessing non-unique, exploded properties; see interface comments.protected abstract voidcreatePropertyLink(Long rootPropId, Long propIndex, Long containedIn, Long keyPropId, Long valuePropId) Create an entry for the map or collection link.protected abstract LongFOR INTERNAL USE ONLY: Do not use directly; see interface comments.createPropertyUniqueContext(Serializable value1, Serializable value2, Serializable value3, Serializable propertyValue1) alf_prop_unique_ctx accessor: create a unique context with an optional associated value.protected abstract PropertyUniqueContextEntitycreatePropertyUniqueContext(Long valueId1, Long valueId2, Long valueId3, Long propertyId) protected abstract PropertyValueEntitycreatePropertyValue(Serializable value) protected abstract PropertySerializableValueEntityprotected abstract LongcreateStringValue(String value) voiddeleteProperty(Long id) Use for accessing non-unique, exploded properties; see interface comments.protected abstract intdeletePropertyLinks(Long rootPropId) Remove all property links for a given property root.protected abstract voidintdeletePropertyUniqueContext(Serializable... values) Delete sets of unique contexts based on one, two or three context values.protected abstract intdeletePropertyUniqueContexts(Long... valueIds) protected abstract PropertyClassEntityfindClassById(Long id) protected abstract PropertyClassEntityfindClassByValue(Class<?> value) protected abstract PropertyDateValueEntityprotected abstract PropertyDateValueEntityfindDateValueByValue(Date value) protected abstract PropertyDoubleValueEntityprotected abstract PropertyDoubleValueEntityfindDoubleValueByValue(Double value) protected abstract voidfindPropertiesByIds(List<Long> ids, PropertyValueDAO.PropertyFinderCallback callback) protected abstract List<PropertyIdSearchRow>findPropertyById(Long id) protected abstract PropertyValueEntityprotected abstract PropertyValueEntityprotected abstract PropertySerializableValueEntityprotected abstract Stringprotected abstract LongfindStringValueByValue(String value) getOrCreatePropertyClass(Class<?> value) FOR INTERNAL USE ONLY: Do not use directly; see interface comments.getOrCreatePropertyDateValue(Date value) FOR INTERNAL USE ONLY: Do not use directly; see interface comments.FOR INTERNAL USE ONLY: Do not use directly; see interface comments.FOR INTERNAL USE ONLY: Do not use directly; see interface comments.Use for accessing unique properties; see interface comments.voidgetPropertiesByIds(List<Long> ids, PropertyValueDAO.PropertyFinderCallback callback) Use for accessing non-unique, exploded properties; see interface comments.getPropertyById(Long id) Use for accessing non-unique, exploded properties; see interface comments.getPropertyClass(Class<?> value) FOR INTERNAL USE ONLY: Do not use directly; see interface comments.FOR INTERNAL USE ONLY: Do not use directly; see interface comments.getPropertyDateValue(Date value) FOR INTERNAL USE ONLY: Do not use directly; see interface comments.FOR INTERNAL USE ONLY: Do not use directly; see interface comments.getPropertyDoubleValue(Double value) FOR INTERNAL USE ONLY: Do not use directly; see interface comments.FOR INTERNAL USE ONLY: Do not use directly; see interface comments.protected abstract PropertyRootEntitygetPropertyRoot(Long id) FOR INTERNAL USE ONLY: Do not use directly; see interface comments.Utility method to get query parameters for case-sensitive string searchinggetPropertyStringValue(String value) FOR INTERNAL USE ONLY: Do not use directly; see interface comments.FOR INTERNAL USE ONLY: Do not use directly; see interface comments.getPropertyUniqueContext(Serializable value1, Serializable value2, Serializable value3) Get the unique context ID and associated shared property ID, or null if no such context exists.voidgetPropertyUniqueContext(PropertyValueDAO.PropertyUniqueContextCallback callback, Serializable... values) Get unique contexts (unique context ID and associated shared property ID), if any, based on one, two or three context values.protected abstract PropertyUniqueContextEntityprotected abstract PropertyUniqueContextEntitygetPropertyUniqueContextByValues(Long valueId1, Long valueId2, Long valueId3) protected abstract voidgetPropertyUniqueContextByValues(PropertyValueDAO.PropertyUniqueContextCallback callback, Long... valueIds) getPropertyValue(Serializable value) Use for accessing unique properties; see interface comments.Use for accessing unique properties; see interface comments.voidsetControlDAO(ControlDAO controlDAO) voidsetConverter(PropertyTypeConverter converter) voidsetPropertyCache(SimpleCache<Serializable, Object> propertyCache) Set the cache to use for alf_prop_root lookups (optional).voidsetPropertyClassCache(SimpleCache<Serializable, Object> propertyClassCache) Set the cache to use for alf_prop_class lookups (optional).voidsetPropertyDateValueCache(SimpleCache<Serializable, Object> propertyDateValueCache) Set the cache to use for alf_prop_date_value lookups (optional).voidsetPropertyDoubleValueCache(SimpleCache<Serializable, Object> propertyDoubleValueCache) Set the cache to use for alf_prop_double_value lookups (optional).voidsetPropertySerializableValueCache(SimpleCache<Serializable, Object> propertySerializableValueCache) Set the cache to use for alf_prop_serializable_value lookups (optional).voidsetPropertyStringValueCache(SimpleCache<Serializable, Object> propertyStringValueCache) Set the cache to use for alf_prop_string_value lookups (optional).voidsetPropertyUniqueContextCache(SimpleCache<AbstractPropertyValueDAOImpl.CachePucKey, PropertyUniqueContextEntity> propertyUniqueContextCache) Set the cache to use for unique property lookupsvoidsetPropertyValueCache(SimpleCache<Serializable, Object> propertyValueCache) Set the cache to use for alf_prop_value lookups (optional).voidsetUniquenessCheckEnabled(boolean uniquenessCheckEnabled) Setter for uniquenessCheckEnabled flagvoidupdateProperty(Long rootPropId, Serializable value) Use for accessing non-unique, exploded properties; see interface comments.protected abstract PropertyRootEntityupdatePropertyRoot(PropertyRootEntity entity) voidupdatePropertyUniqueContext(Serializable value1, Serializable value2, Serializable value3, Serializable propertyValue) Update the property associated with a unique context (based on one, two or three context values).protected abstract PropertyUniqueContextEntityvoidupdatePropertyUniqueContextKeys(Long id, Serializable value1, Serializable value2, Serializable value3) Update the unique context, preserving any associated property.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.alfresco.repo.domain.propval.PropertyValueDAO
cleanupUnusedValues, cleanupUnusedValuesV2, cleanupUnusedValuesV3, deletePropertyUniqueContext
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger -
converter
-
controlDAO
-
-
Constructor Details
-
AbstractPropertyValueDAOImpl
public AbstractPropertyValueDAOImpl()Default constructor.This sets up the DAO accessors to bypass any caching to handle the case where the caches are not supplied in the setters.
-
-
Method Details
-
setUniquenessCheckEnabled
public void setUniquenessCheckEnabled(boolean uniquenessCheckEnabled) Setter for uniquenessCheckEnabled flag -
setPropertyUniqueContextCache
public void setPropertyUniqueContextCache(SimpleCache<AbstractPropertyValueDAOImpl.CachePucKey, PropertyUniqueContextEntity> propertyUniqueContextCache) Set the cache to use for unique property lookups -
setConverter
- Parameters:
converter- the converter that translates between external and persisted values
-
setControlDAO
- Parameters:
controlDAO- the DAO that provides connection control
-
setPropertyClassCache
Set the cache to use for alf_prop_class lookups (optional).- Parameters:
propertyClassCache- the cache of IDs to property classes
-
setPropertyDateValueCache
Set the cache to use for alf_prop_date_value lookups (optional).- Parameters:
propertyDateValueCache- the cache of IDs to property values
-
setPropertyStringValueCache
Set the cache to use for alf_prop_string_value lookups (optional).- Parameters:
propertyStringValueCache- the cache of IDs to property string values
-
setPropertyDoubleValueCache
Set the cache to use for alf_prop_double_value lookups (optional).- Parameters:
propertyDoubleValueCache- the cache of IDs to property values
-
setPropertySerializableValueCache
public void setPropertySerializableValueCache(SimpleCache<Serializable, Object> propertySerializableValueCache) Set the cache to use for alf_prop_serializable_value lookups (optional).- Parameters:
propertySerializableValueCache- the cache of IDs to property values
-
setPropertyValueCache
Set the cache to use for alf_prop_value lookups (optional).- Parameters:
propertyValueCache- the cache of IDs to property values
-
setPropertyCache
Set the cache to use for alf_prop_root lookups (optional).- Parameters:
propertyCache- the cache of IDs to property values
-
getPropertyClassById
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_class accessor- Specified by:
getPropertyClassByIdin interfacePropertyValueDAO- Parameters:
id- the ID (may not be null)
-
getPropertyClass
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_class accessor- Specified by:
getPropertyClassin interfacePropertyValueDAO- Parameters:
value- the value to find the ID for (may not be null)
-
getOrCreatePropertyClass
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_class accessor- Specified by:
getOrCreatePropertyClassin interfacePropertyValueDAO- Parameters:
value- the value to find the ID for (may not be null)
-
findClassById
-
findClassByValue
-
createClass
-
getPropertyDateValueById
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_date_value accessor- Specified by:
getPropertyDateValueByIdin interfacePropertyValueDAO- Parameters:
id- the ID (may not be null)
-
getPropertyDateValue
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_date_value accessor- Specified by:
getPropertyDateValuein interfacePropertyValueDAO- Parameters:
value- the value to find the ID for (may not be null)
-
getOrCreatePropertyDateValue
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_date_value accessor- Specified by:
getOrCreatePropertyDateValuein interfacePropertyValueDAO- Parameters:
value- the value to find the ID for (may not be null)
-
findDateValueById
-
findDateValueByValue
- Parameters:
value- a date, accurate to the day
-
createDateValue
- Parameters:
value- a date, accurate to the day
-
getPropertyStringCaseSensitiveSearchParameters
Description copied from interface:PropertyValueDAOUtility method to get query parameters for case-sensitive string searching- Specified by:
getPropertyStringCaseSensitiveSearchParametersin interfacePropertyValueDAO- See Also:
-
getPropertyStringValueById
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_string_value accessor- Specified by:
getPropertyStringValueByIdin interfacePropertyValueDAO- Parameters:
id- the ID (may not be null)
-
getPropertyStringValue
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_string_value accessor- Specified by:
getPropertyStringValuein interfacePropertyValueDAO- Parameters:
value- the value to find the ID for (may not be null)
-
getOrCreatePropertyStringValue
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_string_value accessor- Specified by:
getOrCreatePropertyStringValuein interfacePropertyValueDAO- Parameters:
value- the value to find the ID for (may not be null)
-
findStringValueById
-
findStringValueByValue
-
createStringValue
-
getPropertyDoubleValueById
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_double_value accessor- Specified by:
getPropertyDoubleValueByIdin interfacePropertyValueDAO- Parameters:
id- the ID (may not be null)
-
getPropertyDoubleValue
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_double_value accessor- Specified by:
getPropertyDoubleValuein interfacePropertyValueDAO- Parameters:
value- the value to find the ID for (may not be null)
-
getOrCreatePropertyDoubleValue
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_double_value accessor- Specified by:
getOrCreatePropertyDoubleValuein interfacePropertyValueDAO- Parameters:
value- the value to find the ID for (may not be null)
-
findDoubleValueById
-
findDoubleValueByValue
-
createDoubleValue
-
getPropertySerializableValueById
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_serializable_value accessor- Specified by:
getPropertySerializableValueByIdin interfacePropertyValueDAO- Parameters:
id- the ID (may not be null)
-
createPropertySerializableValue
Description copied from interface:PropertyValueDAOFOR INTERNAL USE ONLY: Do not use directly; see interface comments. alf_prop_serializable_value accessor- Specified by:
createPropertySerializableValuein interfacePropertyValueDAO- Parameters:
value- the value to find the ID for (may not be null)
-
findSerializableValueById
-
createSerializableValue
-
getPropertyValueById
Description copied from interface:PropertyValueDAOUse for accessing unique properties; see interface comments. alf_prop_value accessor: get a property based on the database ID- Specified by:
getPropertyValueByIdin interfacePropertyValueDAO- Parameters:
id- the ID (may not be null)
-
getPropertyValue
Description copied from interface:PropertyValueDAOUse for accessing unique properties; see interface comments. alf_prop_value accessor: find a property based on the value- Specified by:
getPropertyValuein interfacePropertyValueDAO- Parameters:
value- the value to find the ID for (may be null)
-
getOrCreatePropertyValue
Description copied from interface:PropertyValueDAOUse for accessing unique properties; see interface comments. alf_prop_value accessor: find or create a property based on the value. Note: This method will not recurse into maps or collections. Use the dedicated methods if you want recursion; otherwise maps and collections will be serialized and probably stored as BLOB values. All collections and maps will be opened up to any depth.- Specified by:
getOrCreatePropertyValuein interfacePropertyValueDAO- Parameters:
value- the value to find the ID for (may be null)
-
findPropertyValueById
-
findPropertyValueByValue
-
createPropertyValue
-
getPropertyById
Description copied from interface:PropertyValueDAOUse for accessing non-unique, exploded properties; see interface comments. alf_prop_root accessor: get a property based on the database ID- Specified by:
getPropertyByIdin interfacePropertyValueDAO- Parameters:
id- the ID (may not be null)- Returns:
- Returns the value of the property (never null)
-
getPropertiesByIds
Description copied from interface:PropertyValueDAOUse for accessing non-unique, exploded properties; see interface comments. alf_prop_root accessor: get all properties based on the database IDs- Specified by:
getPropertiesByIdsin interfacePropertyValueDAO- Parameters:
ids- the IDs (may not be null; may be empty)callback- the callback to handle the results
-
createProperty
Use for accessing non-unique, exploded properties; see interface comments. alf_prop_root accessor: find or create a property based on the value. All collections and maps will be opened up to any depth.- Specified by:
createPropertyin interfacePropertyValueDAO- Parameters:
value- the value to create (may be null)- Returns:
- Returns the new property's ID
- See Also:
-
createPropertyImpl(Long, long, long, Long, Serializable)
-
updateProperty
Description copied from interface:PropertyValueDAOUse for accessing non-unique, exploded properties; see interface comments. alf_prop_root accessor: update the property root to contain a new value.- Specified by:
updatePropertyin interfacePropertyValueDAO- Parameters:
rootPropId- the ID of the root property to changevalue- the new property value
-
deleteProperty
Description copied from interface:PropertyValueDAOUse for accessing non-unique, exploded properties; see interface comments. alf_prop_root accessor: delete a property root completely- Specified by:
deletePropertyin interfacePropertyValueDAO- Parameters:
id- the ID of the root property to delete
-
constructEmptyContainer
Returns a reconstructable instance- Returns:
- Returns an empty instance of the given container (map or collection), or null if it is not possible to do
-
findPropertyById
-
findPropertiesByIds
protected abstract void findPropertiesByIds(List<Long> ids, PropertyValueDAO.PropertyFinderCallback callback) -
createPropertyRoot
-
getPropertyRoot
-
updatePropertyRoot
-
deletePropertyRoot
-
createPropertyLink
protected abstract void createPropertyLink(Long rootPropId, Long propIndex, Long containedIn, Long keyPropId, Long valuePropId) Create an entry for the map or collection link.- Parameters:
rootPropId- the root (entry-point) property IDpropIndex- the property number within the root propertycontainedIn- the property that contains the current valuekeyPropId- the map key entity ID or collection position countvaluePropId- the ID of the entity storing the value (may be another map or collection)
-
deletePropertyLinks
Remove all property links for a given property root.- Parameters:
rootPropId- the root (entry-point) property ID
-
createPropertyUniqueContext
public Pair<Long,Long> createPropertyUniqueContext(Serializable value1, Serializable value2, Serializable value3, Serializable propertyValue1) Description copied from interface:PropertyValueDAOalf_prop_unique_ctx accessor: create a unique context with an optional associated value. The DAO ensures that the region-context-value combination will be globally unique.- Specified by:
createPropertyUniqueContextin interfacePropertyValueDAO- Parameters:
value1- a simple key value (not a collection) (may be null)value2- a simple key value (not a collection) (may be null)value3- a simple key value (not a collection) (may be null)propertyValue1- a value to store against the key (may be null)- Returns:
- Returns the ID-valueId pair of the context
-
getPropertyUniqueContext
public Pair<Long,Long> getPropertyUniqueContext(Serializable value1, Serializable value2, Serializable value3) Description copied from interface:PropertyValueDAOGet the unique context ID and associated shared property ID, or null if no such context exists. The associated property may be null even if the unique context exists.- Specified by:
getPropertyUniqueContextin interfacePropertyValueDAO- Parameters:
value1- first valuevalue2- second valuevalue3- third value- Returns:
- Returns the ID-valueId pair or null if the context doesn't exist.
- See Also:
-
getPropertyUniqueContext
public void getPropertyUniqueContext(PropertyValueDAO.PropertyUniqueContextCallback callback, Serializable... values) Description copied from interface:PropertyValueDAOGet unique contexts (unique context ID and associated shared property ID), if any, based on one, two or three context values. The associated property may be null even if the unique context exists.- Specified by:
getPropertyUniqueContextin interfacePropertyValueDAOvalues- a combination of one to three values in order- See Also:
-
updatePropertyUniqueContextKeys
public void updatePropertyUniqueContextKeys(Long id, Serializable value1, Serializable value2, Serializable value3) Description copied from interface:PropertyValueDAOUpdate the unique context, preserving any associated property.- Specified by:
updatePropertyUniqueContextKeysin interfacePropertyValueDAO- See Also:
-
updatePropertyUniqueContext
public void updatePropertyUniqueContext(Serializable value1, Serializable value2, Serializable value3, Serializable propertyValue) Description copied from interface:PropertyValueDAOUpdate the property associated with a unique context (based on one, two or three context values).- Specified by:
updatePropertyUniqueContextin interfacePropertyValueDAO- See Also:
-
deletePropertyUniqueContext
Description copied from interface:PropertyValueDAODelete sets of unique contexts based on one, two or three context values.- Specified by:
deletePropertyUniqueContextin interfacePropertyValueDAO- Parameters:
values- a combination of one to three values in order- Returns:
- Returns the number of unique contexts deleted
-
createPropertyUniqueContext
protected abstract PropertyUniqueContextEntity createPropertyUniqueContext(Long valueId1, Long valueId2, Long valueId3, Long propertyId) -
getPropertyUniqueContextById
-
getPropertyUniqueContextByValues
protected abstract PropertyUniqueContextEntity getPropertyUniqueContextByValues(Long valueId1, Long valueId2, Long valueId3) -
getPropertyUniqueContextByValues
protected abstract void getPropertyUniqueContextByValues(PropertyValueDAO.PropertyUniqueContextCallback callback, Long... valueIds) -
updatePropertyUniqueContext
protected abstract PropertyUniqueContextEntity updatePropertyUniqueContext(PropertyUniqueContextEntity entity) -
deletePropertyUniqueContexts
-
convertPropertyIdSearchRows
Description copied from interface:PropertyValueDAOUtility method to convert property query results into the original value. Note that the rows must all share the same root property ID. If the rows passed in don't constitute a valid, full property - they don't contain all the link entities for the property - then the result may be null.- Specified by:
convertPropertyIdSearchRowsin interfacePropertyValueDAO- Parameters:
rows- the search results for a single root property- Returns:
- Returns the root property as originally persisted, or null if the rows don't represent a complete property
-
clearCaches
protected void clearCaches()
-