Package org.alfresco.repo.domain.locale
Class AbstractLocaleDAOImpl
java.lang.Object
org.alfresco.repo.domain.locale.AbstractLocaleDAOImpl
- All Implemented Interfaces:
LocaleDAO
- Direct Known Subclasses:
LocaleDAOImpl
Abstract implementation for Locale DAO.
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.
- Since:
- 3.4
- Author:
- janv
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract LocaleEntitycreateLocaleEntity(String locale) protected abstract LocaleEntitygetLocaleEntity(Long id) protected abstract LocaleEntitygetLocaleEntity(String locale) getLocalePair(Long id) getLocalePair(Locale locale) Find or create the details representing the default locale.getOrCreateLocalePair(Locale locale) Gets the locale ID for an existing instance or creates a new entity if one doesn't exist.voidsetLocaleEntityCache(SimpleCache<Long, String> localeEntityCache) Set the cache that maintains the ID-Locale mappings and vice-versa (bi-directional)
-
Constructor Details
-
AbstractLocaleDAOImpl
protected AbstractLocaleDAOImpl()Default constructor.This sets up the DAO accessors to bypass any caching to handle the case where the caches are not supplied in the setters.
-
-
Method Details
-
setLocaleEntityCache
Set the cache that maintains the ID-Locale mappings and vice-versa (bi-directional)- Parameters:
localeEntityCache- the cache
-
getLocalePair
- Specified by:
getLocalePairin interfaceLocaleDAO- Parameters:
locale- the locale to fetch or null to get the default locale- Returns:
- the locale or null if no such locale exists
-
getDefaultLocalePair
- Specified by:
getDefaultLocalePairin interfaceLocaleDAO- Returns:
- the locale pair for the default locale. Although the Locale object will be populated, the ID will point to an instance that generically refers to the system's default locale i.e. the value returned can vary depending on the executing thread's default locale.
-
getLocalePair
- Specified by:
getLocalePairin interfaceLocaleDAO- Parameters:
id- the unique ID of the entity- Returns:
- the locale pair (never null)
-
getOrCreateLocalePair
Gets the locale ID for an existing instance or creates a new entity if one doesn't exist.- Specified by:
getOrCreateLocalePairin interfaceLocaleDAO- Parameters:
locale- the locale to fetch or null to get or create the default locale.- Returns:
- the locale - never null
-
getOrCreateDefaultLocalePair
Find or create the details representing the default locale.- Specified by:
getOrCreateDefaultLocalePairin interfaceLocaleDAO- Returns:
- the locale pair for the default locale. Although the Locale object will be populated, the ID will point to an instance that generically refers to the system's default locale i.e. the value returned can vary depending on the executing thread's default locale.
-
getLocaleEntity
-
getLocaleEntity
-
createLocaleEntity
-