Class DefaultFulfillmentCalculatorFilterService
java.lang.Object
com.broadleafcommerce.fulfillment.service.DefaultFulfillmentCalculatorFilterService
- All Implemented Interfaces:
FulfillmentCalculatorFilterService
public class DefaultFulfillmentCalculatorFilterService
extends Object
implements FulfillmentCalculatorFilterService
Utility service to take in a List of Calculators and filter them against a provided context.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Predicate<FulfillmentCalculator>
filterCalculatorsByCurrency
(FulfillmentPricingContext pricingContext) Filter calculators based on the currencies on the pricingContext.protected Predicate<FulfillmentCalculator>
Don't consider calculators that are not enabled.protected Predicate<FulfillmentCalculator>
Filter calculators based on fulfillmentTypeprotected Predicate<FulfillmentCalculator>
filterCalculatorsByGroupFulfillmentDestination
(com.broadleafcommerce.fulfillment.common.domain.Address address) Filter calculators based on Addressprotected Predicate<FulfillmentCalculator>
Filter calculators based on inventoryTypeprotected Predicate<FulfillmentCalculator>
Filter calculators based on OriginfilterCalculatorsForGroup
(EnhancedFulfillmentPricingGroup group, List<FulfillmentCalculator> calculators) filterCalculatorsForRequest
(FulfillmentPricingContext pricingContext, List<FulfillmentCalculator> calculators) Get all fulfillment types from all items in the givenEnhancedFulfillmentPricingGroup
.Get all fulfillment types from all items in the givenEnhancedFulfillmentPricingGroup
.protected Set<com.broadleafcommerce.fulfillment.common.domain.FulfillmentOriginInfo>
Get allFulfillmentOriginInfo
from all items in the givenEnhancedFulfillmentPricingGroup
.
-
Constructor Details
-
DefaultFulfillmentCalculatorFilterService
public DefaultFulfillmentCalculatorFilterService()
-
-
Method Details
-
filterCalculatorsForRequest
public List<FulfillmentCalculator> filterCalculatorsForRequest(FulfillmentPricingContext pricingContext, List<FulfillmentCalculator> calculators) - Specified by:
filterCalculatorsForRequest
in interfaceFulfillmentCalculatorFilterService
-
filterCalculatorsForGroup
public List<FulfillmentCalculator> filterCalculatorsForGroup(EnhancedFulfillmentPricingGroup group, List<FulfillmentCalculator> calculators) - Specified by:
filterCalculatorsForGroup
in interfaceFulfillmentCalculatorFilterService
-
filterCalculatorsByEnabled
Don't consider calculators that are not enabled.- Parameters:
now
- The Instant that the calculator should be valid for.- Returns:
- Predicate to evaluate if the calculator is valid for the given time.
-
filterCalculatorsByCurrency
protected Predicate<FulfillmentCalculator> filterCalculatorsByCurrency(FulfillmentPricingContext pricingContext) Filter calculators based on the currencies on the pricingContext.- Parameters:
pricingContext
- The state of the groups and items to be priced- Returns:
- Predicate to evaluate if a calculator matches the currency from the given context
-
filterCalculatorsByOrigin
protected Predicate<FulfillmentCalculator> filterCalculatorsByOrigin(EnhancedFulfillmentPricingGroup group) Filter calculators based on Origin- Parameters:
group
- The group to check- Returns:
- Predicate to evaluate if a calculator matches the given origins
-
filterCalculatorsByFulfillmentType
protected Predicate<FulfillmentCalculator> filterCalculatorsByFulfillmentType(EnhancedFulfillmentPricingGroup group) Filter calculators based on fulfillmentType- Parameters:
group
- The group to check- Returns:
- Predicate to evaluate if a calculator matches the given origins
-
filterCalculatorsByInventoryType
protected Predicate<FulfillmentCalculator> filterCalculatorsByInventoryType(EnhancedFulfillmentPricingGroup group) Filter calculators based on inventoryType- Parameters:
group
- The group to check- Returns:
- Predicate to evaluate if a calculator matches the given origins
-
filterCalculatorsByGroupFulfillmentDestination
protected Predicate<FulfillmentCalculator> filterCalculatorsByGroupFulfillmentDestination(com.broadleafcommerce.fulfillment.common.domain.Address address) Filter calculators based on Address- Parameters:
address
- The address to check.- Returns:
- Predicate to evaluate if a calculator matches the given address.
-
getOriginInfosForGroup
protected Set<com.broadleafcommerce.fulfillment.common.domain.FulfillmentOriginInfo> getOriginInfosForGroup(EnhancedFulfillmentPricingGroup group) Get allFulfillmentOriginInfo
from all items in the givenEnhancedFulfillmentPricingGroup
.- Parameters:
group
- TheEnhancedFulfillmentPricingGroup
to collect origin info from.- Returns:
- All
FulfillmentOriginInfo
from all items in the group.
-
getFulfillmentTypesForGroup
Get all fulfillment types from all items in the givenEnhancedFulfillmentPricingGroup
.- Parameters:
group
- TheEnhancedFulfillmentPricingGroup
to collect fulfillment types from.- Returns:
- All fulfillment types
-
getInventoryTypesForGroup
Get all fulfillment types from all items in the givenEnhancedFulfillmentPricingGroup
.- Parameters:
group
- TheEnhancedFulfillmentPricingGroup
to collect fulfillment types from.- Returns:
- All fulfillment types
-