Class CatalogAccessPolicy
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware,Serializable
Catalog entities can be accessed by the
specified users or request contexts. This will cause entities within the related catalog or the
entire catalog to be filtered for requests besides the normal data tracking filtration.
CatalogAccessPolicies can fit into two types by default: Those
targeting entire Catalogs and those targeting specific contents. Contents are targetable by
setting filterRules for them. The only specific contents that are targetable by default
are Products. For both types, the targeted catalog or contents are only visible to the users or
requests contexts matched by the matchRule.
- Author:
- Nathan Moore (nathandmoore)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanThe date until which the policy should be active.The date from which the policy should be active.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextStateA subset ofTrackinginformation to expose the context state for this object.Filters used by this policy to restrict access to the Catalog entities that match them.getId()Id for the policy.Match rule to evaluate against a context object containing user and request data.getName()Name of the policy.List of the targetCatalog.getId()that this catalog access policy applies to.The target type denoting how to restrict this catalog access policy.inthashCode()voidsetActiveEndDate(Instant activeEndDate) The date until which the policy should be active.voidsetActiveStartDate(Instant activeStartDate) The date from which the policy should be active.voidsetContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.voidsetFilterRules(Map<String, String> filterRules) Filters used by this policy to restrict access to the Catalog entities that match them.voidId for the policy.voidsetMatchRule(String matchRule) Match rule to evaluate against a context object containing user and request data.voidName of the policy.voidsetTargetCatalogIds(List<String> targetCatalogIds) List of the targetCatalog.getId()that this catalog access policy applies to.voidsetTargetType(String targetType) The target type denoting how to restrict this catalog access policy.toString()
-
Constructor Details
-
CatalogAccessPolicy
public CatalogAccessPolicy()
-
-
Method Details
-
getId
Id for the policy.- Returns:
- Id for the policy.
-
getName
Name of the policy.- Returns:
- Name of the policy.
-
getActiveStartDate
The date from which the policy should be active.- Returns:
- The date from which the policy should be active.
-
getActiveEndDate
The date until which the policy should be active. Must be afteractiveStartDate.nullindicates the policy will not stop being active afteractiveStartDate.- Returns:
- The date until which the policy should be active.
-
getFilterRules
Filters used by this policy to restrict access to the Catalog entities that match them. The key specifies the entity type (e.g, PRODUCT or CATEGORY) and the value is an RSQL rule that should be applied for queries against that entity type. By default, only Products are targetable.You can target more entities by creating
CatalogFilterRulesMappingsto map the persistent entity to the key in the appropriate service, e.g., JpaProduct class to the PRODUCT key. This is only used whengetTargetType()isDefaultCatalogAccessPolicyTargetType.PRODUCT.- Returns:
- Rules that should be applied to cause the inclusion of items.
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()A subset ofTrackinginformation to expose the context state for this object.- Specified by:
getContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Returns:
- a subset of
Trackinginformation to expose the context state for this object
-
getTargetType
The target type denoting how to restrict this catalog access policy.- Returns:
- the target type of the catalog access policy.
- See Also:
-
getTargetCatalogIds
List of the targetCatalog.getId()that this catalog access policy applies to. This is only used whengetTargetType()isDefaultCatalogAccessPolicyTargetType.CATALOG.- Returns:
- the list of catalog ids to target.
-
getMatchRule
Match rule to evaluate against a context object containing user and request data. This rule is a SpEL expression.- Returns:
- the match rule to evaluate.
-
setId
Id for the policy.- Parameters:
id- Id for the policy.
-
setName
Name of the policy.- Parameters:
name- Name of the policy.
-
setActiveStartDate
The date from which the policy should be active.- Parameters:
activeStartDate- The date from which the policy should be active.
-
setActiveEndDate
The date until which the policy should be active. Must be afteractiveStartDate.nullindicates the policy will not stop being active afteractiveStartDate.- Parameters:
activeEndDate- The date until which the policy should be active.
-
setFilterRules
Filters used by this policy to restrict access to the Catalog entities that match them. The key specifies the entity type (e.g, PRODUCT or CATEGORY) and the value is an RSQL rule that should be applied for queries against that entity type. By default, only Products are targetable.You can target more entities by creating
CatalogFilterRulesMappingsto map the persistent entity to the key in the appropriate service, e.g., JpaProduct class to the PRODUCT key. This is only used whengetTargetType()isDefaultCatalogAccessPolicyTargetType.PRODUCT.- Parameters:
inclusionFilters- Rules that should be applied to cause the inclusion of items.
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.- Specified by:
setContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Parameters:
contextState- a subset ofTrackinginformation to expose the context state for this object
-
setTargetType
The target type denoting how to restrict this catalog access policy.- Parameters:
targetType- the target type of the catalog access policy.- See Also:
-
setTargetCatalogIds
List of the targetCatalog.getId()that this catalog access policy applies to. This is only used whengetTargetType()isDefaultCatalogAccessPolicyTargetType.CATALOG.- Parameters:
targetCatalogIds- the list of catalog ids to target.
-
setMatchRule
Match rule to evaluate against a context object containing user and request data. This rule is a SpEL expression.- Parameters:
matchRule- the match rule to evaluate.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-