Class AbstractContentDataDAOImpl
- java.lang.Object
-
- org.alfresco.repo.domain.contentdata.AbstractContentDataDAOImpl
-
- All Implemented Interfaces:
ContentDataDAO
- Direct Known Subclasses:
ContentDataDAOImpl
public abstract class AbstractContentDataDAOImpl extends java.lang.Object implements ContentDataDAO
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
ContentDatainstances. The cache is primarily present to decode IDs intoContentDatainstances.- Since:
- 3.2
- Author:
- Derek Hulley, sglover
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAbstractContentDataDAOImpl.ContentUrlDeleteTransactionListenerTransactional listener that deletes unreferenced content_url entities.-
Nested classes/interfaces inherited from interface org.alfresco.repo.domain.contentdata.ContentDataDAO
ContentDataDAO.ContentUrlHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected ControlDAOcontrolDAOprotected EncodingDAOencodingDAOprotected LocaleDAOlocaleDAOprotected MimetypeDAOmimetypeDAO
-
Constructor Summary
Constructors Constructor Description AbstractContentDataDAOImpl()Default constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcacheContentDataForNodes(java.util.Set<java.lang.Long> nodeIds)org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ContentData>createContentData(org.alfresco.service.cmr.repository.ContentData contentData)Create a new ContentData instance.protected abstract ContentDataEntitycreateContentDataEntity(java.lang.Long contentUrlId, java.lang.Long mimetypeId, java.lang.Long encodingId, java.lang.Long localeId)Create the row for the alf_content_dataprotected ContentDataEntitycreateContentDataEntity(org.alfresco.service.cmr.repository.ContentData contentData)Translates theContentDatainto persistable values using the helper DAOsprotected abstract ContentUrlEntitycreateContentUrlEntity(java.lang.String contentUrl, long size, ContentUrlKeyEntity contentUrlKey)voiddeleteContentData(java.lang.Long id)Delete an instance of content.protected abstract intdeleteContentDataEntity(java.lang.Long id)Delete the entity with the given IDprotected abstract intdeleteContentUrlEntity(long id)org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ContentData>getContentData(java.lang.Long id)protected abstract java.util.List<ContentDataEntity>getContentDataEntitiesForNodes(java.util.Set<java.lang.Long> nodeIds)protected abstract ContentDataEntitygetContentDataEntity(java.lang.Long id)ContentUrlEntitygetContentUrl(java.lang.Long contentUrlId)Get a content url entity by contentUrlIdContentUrlEntitygetContentUrl(java.lang.String contentUrl)Get a content url entity by contentUrlprotected abstract ContentUrlEntitygetContentUrlEntity(java.lang.Long id)protected abstract ContentUrlEntitygetContentUrlEntity(java.lang.String contentUrl)protected abstract ContentUrlEntitygetContentUrlEntityUnreferenced(java.lang.String contentUrl)ContentUrlEntitygetOrCreateContentUrl(java.lang.String contentUrl)Get a content URL or create one if it does not existContentUrlEntitygetOrCreateContentUrl(java.lang.String contentUrl, long size)Get a content URL or create one if it does not existprotected voidregisterDereferencedContentUrl(java.lang.String contentUrl)A content_url entity was dereferenced.voidsetContentDataCache(org.alfresco.repo.cache.SimpleCache<java.lang.Long,org.alfresco.service.cmr.repository.ContentData> contentDataCache)voidsetContentStoreCleaner(EagerContentStoreCleaner contentStoreCleaner)Set this property to enable eager cleanup of orphaned content.voidsetContentUrlCache(org.alfresco.repo.cache.SimpleCache<java.lang.Long,ContentUrlEntity> contentUrlCache)voidsetControlDAO(ControlDAO controlDAO)voidsetEncodingDAO(EncodingDAO encodingDAO)voidsetLocaleDAO(LocaleDAO localeDAO)voidsetMimetypeDAO(MimetypeDAO mimetypeDAO)voidupdateContentData(java.lang.Long id, org.alfresco.service.cmr.repository.ContentData contentData)Update a content data instanceprotected abstract intupdateContentDataEntity(ContentDataEntity entity)Update an existing alf_content_data entityprotected intupdateContentDataEntity(ContentDataEntity contentDataEntity, org.alfresco.service.cmr.repository.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(java.lang.String contentUrl, ContentUrlKeyEntity contentUrlKey)Updates the content key for the given content urlprotected abstract intupdateContentUrlOrphanTime(java.lang.Long id, java.lang.Long orphanTime, java.lang.Long oldOrphanTime)Update a content URL with the given orphan time-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.alfresco.repo.domain.contentdata.ContentDataDAO
countSymmetricKeysForMasterKeyAlias, countSymmetricKeysForMasterKeys, createContentUrlOrphaned, deleteContentDataForNode, deleteContentUrls, getContentUrlsKeepOrphaned, getContentUrlsOrphaned, getSymmetricKeysByMasterKeyAlias
-
-
-
-
Field Detail
-
controlDAO
protected ControlDAO controlDAO
-
mimetypeDAO
protected MimetypeDAO mimetypeDAO
-
encodingDAO
protected EncodingDAO encodingDAO
-
localeDAO
protected LocaleDAO localeDAO
-
-
Method Detail
-
setControlDAO
public void setControlDAO(ControlDAO controlDAO)
-
setMimetypeDAO
public void setMimetypeDAO(MimetypeDAO mimetypeDAO)
-
setEncodingDAO
public void setEncodingDAO(EncodingDAO encodingDAO)
-
setLocaleDAO
public void setLocaleDAO(LocaleDAO localeDAO)
-
setContentStoreCleaner
public void setContentStoreCleaner(EagerContentStoreCleaner contentStoreCleaner)
Set this property to enable eager cleanup of orphaned content.- Parameters:
contentStoreCleaner- an eager cleaner (may be null)
-
setContentDataCache
public void setContentDataCache(org.alfresco.repo.cache.SimpleCache<java.lang.Long,org.alfresco.service.cmr.repository.ContentData> contentDataCache)
- Parameters:
contentDataCache- the cache of IDs to ContentData and vice versa
-
setContentUrlCache
public void setContentUrlCache(org.alfresco.repo.cache.SimpleCache<java.lang.Long,ContentUrlEntity> contentUrlCache)
-
registerDereferencedContentUrl
protected void registerDereferencedContentUrl(java.lang.String contentUrl)
A content_url entity was dereferenced. This makes no assumptions about the current references - dereference deletion is handled in the commit phase.
-
createContentData
public org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ContentData> createContentData(org.alfresco.service.cmr.repository.ContentData contentData)
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
public org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ContentData> getContentData(java.lang.Long id)
- 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
public ContentUrlEntity getContentUrl(java.lang.String contentUrl)
Description copied from interface:ContentDataDAOGet a content url entity by contentUrl- Specified by:
getContentUrlin interfaceContentDataDAO- Returns:
- null if the url does not exist
-
getContentUrl
public ContentUrlEntity getContentUrl(java.lang.Long contentUrlId)
Description copied from interface:ContentDataDAOGet a content url entity by contentUrlId- Specified by:
getContentUrlin interfaceContentDataDAO- Returns:
- null if the url does not exist
-
cacheContentDataForNodes
public void cacheContentDataForNodes(java.util.Set<java.lang.Long> nodeIds)
- Specified by:
cacheContentDataForNodesin interfaceContentDataDAO- Parameters:
nodeIds- the nodeIds
-
updateContentData
public void updateContentData(java.lang.Long id, org.alfresco.service.cmr.repository.ContentData contentData)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
public void deleteContentData(java.lang.Long id)
Description copied from interface:ContentDataDAODelete an instance of content.- Specified by:
deleteContentDatain interfaceContentDataDAO- Parameters:
id- the unique ID of the entity
-
createContentDataEntity
protected ContentDataEntity createContentDataEntity(org.alfresco.service.cmr.repository.ContentData contentData)
Translates theContentDatainto persistable values using the helper DAOs
-
updateContentDataEntity
protected int updateContentDataEntity(ContentDataEntity contentDataEntity, org.alfresco.service.cmr.repository.ContentData contentData)
Translates theContentDatainto persistable values using the helper DAOs
-
updateContentUrlKey
public boolean updateContentUrlKey(java.lang.String contentUrl, ContentUrlKeyEntity contentUrlKey)Description copied from interface:ContentDataDAOUpdates the content key for the given content url- Specified by:
updateContentUrlKeyin interfaceContentDataDAO
-
updateContentUrlKey
public boolean updateContentUrlKey(long contentUrlId, ContentUrlKeyEntity contentUrlKey)Description copied from interface:ContentDataDAOUpdates the content key for the given content url- Specified by:
updateContentUrlKeyin interfaceContentDataDAO
-
getOrCreateContentUrl
public ContentUrlEntity getOrCreateContentUrl(java.lang.String contentUrl)
Description copied from interface:ContentDataDAOGet a content URL or create one if it does not exist- Specified by:
getOrCreateContentUrlin interfaceContentDataDAO
-
getOrCreateContentUrl
public ContentUrlEntity getOrCreateContentUrl(java.lang.String contentUrl, long size)
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(java.lang.String contentUrl, long size, ContentUrlKeyEntity contentUrlKey)
- Parameters:
contentUrl- the content URL to create or search for
-
getContentUrlEntity
protected abstract ContentUrlEntity getContentUrlEntity(java.lang.Long id)
- Parameters:
id- the ID of the content url entity- Returns:
- Return the entity or null if it doesn't exist
-
getContentUrlEntity
protected abstract ContentUrlEntity getContentUrlEntity(java.lang.String contentUrl)
-
getContentUrlEntityUnreferenced
protected abstract ContentUrlEntity getContentUrlEntityUnreferenced(java.lang.String contentUrl)
- 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
protected abstract int updateContentUrlOrphanTime(java.lang.Long id, java.lang.Long orphanTime, java.lang.Long oldOrphanTime)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(java.lang.Long contentUrlId, java.lang.Long mimetypeId, java.lang.Long encodingId, java.lang.Long localeId)
Create the row for the alf_content_data
-
getContentDataEntity
protected abstract ContentDataEntity getContentDataEntity(java.lang.Long id)
- Parameters:
id- the entity ID- Returns:
- Returns the entity or null if it doesn't exist
-
getContentDataEntitiesForNodes
protected abstract java.util.List<ContentDataEntity> getContentDataEntitiesForNodes(java.util.Set<java.lang.Long> nodeIds)
- Parameters:
nodeIds- the node ID- Returns:
- Returns the associated entities or null if none exist
-
updateContentDataEntity
protected abstract int updateContentDataEntity(ContentDataEntity entity)
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
protected abstract int deleteContentDataEntity(java.lang.Long id)
Delete the entity with the given ID- Returns:
- Returns the number of rows deleted
-
deleteContentUrlEntity
protected abstract int deleteContentUrlEntity(long id)
-
updateContentUrlEntity
protected abstract int updateContentUrlEntity(ContentUrlEntity existing, ContentUrlEntity entity)
-
-