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 DynamicDaoHelperprotected jakarta.persistence.EntityManagerprotected EntityConfigurationprotected TranslationServiceExtensionManagerprotected 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 databasevoiddelete(Translation translation) Deletes the given translationprotected TranslationfindBestTranslation(String specificLocale, List<Translation> translations) protected TranslationfindSpecificTranslation(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 StringgetUpdatedEntityId(TranslatedEntity entityType, Long idValue) protected StringgetUpdatedEntityId(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 ofStandardCacheIteminstances.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 translationvoidsetDynamicDaoHelper(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:TranslationDaoPersists the given translation- Specified by:
savein interfaceTranslationDao- Returns:
- the saved translation
-
create
Description copied from interface:TranslationDaoCreates an empty translation instance that is not persisted to the database- Specified by:
createin interfaceTranslationDao- Returns:
- the unsaved, empty translation
-
delete
Description copied from interface:TranslationDaoDeletes the given translation- Specified by:
deletein interfaceTranslationDao
-
getIdPropertyMetadata
Description copied from interface:TranslationDaoReturns 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:
getIdPropertyMetadatain interfaceTranslationDao- Returns:
- the id property's metadata
-
getEntityImpl
Description copied from interface:TranslationDaoReturns the entity implementation class based on the TranslatedEntity- Specified by:
getEntityImplin interfaceTranslationDao- Returns:
- the entity implementation class
-
readTranslationById
Description copied from interface:TranslationDaoReads a translation by its own primary key- Specified by:
readTranslationByIdin interfaceTranslationDao- Returns:
- the translation
-
readTranslations
public List<Translation> readTranslations(TranslatedEntity entity, String entityId, String fieldName) Description copied from interface:TranslationDaoReads all translations for a given field- Specified by:
readTranslationsin interfaceTranslationDao- Returns:
- the list of translations
-
readTranslation
public Translation readTranslation(TranslatedEntity entity, String entityId, String fieldName, String localeCode) Description copied from interface:TranslationDaoReads a translation for the requested parameters. Returns null if there is no translation found- Specified by:
readTranslationin interfaceTranslationDao- Returns:
- the translation
-
getEntityId
Description copied from interface:TranslationDaoGet the id for the object. Can take into account hierarchical multitenancy to retrieve the original id.- Specified by:
getEntityIdin interfaceTranslationDao- Returns:
-
countTranslationEntries
Description copied from interface:TranslationDaoCount the number of translations for the given params.- Specified by:
countTranslationEntriesin interfaceTranslationDaostage- 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:TranslationDaoRead all the available translations for the given params.- Specified by:
readAllTranslationEntriesin interfaceTranslationDaostage- 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:TranslationDaoRead all the available translations for the given params.- Specified by:
readAllTranslationEntriesin interfaceTranslationDaostage- 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:TranslationDaoRead all translation entries (seeTranslationDao.readAllTranslationEntries(org.broadleafcommerce.common.i18n.domain.TranslatedEntity, org.broadleafcommerce.common.extension.ResultType)), and convert those results into a list ofStandardCacheIteminstances.- Specified by:
readConvertedTranslationEntriesin interfaceTranslationDaostage- 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:TranslationDaoRead a specific translation for the given params.- Specified by:
readTranslationin interfaceTranslationDaostage- 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
-