Interface TranslationDao
- All Known Implementing Classes:
TranslationDaoImpl
public interface TranslationDao
Provides data access for the
Translation
entity.- Author:
- Andre Azzolini (apazzolini)
-
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 translationgetEntityId
(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)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 (seereadAllTranslationEntries(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 translation
-
Method Details
-
save
Persists the given translation- Parameters:
translation
-- Returns:
- the saved translation
-
create
Translation create()Creates an empty translation instance that is not persisted to the database- Returns:
- the unsaved, empty translation
-
delete
Deletes the given translation- Parameters:
translation
-
-
getIdPropertyMetadata
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)- Parameters:
entity
-- Returns:
- the id property's metadata
-
getEntityImpl
Returns the entity implementation class based on the TranslatedEntity- Parameters:
entity
-- Returns:
- the entity implementation class
-
readTranslationById
Reads a translation by its own primary key- Parameters:
translationId
-- Returns:
- the translation
-
readTranslations
Reads all translations for a given field- Parameters:
entity
-entityId
-fieldName
-- Returns:
- the list of translations
-
readTranslation
Translation readTranslation(TranslatedEntity entity, String entityId, String fieldName, String localeCode) Reads a translation for the requested parameters. Returns null if there is no translation found- Parameters:
entity
-entityId
-fieldName
-localeCode
-- Returns:
- the translation
-
getEntityId
Get the id for the object. Can take into account hierarchical multitenancy to retrieve the original id.- Parameters:
entityType
-entity
-- Returns:
-
countTranslationEntries
Count the number of translations for the given params.- Parameters:
entityType
-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
Read all the available translations for the given params.- Parameters:
entityType
-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
List<Translation> readAllTranslationEntries(TranslatedEntity entityType, ResultType stage, List<String> entityIds) Read all the available translations for the given params.- Parameters:
entityType
-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
List<StandardCacheItem> readConvertedTranslationEntries(TranslatedEntity entityType, ResultType stage) Read all translation entries (seereadAllTranslationEntries(org.broadleafcommerce.common.i18n.domain.TranslatedEntity, org.broadleafcommerce.common.extension.ResultType)
), and convert those results into a list ofStandardCacheItem
instances.- Parameters:
entityType
-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
Translation readTranslation(TranslatedEntity entityType, String entityId, String fieldName, String localeCode, String localeCountryCode, ResultType stage) Read a specific translation for the given params.- Parameters:
entityType
-entityId
-fieldName
-localeCode
-localeCountryCode
-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:
-