Class JpaCustomizedTranslationRepository<D extends JpaTranslation>
java.lang.Object
com.broadleafcommerce.translation.provider.jpa.repository.JpaCustomizedTranslationRepository<D>
- All Implemented Interfaces:
 CustomizedTranslationRepository<D>,org.springframework.beans.factory.InitializingBean
public class JpaCustomizedTranslationRepository<D extends JpaTranslation>
extends Object
implements CustomizedTranslationRepository<D>, org.springframework.beans.factory.InitializingBean
- Author:
 - Sunny Yu
 
- 
Field Summary
Fields - 
Constructor Summary
ConstructorsConstructorDescriptionJpaCustomizedTranslationRepository(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder filterRulesCriteriaBuilder, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager)  - 
Method Summary
Modifier and TypeMethodDescriptionvoidvoidArchive a list of translations based on the passed primary keys.protected jakarta.persistence.criteria.PredicatebuildNonProductionTrackingLevelFilter(@NonNull jakarta.persistence.criteria.Root<?> entity, @NonNull jakarta.persistence.criteria.CriteriaBuilder builder) Builds aPredicatefor non-production tracking level.protected jakarta.persistence.criteria.PredicatebuildNotArchivedFilter(@NonNull jakarta.persistence.criteria.Root<?> entity, @NonNull jakarta.persistence.criteria.CriteriaBuilder builder) protected jakarta.persistence.criteria.PredicatebuildProductionTrackingLevelFilter(@NonNull jakarta.persistence.criteria.Root<?> entity, @NonNull jakarta.persistence.criteria.CriteriaBuilder builder) protected jakarta.persistence.criteria.PredicatebuildTenantIdFilter(@NonNull jakarta.persistence.criteria.Root<?> entity, @NonNull jakarta.persistence.criteria.CriteriaBuilder builder, @NonNull Map<String, Object> params, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) longcountNonProductionRecordsByEntityInTenant(@NonNull String entityType, @NonNull 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.protected jakarta.persistence.EntityManagerprotected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelperprotected TranslationCommonPropertiesprotected TranslationRepository<D>protected StringgetTenantIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) voidsetProperties(TranslationCommonProperties properties) voidsetRepository(TranslationRepository<D> repository)  
- 
Field Details
- 
TENANT
- See Also:
 
 - 
ENTITY_TYPE
- See Also:
 
 - 
ENTITY_FIELD
- See Also:
 
 - 
ENTITY_ID
- See Also:
 
 - 
LOCALE
- See Also:
 
 - 
IDS
- See Also:
 
 - 
LAST_ID
- See Also:
 
 
 - 
 - 
Constructor Details
- 
JpaCustomizedTranslationRepository
public JpaCustomizedTranslationRepository(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder filterRulesCriteriaBuilder, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager)  
 - 
 - 
Method Details
- 
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
 afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
 - 
countNonProductionRecordsByEntityInTenant
public long countNonProductionRecordsByEntityInTenant(@NonNull @NonNull String entityType, @NonNull @NonNull String entityId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:CustomizedTranslationRepositoryReturns 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.
- Specified by:
 countNonProductionRecordsByEntityInTenantin interfaceCustomizedTranslationRepository<D extends JpaTranslation>- Parameters:
 entityType- The type of the entity such as PRODUCT, CATEGORY, or OFFER.entityId- The context ID of the entity.context-context informationrelated to multitenancy.- Returns:
 - the count of non-production records that match the given entity info and the given tenant context.
 
 - 
findAll
public Stream<D> findAll(String entityType, String entityId, String entityField, Locale locale, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:CustomizedTranslationRepositoryFind 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.- Specified by:
 findAllin interfaceCustomizedTranslationRepository<D extends JpaTranslation>- 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 informationrelated to multitenancy.- Returns:
 - the translations for the given entity field.
 
 - 
archive
Description copied from interface:CustomizedTranslationRepositoryArchive a list of translations based on the passed primary keys.- Specified by:
 archivein interfaceCustomizedTranslationRepository<D extends JpaTranslation>- Parameters:
 ids- The primary keys belonging to the translations to archive
 - 
findAllByEntityTypeAndEntityIdIn
public List<D> findAllByEntityTypeAndEntityIdIn(String entityType, List<String> entityIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:CustomizedTranslationRepositoryFinds the translations for the given entity info.- Specified by:
 findAllByEntityTypeAndEntityIdInin interfaceCustomizedTranslationRepository<D extends JpaTranslation>- Parameters:
 entityType- The type of the entity such as PRODUCT, CATEGORY, or OFFER.entityIds- The context IDs of the entitiescontext-context informationrelated to multitenancy. Often used to validate visibility and mutability of persistence operations for a catalog.- Returns:
 - the translations for the given entities
 
 - 
findAllByEntityTypeAndEntityIdInAndLocaleIn
public List<D> findAllByEntityTypeAndEntityIdInAndLocaleIn(String entityType, List<String> entityIds, List<Locale> locales, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:CustomizedTranslationRepositoryFinds the translations for multiple entities.- Specified by:
 findAllByEntityTypeAndEntityIdInAndLocaleInin interfaceCustomizedTranslationRepository<D extends JpaTranslation>- 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 informationrelated to multitenancy. Often used to validate visibility and mutability of persistence operations for a catalog.- Returns:
 - the translations for the requested entities.
 
 - 
buildNonProductionTrackingLevelFilter
protected jakarta.persistence.criteria.Predicate buildNonProductionTrackingLevelFilter(@NonNull @NonNull jakarta.persistence.criteria.Root<?> entity, @NonNull @NonNull jakarta.persistence.criteria.CriteriaBuilder builder) Builds aPredicatefor non-production tracking level. - 
buildProductionTrackingLevelFilter
protected jakarta.persistence.criteria.Predicate buildProductionTrackingLevelFilter(@NonNull @NonNull jakarta.persistence.criteria.Root<?> entity, @NonNull @NonNull jakarta.persistence.criteria.CriteriaBuilder builder)  - 
buildTenantIdFilter
protected jakarta.persistence.criteria.Predicate buildTenantIdFilter(@NonNull @NonNull jakarta.persistence.criteria.Root<?> entity, @NonNull @NonNull jakarta.persistence.criteria.CriteriaBuilder builder, @NonNull @NonNull Map<String, Object> params, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
buildNotArchivedFilter
protected jakarta.persistence.criteria.Predicate buildNotArchivedFilter(@NonNull @NonNull jakarta.persistence.criteria.Root<?> entity, @NonNull @NonNull jakarta.persistence.criteria.CriteriaBuilder builder)  - 
getTenantIdFromContext
@Nullable protected String getTenantIdFromContext(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
getManagedType
 - 
getNarrowingHelper
protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper getNarrowingHelper() - 
getEntityManager
protected jakarta.persistence.EntityManager getEntityManager() - 
getRepository
 - 
setRepository
 - 
getProperties
 - 
setProperties
 
 -