@Service(value="blTranslationService") public class TranslationServiceImpl extends Object implements TranslationService
| Modifier and Type | Field and Description |
|---|---|
protected net.sf.ehcache.Cache |
cache |
protected TranslationDao |
dao |
protected TranslationServiceExtensionManager |
extensionManager |
protected GenericEntityDao |
genericEntityDao |
protected static org.apache.commons.logging.Log |
LOG |
protected SandBoxHelper |
sandBoxHelper |
protected StatisticsService |
statisticsService |
protected int |
thresholdForFullCache |
| Constructor and Description |
|---|
TranslationServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
deleteTranslationById(Long translationId)
Deletes the given translations
|
protected Translation |
findBestTemplateTranslation(String specificPropertyKey,
String generalPropertyKey,
Map<String,Map<String,Translation>> propertyTranslationMap,
String entityId) |
Translation |
findTranslationById(Long id)
Find a translation instance by its primary key value.
|
net.sf.ehcache.Cache |
getCache()
Get the translation specific cache (different than the level-2 hibernate cache)
|
protected String |
getCacheKey(ResultType resultType,
TranslatedEntity entityType) |
protected TranslatedEntity |
getEntityType(Class<?> entityClass) |
protected TranslatedEntity |
getEntityType(Object entity) |
protected TranslatedEntity |
getEntityType(String className) |
protected String |
getOverrideTranslatedValue(String property,
TranslatedEntity entityType,
String entityId,
String localeCode,
String localeCountryCode) |
protected String |
getTemplateTranslatedValue(String standardCacheKey,
String property,
TranslatedEntity entityType,
String entityId,
String localeCode,
String localeCountryCode,
String specificPropertyKey,
String generalPropertyKey) |
protected int |
getThresholdForFullCache() |
String |
getTranslatedValue(Object entity,
String property,
Locale locale)
Returns the translated value of the property for the given entity.
|
Translation |
getTranslation(TranslatedEntity entity,
String entityId,
String fieldName,
String localeCode)
Attempts to find the translation object for the given parameters
|
List<Translation> |
getTranslations(String ceilingEntityClassname,
String entityId,
String property)
Finds all current translations for the specified field
|
protected StandardCacheItem |
lookupTranslationFromMap(String key,
Map<String,Map<String,StandardCacheItem>> propertyTranslationMap,
String entityId) |
void |
removeTranslationFromCache(Translation translation)
Remove a translation instance from the translation specific cache (different than level-2 hibernate cache)
|
protected String |
replaceEmptyWithNullResponse(String response) |
Translation |
save(String entityType,
String entityId,
String fieldName,
String localeCode,
String translatedValue)
Creates a new translation object for the requested parameters, saves it, and returns the saved instance.
|
Translation |
save(Translation translation)
Persists the given translation
|
Translation |
update(Long translationId,
String localeCode,
String translatedValue)
Updates the given translation id with the new locale code and translated value
|
protected static final org.apache.commons.logging.Log LOG
protected TranslationDao dao
protected StatisticsService statisticsService
protected SandBoxHelper sandBoxHelper
protected net.sf.ehcache.Cache cache
protected TranslationServiceExtensionManager extensionManager
@Value(value="${translation.thresholdForFullCache:1000}")
protected int thresholdForFullCache
protected GenericEntityDao genericEntityDao
@Transactional(value="blTransactionManager") public Translation save(Translation translation)
TranslationServicesave in interface TranslationService@Transactional(value="blTransactionManager") public Translation save(String entityType, String entityId, String fieldName, String localeCode, String translatedValue)
TranslationServicesave in interface TranslationServicepublic Translation findTranslationById(Long id)
TranslationServicefindTranslationById in interface TranslationServiceid - the primary key value@Transactional(value="blTransactionManager") public Translation update(Long translationId, String localeCode, String translatedValue)
TranslationServiceupdate in interface TranslationService@Transactional(value="blTransactionManager") public void deleteTranslationById(Long translationId)
TranslationServicedeleteTranslationById in interface TranslationServicepublic Translation getTranslation(TranslatedEntity entity, String entityId, String fieldName, String localeCode)
TranslationServicegetTranslation in interface TranslationServicepublic List<Translation> getTranslations(String ceilingEntityClassname, String entityId, String property)
TranslationServicegetTranslations in interface TranslationServicepublic net.sf.ehcache.Cache getCache()
TranslationServicegetCache in interface TranslationServicepublic String getTranslatedValue(Object entity, String property, Locale locale)
TranslationServicegetTranslatedValue in interface TranslationServicepublic void removeTranslationFromCache(Translation translation)
TranslationServiceremoveTranslationFromCache in interface TranslationServicetranslation - The translation instance to removeprotected String getOverrideTranslatedValue(String property, TranslatedEntity entityType, String entityId, String localeCode, String localeCountryCode)
protected String getTemplateTranslatedValue(String standardCacheKey, String property, TranslatedEntity entityType, String entityId, String localeCode, String localeCountryCode, String specificPropertyKey, String generalPropertyKey)
protected StandardCacheItem lookupTranslationFromMap(String key, Map<String,Map<String,StandardCacheItem>> propertyTranslationMap, String entityId)
protected Translation findBestTemplateTranslation(String specificPropertyKey, String generalPropertyKey, Map<String,Map<String,Translation>> propertyTranslationMap, String entityId)
protected TranslatedEntity getEntityType(Class<?> entityClass)
protected TranslatedEntity getEntityType(Object entity)
protected TranslatedEntity getEntityType(String className)
protected String getCacheKey(ResultType resultType, TranslatedEntity entityType)
protected int getThresholdForFullCache()
Copyright © 2015. All rights reserved.