Class AbstractMimetypeDAOImpl

  • All Implemented Interfaces:
    MimetypeDAO
    Direct Known Subclasses:
    MimetypeDAOImpl

    public abstract class AbstractMimetypeDAOImpl
    extends java.lang.Object
    implements MimetypeDAO
    Abstract implementation for Mimetype DAO.

    This provides basic services such as caching, but defers to the underlying implementation for CRUD operations.

    Since:
    3.2
    Author:
    Derek Hulley
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract MimetypeEntity createMimetypeEntity​(java.lang.String mimetype)  
      org.alfresco.util.Pair<java.lang.Long,​java.lang.String> getMimetype​(java.lang.Long id)  
      org.alfresco.util.Pair<java.lang.Long,​java.lang.String> getMimetype​(java.lang.String mimetype)  
      protected abstract MimetypeEntity getMimetypeEntity​(java.lang.Long id)  
      protected abstract MimetypeEntity getMimetypeEntity​(java.lang.String mimetype)  
      org.alfresco.util.Pair<java.lang.Long,​java.lang.String> getOrCreateMimetype​(java.lang.String mimetype)
      Retrieve an existing mimetype or create a new one if it doesn't exist.
      protected java.lang.String sanitizeMimetype​(java.lang.String mimetype)  
      void setMimetypeEntityCache​(org.alfresco.repo.cache.SimpleCache<java.io.Serializable,​java.io.Serializable> mimetypeEntityCache)  
      int updateMimetype​(java.lang.String oldMimetype, java.lang.String newMimetype)
      Update a mimetype if it exists.
      protected abstract int updateMimetypeEntity​(java.lang.Long id, java.lang.String newMimetype)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractMimetypeDAOImpl

        public AbstractMimetypeDAOImpl()
    • Method Detail

      • setMimetypeEntityCache

        public void setMimetypeEntityCache​(org.alfresco.repo.cache.SimpleCache<java.io.Serializable,​java.io.Serializable> mimetypeEntityCache)
        Parameters:
        mimetypeEntityCache - the cache of IDs to mimetypes
      • getMimetype

        public org.alfresco.util.Pair<java.lang.Long,​java.lang.String> getMimetype​(java.lang.Long id)
        Specified by:
        getMimetype in interface MimetypeDAO
        Parameters:
        id - the unique ID of the entity
        Returns:
        the Mimetype pair (id, mimetype) (never null)
      • getMimetype

        public org.alfresco.util.Pair<java.lang.Long,​java.lang.String> getMimetype​(java.lang.String mimetype)
        Specified by:
        getMimetype in interface MimetypeDAO
        Parameters:
        mimetype - the Mimetype to query for
        Returns:
        the Mimetype pair (id, mimetype) or null if it doesn't exist
      • getOrCreateMimetype

        public org.alfresco.util.Pair<java.lang.Long,​java.lang.String> getOrCreateMimetype​(java.lang.String mimetype)
        Description copied from interface: MimetypeDAO
        Retrieve an existing mimetype or create a new one if it doesn't exist.
        Specified by:
        getOrCreateMimetype in interface MimetypeDAO
        Parameters:
        mimetype - the Mimetype
        Returns:
        the Mimetype pair (id, mimetype) (never null)
      • updateMimetype

        public int updateMimetype​(java.lang.String oldMimetype,
                                  java.lang.String newMimetype)
        Description copied from interface: MimetypeDAO
        Update a mimetype if it exists. This method does not do any conflict resolution i.e. it will only succeed if the new mimetype does not exist already. Higher-level logic is required to handle updates to dependent rows, etc.
        Specified by:
        updateMimetype in interface MimetypeDAO
        Parameters:
        oldMimetype - the old Mimetype
        newMimetype - the new Mimetype
        Returns:
        the number of rows modified
      • sanitizeMimetype

        protected java.lang.String sanitizeMimetype​(java.lang.String mimetype)
      • getMimetypeEntity

        protected abstract MimetypeEntity getMimetypeEntity​(java.lang.Long id)
        Parameters:
        id - the ID of the mimetype entity
        Returns:
        Return the entity or null if it doesn't exist
      • getMimetypeEntity

        protected abstract MimetypeEntity getMimetypeEntity​(java.lang.String mimetype)
      • createMimetypeEntity

        protected abstract MimetypeEntity createMimetypeEntity​(java.lang.String mimetype)
      • updateMimetypeEntity

        protected abstract int updateMimetypeEntity​(java.lang.Long id,
                                                    java.lang.String newMimetype)