org.alfresco.repo.domain.contentdata
Class AbstractContentDataDAOImpl

java.lang.Object
  extended by 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 ContentData instances. The cache is primarily present to decode IDs into ContentData instances.

Since:
3.2

Nested Class Summary
 class AbstractContentDataDAOImpl.ContentUrlDeleteTransactionListener
          Transactional listener that deletes unreferenced content_url entities.
 
Nested classes/interfaces inherited from interface org.alfresco.repo.domain.contentdata.ContentDataDAO
ContentDataDAO.ContentUrlHandler
 
Constructor Summary
AbstractContentDataDAOImpl()
          Default constructor
 
Method Summary
 org.alfresco.util.Pair createContentData(org.alfresco.service.cmr.repository.ContentData contentData)
          Create a new ContentData instance.
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
protected abstract  ContentUrlEntity createContentUrlEntity(java.lang.String contentUrl, long size)
           
 void deleteContentData(java.lang.Long id)
          Delete an instance of content.
protected abstract  int deleteContentDataEntity(java.lang.Long id)
          Delete the entity with the given ID
 org.alfresco.util.Pair getContentData(java.lang.Long id)
          
protected abstract  ContentDataEntity getContentDataEntity(java.lang.Long id)
           
protected abstract  ContentUrlEntity getContentUrlEntity(java.lang.Long id)
           
protected abstract  ContentUrlEntity getContentUrlEntity(java.lang.String contentUrl)
           
protected abstract  ContentUrlEntity getContentUrlEntityUnreferenced(java.lang.String contentUrl)
           
protected  void registerDereferencedContentUrl(java.lang.String contentUrl)
          A content_url entity was dereferenced.
 void setContentDataCache(org.alfresco.repo.cache.SimpleCache contentDataCache)
           
 void setContentStoreCleaner(EagerContentStoreCleaner contentStoreCleaner)
          Set this property to enable eager cleanup of orphaned content.
 void setControlDAO(ControlDAO controlDAO)
           
 void setEncodingDAO(EncodingDAO encodingDAO)
           
 void setLocaleDAO(LocaleDAO localeDAO)
           
 void setMimetypeDAO(MimetypeDAO mimetypeDAO)
           
 void updateContentData(java.lang.Long id, org.alfresco.service.cmr.repository.ContentData contentData)
          Update a content data instance
protected abstract  int updateContentDataEntity(ContentDataEntity entity)
          Update an existing alf_content_data entity
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
 
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
createContentUrlOrphaned, deleteContentDataForNode, deleteContentUrls, getContentUrlsOrphaned
 

Constructor Detail

AbstractContentDataDAOImpl

public AbstractContentDataDAOImpl()
Default constructor

Method Detail

setControlDAO

public void setControlDAO(ControlDAO controlDAO)
Parameters:
controlDAO - create Savepoints

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 contentDataCache)
Parameters:
contentDataCache - the cache of IDs to ContentData and vice versa

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 createContentData(org.alfresco.service.cmr.repository.ContentData contentData)
Create a new ContentData instance.

Specified by:
createContentData in interface ContentDataDAO
Parameters:
contentData - the ContentData details
Returns:
the ContentData pair (id, ContentData) (never null)

getContentData

public org.alfresco.util.Pair getContentData(java.lang.Long id)

Specified by:
getContentData in interface ContentDataDAO
Parameters:
id - the unique ID of the entity
Returns:
the ContentData pair (id, ContentData) or null if it doesn't exist

updateContentData

public void updateContentData(java.lang.Long id,
                              org.alfresco.service.cmr.repository.ContentData contentData)
Update a content data instance

Specified by:
updateContentData in interface ContentDataDAO
Parameters:
id - the unique ID of the entity
contentData - the new data

deleteContentData

public void deleteContentData(java.lang.Long id)
Delete an instance of content.

Specified by:
deleteContentData in interface ContentDataDAO
Parameters:
id - the unique ID of the entity

createContentUrlEntity

protected abstract ContentUrlEntity createContentUrlEntity(java.lang.String contentUrl,
                                                           long size)
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)
Parameters:
contentUrl - the URL of the content url entity
Returns:
Return the entity or null if it doesn't exist

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 entity
orphanTime - the time (ms since epoch) that the entity was orphaned
oldOrphanTime - 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

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


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.