Class AbstractMimetypeDAOImpl
- java.lang.Object
-
- org.alfresco.repo.domain.mimetype.AbstractMimetypeDAOImpl
-
- All Implemented Interfaces:
MimetypeDAO
- Direct Known Subclasses:
MimetypeDAOImpl
public abstract class AbstractMimetypeDAOImpl extends 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
-
-
Constructor Summary
Constructors Constructor Description AbstractMimetypeDAOImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract MimetypeEntitycreateMimetypeEntity(String mimetype)Pair<Long,String>getMimetype(Long id)Pair<Long,String>getMimetype(String mimetype)protected abstract MimetypeEntitygetMimetypeEntity(Long id)protected abstract MimetypeEntitygetMimetypeEntity(String mimetype)Pair<Long,String>getOrCreateMimetype(String mimetype)Retrieve an existing mimetype or create a new one if it doesn't exist.protected StringsanitizeMimetype(String mimetype)voidsetMimetypeEntityCache(SimpleCache<Serializable,Serializable> mimetypeEntityCache)intupdateMimetype(String oldMimetype, String newMimetype)Update a mimetype if it exists.protected abstract intupdateMimetypeEntity(Long id, String newMimetype)
-
-
-
Method Detail
-
setMimetypeEntityCache
public void setMimetypeEntityCache(SimpleCache<Serializable,Serializable> mimetypeEntityCache)
- Parameters:
mimetypeEntityCache- the cache of IDs to mimetypes
-
getMimetype
public Pair<Long,String> getMimetype(Long id)
- Specified by:
getMimetypein interfaceMimetypeDAO- Parameters:
id- the unique ID of the entity- Returns:
- the Mimetype pair (id, mimetype) (never null)
-
getMimetype
public Pair<Long,String> getMimetype(String mimetype)
- Specified by:
getMimetypein interfaceMimetypeDAO- Parameters:
mimetype- the Mimetype to query for- Returns:
- the Mimetype pair (id, mimetype) or null if it doesn't exist
-
getOrCreateMimetype
public Pair<Long,String> getOrCreateMimetype(String mimetype)
Description copied from interface:MimetypeDAORetrieve an existing mimetype or create a new one if it doesn't exist.- Specified by:
getOrCreateMimetypein interfaceMimetypeDAO- Parameters:
mimetype- the Mimetype- Returns:
- the Mimetype pair (id, mimetype) (never null)
-
updateMimetype
public int updateMimetype(String oldMimetype, String newMimetype)
Description copied from interface:MimetypeDAOUpdate 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:
updateMimetypein interfaceMimetypeDAO- Parameters:
oldMimetype- the old MimetypenewMimetype- the new Mimetype- Returns:
- the number of rows modified
-
getMimetypeEntity
protected abstract MimetypeEntity getMimetypeEntity(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(String mimetype)
-
createMimetypeEntity
protected abstract MimetypeEntity createMimetypeEntity(String mimetype)
-
-