Class TranslationDaoImpl
java.lang.Object
org.broadleafcommerce.common.i18n.dao.TranslationDaoImpl
- All Implemented Interfaces:
TranslationDao
@Repository("blTranslationDao")
public class TranslationDaoImpl
extends Object
implements TranslationDao
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DynamicDaoHelper
protected jakarta.persistence.EntityManager
protected EntityConfiguration
protected TranslationServiceExtensionManager
protected SandBoxHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncountTranslationEntries
(TranslatedEntity entityType, ResultType stage) Count the number of translations for the given params.create()
Creates an empty translation instance that is not persisted to the databasevoid
delete
(Translation translation) Deletes the given translationprotected Translation
findBestTranslation
(String specificLocale, List<Translation> translations) protected Translation
findSpecificTranslation
(String localeCountryCode, List<Translation> translations) getEntityId
(TranslatedEntity entityType, Object entity) Get the id for the object.Class<?>
getEntityImpl
(TranslatedEntity entity) Returns the entity implementation class based on the TranslatedEntityReturns a map that holds the following data for the given entity: "name" --> idProperty (the name of the id property, always a String) "type" --> idProperty's type (usually either Long or String)protected String
getUpdatedEntityId
(TranslatedEntity entityType, Long idValue) protected String
getUpdatedEntityId
(TranslatedEntity entityType, String entityId) readAllTranslationEntries
(TranslatedEntity entityType, ResultType stage) Read all the available translations for the given params.readAllTranslationEntries
(TranslatedEntity entityType, ResultType stage, List<String> entityIds) Read all the available translations for the given params.readConvertedTranslationEntries
(TranslatedEntity entityType, ResultType stage) Read all translation entries (seeTranslationDao.readAllTranslationEntries(org.broadleafcommerce.common.i18n.domain.TranslatedEntity, org.broadleafcommerce.common.extension.ResultType)
), and convert those results into a list ofStandardCacheItem
instances.readTranslation
(TranslatedEntity entity, String entityId, String fieldName, String localeCode) Reads a translation for the requested parameters.readTranslation
(TranslatedEntity entityType, String entityId, String fieldName, String localeCode, String localeCountryCode, ResultType stage) Read a specific translation for the given params.readTranslationById
(Long translationId) Reads a translation by its own primary keyreadTranslations
(TranslatedEntity entity, String entityId, String fieldName) Reads all translations for a given fieldsave
(Translation translation) Persists the given translationvoid
setDynamicDaoHelper
(DynamicDaoHelper dynamicDaoHelper)
-
Field Details
-
em
protected jakarta.persistence.EntityManager em -
entityConfiguration
-
extensionManager
-
sandBoxHelper
-
dynamicDaoHelper
-
-
Constructor Details
-
TranslationDaoImpl
public TranslationDaoImpl()
-
-
Method Details
-
save
Description copied from interface:TranslationDao
Persists the given translation- Specified by:
save
in interfaceTranslationDao
- Returns:
- the saved translation
-
create
Description copied from interface:TranslationDao
Creates an empty translation instance that is not persisted to the database- Specified by:
create
in interfaceTranslationDao
- Returns:
- the unsaved, empty translation
-
delete
Description copied from interface:TranslationDao
Deletes the given translation- Specified by:
delete
in interfaceTranslationDao
-
getIdPropertyMetadata
Description copied from interface:TranslationDao
Returns a map that holds the following data for the given entity: "name" --> idProperty (the name of the id property, always a String) "type" --> idProperty's type (usually either Long or String)- Specified by:
getIdPropertyMetadata
in interfaceTranslationDao
- Returns:
- the id property's metadata
-
getEntityImpl
Description copied from interface:TranslationDao
Returns the entity implementation class based on the TranslatedEntity- Specified by:
getEntityImpl
in interfaceTranslationDao
- Returns:
- the entity implementation class
-
readTranslationById
Description copied from interface:TranslationDao
Reads a translation by its own primary key- Specified by:
readTranslationById
in interfaceTranslationDao
- Returns:
- the translation
-
readTranslations
public List<Translation> readTranslations(TranslatedEntity entity, String entityId, String fieldName) Description copied from interface:TranslationDao
Reads all translations for a given field- Specified by:
readTranslations
in interfaceTranslationDao
- Returns:
- the list of translations
-
readTranslation
public Translation readTranslation(TranslatedEntity entity, String entityId, String fieldName, String localeCode) Description copied from interface:TranslationDao
Reads a translation for the requested parameters. Returns null if there is no translation found- Specified by:
readTranslation
in interfaceTranslationDao
- Returns:
- the translation
-
getEntityId
Description copied from interface:TranslationDao
Get the id for the object. Can take into account hierarchical multitenancy to retrieve the original id.- Specified by:
getEntityId
in interfaceTranslationDao
- Returns:
-
countTranslationEntries
Description copied from interface:TranslationDao
Count the number of translations for the given params.- Specified by:
countTranslationEntries
in interfaceTranslationDao
stage
- param drives whether to look for entries at a template level or standard site level (multitenant concepts). Can be IGNORE. Any multitenant behavior is ignored in the absence of the multitenant module.- Returns:
-
readAllTranslationEntries
Description copied from interface:TranslationDao
Read all the available translations for the given params.- Specified by:
readAllTranslationEntries
in interfaceTranslationDao
stage
- param drives whether to look for entries at a template level or standard site level (multitenant concepts). Can be IGNORE. Any multitenant behavior is ignored in the absence of the multitenant module.- Returns:
-
readAllTranslationEntries
public List<Translation> readAllTranslationEntries(TranslatedEntity entityType, ResultType stage, List<String> entityIds) Description copied from interface:TranslationDao
Read all the available translations for the given params.- Specified by:
readAllTranslationEntries
in interfaceTranslationDao
stage
- param drives whether to look for entries at a template level or standard site level (multitenant concepts). Can be IGNORE. Any multitenant behavior is ignored in the absence of the multitenant module.entityIds
- theTranslation.getEntityId()
to restrict the results by- Returns:
-
readConvertedTranslationEntries
public List<StandardCacheItem> readConvertedTranslationEntries(TranslatedEntity entityType, ResultType stage) Description copied from interface:TranslationDao
Read all translation entries (seeTranslationDao.readAllTranslationEntries(org.broadleafcommerce.common.i18n.domain.TranslatedEntity, org.broadleafcommerce.common.extension.ResultType)
), and convert those results into a list ofStandardCacheItem
instances.- Specified by:
readConvertedTranslationEntries
in interfaceTranslationDao
stage
- param drives whether to look for entries at a template level or standard site level (multitenant concepts). Can be IGNORE. Any multitenant behavior is ignored in the absence of the multitenant module.- Returns:
-
readTranslation
public Translation readTranslation(TranslatedEntity entityType, String entityId, String fieldName, String localeCode, String localeCountryCode, ResultType stage) Description copied from interface:TranslationDao
Read a specific translation for the given params.- Specified by:
readTranslation
in interfaceTranslationDao
stage
- param drives whether to look for entries at a template level or standard site level (multitenant concepts). Can be IGNORE. Any multitenant behavior is ignored in the absence of the multitenant module.- Returns:
-
getUpdatedEntityId
-
getUpdatedEntityId
-
findBestTranslation
-
findSpecificTranslation
protected Translation findSpecificTranslation(String localeCountryCode, List<Translation> translations) -
getDynamicDaoHelper
-
setDynamicDaoHelper
-