public abstract class AbstractLocaleDAOImpl extends Object implements LocaleDAO
This provides basic services such as caching, but defers to the underlying implementation for CRUD operations. Since locales are system-wide and immutable, we can cache lookups in both directions.
Modifier | Constructor and Description |
---|---|
protected |
AbstractLocaleDAOImpl()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract LocaleEntity |
createLocaleEntity(String locale) |
org.alfresco.util.Pair<Long,Locale> |
getDefaultLocalePair() |
protected abstract LocaleEntity |
getLocaleEntity(Long id) |
protected abstract LocaleEntity |
getLocaleEntity(String locale) |
org.alfresco.util.Pair<Long,Locale> |
getLocalePair(Locale locale) |
org.alfresco.util.Pair<Long,Locale> |
getLocalePair(Long id) |
org.alfresco.util.Pair<Long,Locale> |
getOrCreateDefaultLocalePair()
Find or create the details representing the default locale.
|
org.alfresco.util.Pair<Long,Locale> |
getOrCreateLocalePair(Locale locale)
Gets the locale ID for an existing instance or creates a new entity if
one doesn't exist.
|
void |
setLocaleEntityCache(org.alfresco.repo.cache.SimpleCache<Long,String> localeEntityCache)
Set the cache that maintains the ID-Locale mappings and vice-versa (bi-directional)
|
protected AbstractLocaleDAOImpl()
This sets up the DAO accessors to bypass any caching to handle the case where the caches are not supplied in the setters.
public void setLocaleEntityCache(org.alfresco.repo.cache.SimpleCache<Long,String> localeEntityCache)
localeEntityCache
- the cachepublic org.alfresco.util.Pair<Long,Locale> getLocalePair(Locale locale)
getLocalePair
in interface LocaleDAO
locale
- the locale to fetch or null to get the default localepublic org.alfresco.util.Pair<Long,Locale> getDefaultLocalePair()
getDefaultLocalePair
in interface LocaleDAO
public org.alfresco.util.Pair<Long,Locale> getLocalePair(Long id)
getLocalePair
in interface LocaleDAO
id
- the unique ID of the entitypublic org.alfresco.util.Pair<Long,Locale> getOrCreateLocalePair(Locale locale)
getOrCreateLocalePair
in interface LocaleDAO
locale
- the locale to fetch or null to get or create the default locale.public org.alfresco.util.Pair<Long,Locale> getOrCreateDefaultLocalePair()
getOrCreateDefaultLocalePair
in interface LocaleDAO
protected abstract LocaleEntity getLocaleEntity(Long id)
protected abstract LocaleEntity getLocaleEntity(String locale)
protected abstract LocaleEntity createLocaleEntity(String locale)
Copyright © 2005–2017 Alfresco Software. All rights reserved.