Class AbstractContentDataDAOImpl
java.lang.Object
org.alfresco.repo.domain.contentdata.AbstractContentDataDAOImpl
- All Implemented Interfaces:
ContentDataDAO
- Direct Known Subclasses:
ContentDataDAOImpl
Abstract implementation for ContentData DAO.
This provides basic services such as caching, but defers to the underlying implementation for CRUD operations.
The DAO deals in ContentData instances. The cache is primarily present to decode
IDs into ContentData instances.
- Since:
- 3.2
- Author:
- Derek Hulley, sglover
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassTransactional listener that deletes unreferenced content_url entities.Nested classes/interfaces inherited from interface org.alfresco.repo.domain.contentdata.ContentDataDAO
ContentDataDAO.ContentUrlHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ControlDAOprotected EncodingDAOprotected LocaleDAOprotected MimetypeDAO -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcacheContentDataForNodes(Set<Long> nodeIds) createContentData(ContentData contentData) Create a new ContentData instance.protected abstract ContentDataEntitycreateContentDataEntity(Long contentUrlId, Long mimetypeId, Long encodingId, Long localeId) Create the row for the alf_content_dataprotected ContentDataEntitycreateContentDataEntity(ContentData contentData) Translates theContentDatainto persistable values using the helper DAOsprotected abstract ContentUrlEntitycreateContentUrlEntity(String contentUrl, long size, ContentUrlKeyEntity contentUrlKey) voidDelete an instance of content.protected abstract intDelete the entity with the given IDprotected abstract intdeleteContentUrlEntity(long id) getContentData(Long id) protected abstract List<ContentDataEntity>getContentDataEntitiesForNodes(Set<Long> nodeIds) protected abstract ContentDataEntitygetContentUrl(Long contentUrlId) Get a content url entity by contentUrlIdgetContentUrl(String contentUrl) Get a content url entity by contentUrlprotected abstract ContentUrlEntityprotected abstract ContentUrlEntitygetContentUrlEntity(String contentUrl) protected abstract ContentUrlEntitygetContentUrlEntityUnreferenced(String contentUrl) getOrCreateContentUrl(String contentUrl) Get a content URL or create one if it does not existgetOrCreateContentUrl(String contentUrl, long size) Get a content URL or create one if it does not existprotected voidregisterDereferencedContentUrl(String contentUrl) A content_url entity was dereferenced.voidsetContentDataCache(SimpleCache<Long, ContentData> contentDataCache) voidsetContentStoreCleaner(EagerContentStoreCleaner contentStoreCleaner) Set this property to enable eager cleanup of orphaned content.voidsetContentUrlCache(SimpleCache<Long, ContentUrlEntity> contentUrlCache) voidsetControlDAO(ControlDAO controlDAO) voidsetEncodingDAO(EncodingDAO encodingDAO) voidsetLocaleDAO(LocaleDAO localeDAO) voidsetMimetypeDAO(MimetypeDAO mimetypeDAO) voidupdateContentData(Long id, ContentData contentData) Update a content data instanceprotected abstract intUpdate an existing alf_content_data entityprotected intupdateContentDataEntity(ContentDataEntity contentDataEntity, ContentData contentData) Translates theContentDatainto persistable values using the helper DAOsprotected abstract intupdateContentUrlEntity(ContentUrlEntity existing, ContentUrlEntity entity) booleanupdateContentUrlKey(long contentUrlId, ContentUrlKeyEntity contentUrlKey) Updates the content key for the given content urlbooleanupdateContentUrlKey(String contentUrl, ContentUrlKeyEntity contentUrlKey) Updates the content key for the given content urlprotected abstract intupdateContentUrlOrphanTime(Long id, Long orphanTime, Long oldOrphanTime) Update a content URL with the given orphan timeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.alfresco.repo.domain.contentdata.ContentDataDAO
countSymmetricKeysForMasterKeyAlias, countSymmetricKeysForMasterKeys, createContentUrlOrphaned, deleteContentDataForNode, deleteContentUrls, getContentUrlsKeepOrphaned, getContentUrlsOrphaned, getSymmetricKeysByMasterKeyAlias
-
Field Details
-
controlDAO
-
mimetypeDAO
-
encodingDAO
-
localeDAO
-
-
Constructor Details
-
AbstractContentDataDAOImpl
public AbstractContentDataDAOImpl()Default constructor
-
-
Method Details
-
setControlDAO
-
setMimetypeDAO
-
setEncodingDAO
-
setLocaleDAO
-
setContentStoreCleaner
Set this property to enable eager cleanup of orphaned content.- Parameters:
contentStoreCleaner- an eager cleaner (may be null)
-
setContentDataCache
- Parameters:
contentDataCache- the cache of IDs to ContentData and vice versa
-
setContentUrlCache
-
registerDereferencedContentUrl
A content_url entity was dereferenced. This makes no assumptions about the current references - dereference deletion is handled in the commit phase. -
createContentData
Description copied from interface:ContentDataDAOCreate a new ContentData instance.- Specified by:
createContentDatain interfaceContentDataDAO- Parameters:
contentData- the ContentData details- Returns:
- the ContentData pair (id, ContentData) (never null)
-
getContentData
- Specified by:
getContentDatain interfaceContentDataDAO- Parameters:
id- the unique ID of the entity- Returns:
- the ContentData pair (id, ContentData) or null if it doesn't exist
-
getContentUrl
Description copied from interface:ContentDataDAOGet a content url entity by contentUrl- Specified by:
getContentUrlin interfaceContentDataDAO- Returns:
- null if the url does not exist
-
getContentUrl
Description copied from interface:ContentDataDAOGet a content url entity by contentUrlId- Specified by:
getContentUrlin interfaceContentDataDAO- Returns:
- null if the url does not exist
-
cacheContentDataForNodes
- Specified by:
cacheContentDataForNodesin interfaceContentDataDAO- Parameters:
nodeIds- the nodeIds
-
updateContentData
Description copied from interface:ContentDataDAOUpdate a content data instance- Specified by:
updateContentDatain interfaceContentDataDAO- Parameters:
id- the unique ID of the entitycontentData- the new data
-
deleteContentData
Description copied from interface:ContentDataDAODelete an instance of content.- Specified by:
deleteContentDatain interfaceContentDataDAO- Parameters:
id- the unique ID of the entity
-
createContentDataEntity
Translates theContentDatainto persistable values using the helper DAOs -
updateContentDataEntity
Translates theContentDatainto persistable values using the helper DAOs -
updateContentUrlKey
Description copied from interface:ContentDataDAOUpdates the content key for the given content url- Specified by:
updateContentUrlKeyin interfaceContentDataDAO
-
updateContentUrlKey
Description copied from interface:ContentDataDAOUpdates the content key for the given content url- Specified by:
updateContentUrlKeyin interfaceContentDataDAO
-
getOrCreateContentUrl
Description copied from interface:ContentDataDAOGet a content URL or create one if it does not exist- Specified by:
getOrCreateContentUrlin interfaceContentDataDAO
-
getOrCreateContentUrl
Description copied from interface:ContentDataDAOGet a content URL or create one if it does not exist- Specified by:
getOrCreateContentUrlin interfaceContentDataDAO
-
createContentUrlEntity
protected abstract ContentUrlEntity createContentUrlEntity(String contentUrl, long size, ContentUrlKeyEntity contentUrlKey) - Parameters:
contentUrl- the content URL to create or search for
-
getContentUrlEntity
- Parameters:
id- the ID of the content url entity- Returns:
- Return the entity or null if it doesn't exist
-
getContentUrlEntity
-
getContentUrlEntityUnreferenced
- Parameters:
contentUrl- the URL of the content url entity- Returns:
- Return the entity or null if it doesn't exist or is still referenced by a content_data entity
-
updateContentUrlOrphanTime
Update a content URL with the given orphan time- Parameters:
id- the unique ID of the entityorphanTime- the time (ms since epoch) that the entity was orphanedoldOrphanTime- the orphan time we expect to update for optimistic locking (may be null)- Returns:
- Returns the number of rows updated
-
createContentDataEntity
protected abstract ContentDataEntity createContentDataEntity(Long contentUrlId, Long mimetypeId, Long encodingId, Long localeId) Create the row for the alf_content_data -
getContentDataEntity
- Parameters:
id- the entity ID- Returns:
- Returns the entity or null if it doesn't exist
-
getContentDataEntitiesForNodes
- Parameters:
nodeIds- the node ID- Returns:
- Returns the associated entities or null if none exist
-
updateContentDataEntity
Update an existing alf_content_data entity- Parameters:
entity- the existing entity that will be updated- Returns:
- Returns the number of rows updated (should be 1)
-
deleteContentDataEntity
Delete the entity with the given ID- Returns:
- Returns the number of rows deleted
-
deleteContentUrlEntity
protected abstract int deleteContentUrlEntity(long id) -
updateContentUrlEntity
-