Class AbstractContentDataDAOImpl

java.lang.Object
org.alfresco.repo.domain.contentdata.AbstractContentDataDAOImpl
All Implemented Interfaces:
ContentDataDAO
Direct Known Subclasses:
ContentDataDAOImpl

public abstract class AbstractContentDataDAOImpl extends 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
Author:
Derek Hulley, sglover
  • Field Details

  • Constructor Details

    • AbstractContentDataDAOImpl

      public AbstractContentDataDAOImpl()
      Default constructor
  • Method Details

    • 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(SimpleCache<Long,ContentData> contentDataCache)
      Parameters:
      contentDataCache - the cache of IDs to ContentData and vice versa
    • setContentUrlCache

      public void setContentUrlCache(SimpleCache<Long,ContentUrlEntity> contentUrlCache)
    • registerDereferencedContentUrl

      protected void registerDereferencedContentUrl(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 Pair<Long,ContentData> createContentData(ContentData contentData)
      Description copied from interface: ContentDataDAO
      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 Pair<Long,ContentData> getContentData(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
    • getContentUrl

      public ContentUrlEntity getContentUrl(String contentUrl)
      Description copied from interface: ContentDataDAO
      Get a content url entity by contentUrl
      Specified by:
      getContentUrl in interface ContentDataDAO
      Returns:
      null if the url does not exist
    • getContentUrl

      public ContentUrlEntity getContentUrl(Long contentUrlId)
      Description copied from interface: ContentDataDAO
      Get a content url entity by contentUrlId
      Specified by:
      getContentUrl in interface ContentDataDAO
      Returns:
      null if the url does not exist
    • cacheContentDataForNodes

      public void cacheContentDataForNodes(Set<Long> nodeIds)
      Specified by:
      cacheContentDataForNodes in interface ContentDataDAO
      Parameters:
      nodeIds - the nodeIds
    • updateContentData

      public void updateContentData(Long id, ContentData contentData)
      Description copied from interface: ContentDataDAO
      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(Long id)
      Description copied from interface: ContentDataDAO
      Delete an instance of content.
      Specified by:
      deleteContentData in interface ContentDataDAO
      Parameters:
      id - the unique ID of the entity
    • createContentDataEntity

      protected ContentDataEntity createContentDataEntity(ContentData contentData)
      Translates the ContentData into persistable values using the helper DAOs
    • updateContentDataEntity

      protected int updateContentDataEntity(ContentDataEntity contentDataEntity, ContentData contentData)
      Translates the ContentData into persistable values using the helper DAOs
    • updateContentUrlKey

      public boolean updateContentUrlKey(String contentUrl, ContentUrlKeyEntity contentUrlKey)
      Description copied from interface: ContentDataDAO
      Updates the content key for the given content url
      Specified by:
      updateContentUrlKey in interface ContentDataDAO
    • updateContentUrlKey

      public boolean updateContentUrlKey(long contentUrlId, ContentUrlKeyEntity contentUrlKey)
      Description copied from interface: ContentDataDAO
      Updates the content key for the given content url
      Specified by:
      updateContentUrlKey in interface ContentDataDAO
    • getOrCreateContentUrl

      public ContentUrlEntity getOrCreateContentUrl(String contentUrl)
      Description copied from interface: ContentDataDAO
      Get a content URL or create one if it does not exist
      Specified by:
      getOrCreateContentUrl in interface ContentDataDAO
    • getOrCreateContentUrl

      public ContentUrlEntity getOrCreateContentUrl(String contentUrl, long size)
      Description copied from interface: ContentDataDAO
      Get a content URL or create one if it does not exist
      Specified by:
      getOrCreateContentUrl in interface ContentDataDAO
    • createContentUrlEntity

      protected abstract ContentUrlEntity createContentUrlEntity(String contentUrl, long size, ContentUrlKeyEntity contentUrlKey)
      Parameters:
      contentUrl - the content URL to create or search for
    • getContentUrlEntity

      protected abstract ContentUrlEntity getContentUrlEntity(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(String contentUrl)
    • getContentUrlEntityUnreferenced

      protected abstract ContentUrlEntity getContentUrlEntityUnreferenced(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(Long id, Long orphanTime, 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(Long contentUrlId, Long mimetypeId, Long encodingId, Long localeId)
      Create the row for the alf_content_data
    • getContentDataEntity

      protected abstract ContentDataEntity getContentDataEntity(Long id)
      Parameters:
      id - the entity ID
      Returns:
      Returns the entity or null if it doesn't exist
    • getContentDataEntitiesForNodes

      protected abstract List<ContentDataEntity> getContentDataEntitiesForNodes(Set<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(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)