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 TypeMethodDescriptionvoid
void
Archive a list of translations based on the passed primary keys.protected jakarta.persistence.criteria.Predicate
buildNonProductionTrackingLevelFilter
(@NonNull jakarta.persistence.criteria.Root<?> entity, @NonNull jakarta.persistence.criteria.CriteriaBuilder builder) Builds aPredicate
for non-production tracking level.protected jakarta.persistence.criteria.Predicate
buildNotArchivedFilter
(@NonNull jakarta.persistence.criteria.Root<?> entity, @NonNull jakarta.persistence.criteria.CriteriaBuilder builder) protected jakarta.persistence.criteria.Predicate
buildProductionTrackingLevelFilter
(@NonNull jakarta.persistence.criteria.Root<?> entity, @NonNull jakarta.persistence.criteria.CriteriaBuilder builder) protected jakarta.persistence.criteria.Predicate
buildTenantIdFilter
(@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) long
countNonProductionRecordsByEntityInTenant
(@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.EntityManager
protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper
protected TranslationCommonProperties
protected TranslationRepository<D>
protected String
getTenantIdFromContext
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) void
setProperties
(TranslationCommonProperties properties) void
setRepository
(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:
afterPropertiesSet
in 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:CustomizedTranslationRepository
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.
- Specified by:
countNonProductionRecordsByEntityInTenant
in 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 information
related 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:CustomizedTranslationRepository
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.- Specified by:
findAll
in 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 information
related to multitenancy.- Returns:
- the translations for the given entity field.
-
archive
Description copied from interface:CustomizedTranslationRepository
Archive a list of translations based on the passed primary keys.- Specified by:
archive
in 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:CustomizedTranslationRepository
Finds the translations for the given entity info.- Specified by:
findAllByEntityTypeAndEntityIdIn
in 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 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
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:CustomizedTranslationRepository
Finds the translations for multiple entities.- Specified by:
findAllByEntityTypeAndEntityIdInAndLocaleIn
in 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 information
related 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 aPredicate
for 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
-