Interface CustomizedTranslationRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
- All Known Subinterfaces:
JpaTranslationRepository<D>
,TranslationRepository<D>
- All Known Implementing Classes:
JpaCustomizedTranslationRepository
public interface CustomizedTranslationRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
Additional functionality for a
TranslationRepository
.- Author:
- Sunny Yu
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Archive a list of translations based on the passed primary keys.long
countNonProductionRecordsByEntityInTenant
(String entityType, String entityId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Returns the count of non-production records that match the given entity info and the given tenant context.findAll
(String entityType, String entityId, String entityField, Locale locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Find All translations matching down to the field and locale.findAllByEntityTypeAndEntityIdIn
(String entityType, List<String> entityIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds the translations for the given entity info.findAllByEntityTypeAndEntityIdInAndLocaleIn
(String entityType, List<String> entityIds, List<Locale> locales, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds the translations for multiple entities.
-
Method Details
-
countNonProductionRecordsByEntityInTenant
@Policy(operationTypes=READ) long countNonProductionRecordsByEntityInTenant(String entityType, String entityId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Returns the count of non-production records that match the given entity info and the given tenant context.This is useful to determine if there are outstanding sandbox changes before an entity can be deleted. For example, this is used for checking if any outstanding sandbox changes exist for Product translations before the Product can be deleted.
- Parameters:
entityType
- The type of the entity such as PRODUCT, CATEGORY, or OFFER.entityId
- The context ID of the entity.context
-context information
related to multitenancy.- Returns:
- the count of non-production records that match the given entity info and the given tenant context.
-
findAll
@Policy(operationTypes=READ) Stream<D> findAll(String entityType, String entityId, String entityField, Locale locale, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Find All translations matching down to the field and locale. Under normal circumstances, there should only be one (or one per catalog). However, if there are duplicates, they will be exposed in the results.- Parameters:
entityType
- The type of the entity such as PRODUCT, CATEGORY, or OFFER.entityId
- The context ID of the entity.entityField
- The name of the field on the entity to which the translation applies.locale
- The translation's locale.context
-context information
related to multitenancy.- Returns:
- the translations for the given entity field.
-
archive
Archive a list of translations based on the passed primary keys.- Parameters:
ids
- The primary keys belonging to the translations to archive
-
findAllByEntityTypeAndEntityIdIn
@Policy(operationTypes=READ) List<D> findAllByEntityTypeAndEntityIdIn(String entityType, List<String> entityIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds the translations for the given entity info.- Parameters:
entityType
- The type of the entity such as PRODUCT, CATEGORY, or OFFER.entityIds
- The context IDs of the entitiescontext
-context information
related to multitenancy. Often used to validate visibility and mutability of persistence operations for a catalog.- Returns:
- the translations for the given entities
-
findAllByEntityTypeAndEntityIdInAndLocaleIn
@Policy(operationTypes=READ) List<D> findAllByEntityTypeAndEntityIdInAndLocaleIn(String entityType, List<String> entityIds, List<Locale> locales, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds the translations for multiple entities.- Parameters:
entityType
- The type of the entity such as PRODUCT, CATEGORY, or OFFER.entityIds
- The context IDs of multiple entities to check.locales
- The translation's locale(s).context
-context information
related to multitenancy. Often used to validate visibility and mutability of persistence operations for a catalog.- Returns:
- the translations for the requested entities.
-