Class JpaSkuInventoryVendorVisibilityHandler
- java.lang.Object
-
- com.broadleafcommerce.inventory.provider.jpa.marketplace.JpaSkuInventoryVendorVisibilityHandler
-
- All Implemented Interfaces:
com.broadleafcommerce.common.extension.data.DataRoutePartitionAware
,com.broadleafcommerce.data.tracking.core.marketplace.vendor.visibility.VendorVisibilityHandler
,org.springframework.core.Ordered
public class JpaSkuInventoryVendorVisibilityHandler extends Object implements com.broadleafcommerce.data.tracking.core.marketplace.vendor.visibility.VendorVisibilityHandler
Responsible for performing vendor-visibility operations onSkuInventory
entities.
-
-
Constructor Summary
Constructors Constructor Description JpaSkuInventoryVendorVisibilityHandler(int order, String dataRoutePartition)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandle(@NonNull Class<?> persistedDomainEntityType)
If thepersistedDomainEntityType
isJpaSkuInventory
, this handler supports it.String
createVendorNarrowingFilter(Set<String> restrictedVendorRefs, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Build aNode
filter string that can be used in queries forJpaSkuInventorys
that restricts results to only include data withJpaSkuInventory.getVendorRef()
matching therestrictedVendorRefs
.String
getAssociatedVendorRef(Object persistedDomainEntity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
String
getDataRoutePartition()
Defines the data route in which this vendor visibility handler should apply.int
getOrder()
Defines the priority of this vendor visibility handler in comparison to others injected byVendorVisibilityManager
.boolean
isEntityMutableByVendorRestrictions(Object persistedDomainEntity, Set<String> restrictedVendorRefs, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Given apersistedDomainEntity
, report whether that entity is mutable by the given vendor restrictions.
-
-
-
Constructor Detail
-
JpaSkuInventoryVendorVisibilityHandler
public JpaSkuInventoryVendorVisibilityHandler(int order, String dataRoutePartition)
-
-
Method Detail
-
canHandle
public boolean canHandle(@NonNull @NonNull Class<?> persistedDomainEntityType)
If thepersistedDomainEntityType
isJpaSkuInventory
, this handler supports it.- Specified by:
canHandle
in interfacecom.broadleafcommerce.data.tracking.core.marketplace.vendor.visibility.VendorVisibilityHandler
- Parameters:
persistedDomainEntityType
- the type to check support for- Returns:
- true if the entity is a type of
JpaSkuInventory
, false otherwise
-
isEntityMutableByVendorRestrictions
public boolean isEntityMutableByVendorRestrictions(Object persistedDomainEntity, Set<String> restrictedVendorRefs, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Given apersistedDomainEntity
, report whether that entity is mutable by the given vendor restrictions.A vendor-restricted user can only mutate SKU inventory with non-null
vendorRef
which matches one of theirrestrictedVendorRefs
.- Specified by:
isEntityMutableByVendorRestrictions
in interfacecom.broadleafcommerce.data.tracking.core.marketplace.vendor.visibility.VendorVisibilityHandler
- Parameters:
persistedDomainEntity
- the persisted-domain entity to validate mutability for. This is guaranteed to only be an entity for whichcanHandle(Class)
returns true.restrictedVendorRefs
- the "vendorRef" (typically a vendor ID or code) of all vendors that mutability should be restricted to. Will never be empty.contextInfo
- context information surrounding sandboxing/multitenant state- Returns:
- true if the entity is mutable by the given vendor restrictions, false otherwise
-
createVendorNarrowingFilter
public String createVendorNarrowingFilter(Set<String> restrictedVendorRefs, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Build aNode
filter string that can be used in queries forJpaSkuInventorys
that restricts results to only include data withJpaSkuInventory.getVendorRef()
matching therestrictedVendorRefs
.- Specified by:
createVendorNarrowingFilter
in interfacecom.broadleafcommerce.data.tracking.core.marketplace.vendor.visibility.VendorVisibilityHandler
- Parameters:
restrictedVendorRefs
- the "vendorRef" (typically a vendor ID or code) of all vendors that the results need to be restricted to. Will never be empty.contextInfo
- context information surrounding sandboxing/multitenant state. Some implementations may inform their filtration decisions with this.- Returns:
- a
Node
filter string that can be used to restrict results on supported entity type(s) to only include data from therestrictedVendorRefs
. Cannot return null.
-
getAssociatedVendorRef
@Nullable public String getAssociatedVendorRef(Object persistedDomainEntity, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
- Specified by:
getAssociatedVendorRef
in interfacecom.broadleafcommerce.data.tracking.core.marketplace.vendor.visibility.VendorVisibilityHandler
-
getOrder
public int getOrder()
Defines the priority of this vendor visibility handler in comparison to others injected byVendorVisibilityManager
.- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
- Specified by:
getOrder
in interfacecom.broadleafcommerce.data.tracking.core.marketplace.vendor.visibility.VendorVisibilityHandler
- See Also:
getOrder()
-
getDataRoutePartition
public String getDataRoutePartition()
Defines the data route in which this vendor visibility handler should apply.- Specified by:
getDataRoutePartition
in interfacecom.broadleafcommerce.common.extension.data.DataRoutePartitionAware
-
-