Class DefaultJpaCustomizableFulfillmentPricingConfigRepository<D extends JpaFulfillmentPricingConfig>
java.lang.Object
com.broadleafcommerce.fulfillment.provider.jpa.repository.DefaultJpaCustomizableFulfillmentPricingConfigRepository<D>
- All Implemented Interfaces:
CustomizableFulfillmentPricingConfigRepository<D>
public class DefaultJpaCustomizableFulfillmentPricingConfigRepository<D extends JpaFulfillmentPricingConfig>
extends Object
implements CustomizableFulfillmentPricingConfigRepository<D>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfetchConfig
(BiFunction<jakarta.persistence.criteria.CriteriaBuilder, jakarta.persistence.criteria.Root<JpaFulfillmentPricingConfig>, jakarta.persistence.criteria.Predicate[]> predicateFunction) Create and execute a select query for JpaFulfillmentPricingConfig.getApplicationConfigsOnly
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Fetch a List ofJpaFulfillmentPricingConfig
for the current application.protected jakarta.persistence.criteria.Predicate[]
getApplicationOnlyPredicate
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<JpaFulfillmentPricingConfig> root) Get a predicate to filter for configs whose application matches the current context.protected jakarta.persistence.EntityManager
protected jakarta.persistence.criteria.Predicate
getNotArchivedPredicate
(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<JpaFulfillmentPricingConfig> root) Get a predicate to select for entities that are not archived.getTenantConfigsOnly
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Fetch a List ofJpaFulfillmentPricingConfig
for the current tenant that are not owned by an application.protected jakarta.persistence.criteria.Predicate[]
getTenantOnlyPredicate
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<JpaFulfillmentPricingConfig> root) Get a predicate to filter for configs whose tenant matches the current context and application is null.
-
Constructor Details
-
DefaultJpaCustomizableFulfillmentPricingConfigRepository
public DefaultJpaCustomizableFulfillmentPricingConfigRepository()
-
-
Method Details
-
getApplicationConfigsOnly
public List<D> getApplicationConfigsOnly(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:CustomizableFulfillmentPricingConfigRepository
Fetch a List ofJpaFulfillmentPricingConfig
for the current application. This does not return results owned by the tenant.- Specified by:
getApplicationConfigsOnly
in interfaceCustomizableFulfillmentPricingConfigRepository<D extends JpaFulfillmentPricingConfig>
- Parameters:
context
- The context of the request.- Returns:
- A List of
JpaFulfillmentPricingConfig
for the current application.
-
getTenantConfigsOnly
public List<D> getTenantConfigsOnly(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:CustomizableFulfillmentPricingConfigRepository
Fetch a List ofJpaFulfillmentPricingConfig
for the current tenant that are not owned by an application.- Specified by:
getTenantConfigsOnly
in interfaceCustomizableFulfillmentPricingConfigRepository<D extends JpaFulfillmentPricingConfig>
- Parameters:
context
- The context of the request.- Returns:
- A List of
JpaFulfillmentPricingConfig
for the current tenant.
-
getApplicationOnlyPredicate
protected jakarta.persistence.criteria.Predicate[] getApplicationOnlyPredicate(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<JpaFulfillmentPricingConfig> root) Get a predicate to filter for configs whose application matches the current context.- Parameters:
context
- The context of the request.builder
- TheCriteriaBuilder
for the select query.root
- The root entity of the query.- Returns:
- A predicate to filter by the current application.
-
getTenantOnlyPredicate
protected jakarta.persistence.criteria.Predicate[] getTenantOnlyPredicate(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<JpaFulfillmentPricingConfig> root) Get a predicate to filter for configs whose tenant matches the current context and application is null.- Parameters:
context
- The context of the request.builder
- TheCriteriaBuilder
for the select query.root
- The root entity of the query.- Returns:
- A predicate to filter by current tenant and null application.
-
getNotArchivedPredicate
protected jakarta.persistence.criteria.Predicate getNotArchivedPredicate(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<JpaFulfillmentPricingConfig> root) Get a predicate to select for entities that are not archived.- Parameters:
builder
- TheCriteriaBuilder
for the select query.root
- The root entity of the query.- Returns:
- A predicate to filter by archived equals false.
-
fetchConfig
protected List<D> fetchConfig(BiFunction<jakarta.persistence.criteria.CriteriaBuilder, jakarta.persistence.criteria.Root<JpaFulfillmentPricingConfig>, jakarta.persistence.criteria.Predicate[]> predicateFunction) Create and execute a select query for JpaFulfillmentPricingConfig. The predicate is provided by the given BiFunction.- Parameters:
predicateFunction
- A function to return an array of Predicates for this select query.- Returns:
- A list of results.
-
getEntityManager
protected jakarta.persistence.EntityManager getEntityManager()
-