@Service(value="blCatalogAccessPolicyService") public class CatalogAccessPolicyServiceImpl extends Object implements CatalogAccessPolicyService
Modifier and Type | Field and Description |
---|---|
protected com.broadleafcommerce.customersegment.service.CustomerSegmentService |
customerSegmentService |
protected CatalogAccessPolicyServiceExtensionManager |
extensionManager |
protected org.broadleafcommerce.core.search.dao.IndexFieldDao |
indexFieldDao |
protected CatalogAccessPolicyDao |
policyDao |
Constructor and Description |
---|
CatalogAccessPolicyServiceImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
attachCatalogAccessPolicyFiltersIfPossible(org.broadleafcommerce.core.search.service.solr.SearchContextDTO context,
org.apache.solr.client.solrj.SolrQuery solrQuery)
This method is responsible for creating and attaching the filter queries for any catalog access policies.
|
protected Collection<String> |
convertAdditionalRuleToFilters(CatalogAccessPolicy policy,
String key,
String matchRule)
Default method called when matching fields that are not one of the defaults.
|
protected Collection<String> |
convertCategoryRuleToFilters(String matchRule) |
protected Collection<String> |
convertProductRuleToFilters(String matchRule) |
List<String> |
createSolrFiltersForPolicy(CatalogAccessPolicy policy)
This method generates the filter queries for
SolrQuery to filter search results. |
List<CatalogAccessPolicy> |
findAllActivePolicies()
This method retrieves all of the active policies and orders them by priority.
|
CatalogAccessPolicy |
findById(Long id)
This retrieves the
CatalogAccessPolicy by primary key. |
CatalogAccessPolicy |
findCatalogAccessPolicyForCustomer(org.broadleafcommerce.profile.core.domain.Customer customer)
This method retrieves the highest priority policy for the given customer.
|
protected String |
getCustomFieldPropertyName(String mvelRule) |
protected String |
getCustomFieldValue(String mvelRule) |
protected boolean |
isValidPolicy(CatalogAccessPolicy policy,
org.broadleafcommerce.profile.core.domain.Customer customer) |
protected boolean |
isWildCardSearch(String fieldValue)
Determines if the given field value string represents a wild card search.
|
protected boolean |
validateCategoryForAdditionalRule(CatalogAccessPolicy policy,
org.broadleafcommerce.core.catalog.domain.Category category,
String key,
String matchRule)
Validates the category for any additional fields that are not one of the defaults.
|
boolean |
validateCategoryForPolicy(CatalogAccessPolicy policy,
org.broadleafcommerce.core.catalog.domain.Category category)
This method evaluates whether the given
Category is valid for the given CatalogAccessPolicy . |
protected boolean |
validateProductForAdditionalRule(CatalogAccessPolicy policy,
org.broadleafcommerce.core.catalog.domain.Product product,
String key,
String matchRule)
Validates the category for any additional fields that are not one of the defaults.
|
boolean |
validateProductForPolicy(CatalogAccessPolicy policy,
org.broadleafcommerce.core.catalog.domain.Product product)
This method evaluates whether the given
Product is valid for the given CatalogAccessPolicy . |
protected CatalogAccessPolicyDao policyDao
protected com.broadleafcommerce.customersegment.service.CustomerSegmentService customerSegmentService
protected org.broadleafcommerce.core.search.dao.IndexFieldDao indexFieldDao
protected CatalogAccessPolicyServiceExtensionManager extensionManager
public CatalogAccessPolicy findById(Long id)
CatalogAccessPolicyService
CatalogAccessPolicy
by primary key.findById
in interface CatalogAccessPolicyService
id
- the primary keypublic List<CatalogAccessPolicy> findAllActivePolicies()
CatalogAccessPolicyService
findAllActivePolicies
in interface CatalogAccessPolicyService
public CatalogAccessPolicy findCatalogAccessPolicyForCustomer(org.broadleafcommerce.profile.core.domain.Customer customer)
CatalogAccessPolicyService
findCatalogAccessPolicyForCustomer
in interface CatalogAccessPolicyService
customer
- the Customer
CatalogAccessPolicy
protected boolean isValidPolicy(CatalogAccessPolicy policy, org.broadleafcommerce.profile.core.domain.Customer customer)
public boolean validateProductForPolicy(CatalogAccessPolicy policy, org.broadleafcommerce.core.catalog.domain.Product product)
CatalogAccessPolicyService
Product
is valid for the given CatalogAccessPolicy
.validateProductForPolicy
in interface CatalogAccessPolicyService
policy
- the policyproduct
- the product to check if validprotected boolean validateProductForAdditionalRule(CatalogAccessPolicy policy, org.broadleafcommerce.core.catalog.domain.Product product, String key, String matchRule)
policy
- the CatalogAccessPolicy
product
- the Product
key
- the field key for the rulematchRule
- the mvel expressionpublic boolean validateCategoryForPolicy(CatalogAccessPolicy policy, org.broadleafcommerce.core.catalog.domain.Category category)
CatalogAccessPolicyService
Category
is valid for the given CatalogAccessPolicy
.validateCategoryForPolicy
in interface CatalogAccessPolicyService
policy
- the policycategory
- the category to check if validprotected boolean validateCategoryForAdditionalRule(CatalogAccessPolicy policy, org.broadleafcommerce.core.catalog.domain.Category category, String key, String matchRule)
policy
- the CatalogAccessPolicy
category
- the Category
key
- the field key for the rulematchRule
- the mvel expression @return whether the category is valid for the additional rulepublic boolean attachCatalogAccessPolicyFiltersIfPossible(org.broadleafcommerce.core.search.service.solr.SearchContextDTO context, org.apache.solr.client.solrj.SolrQuery solrQuery)
CatalogAccessPolicyService
attachCatalogAccessPolicyFiltersIfPossible
in interface CatalogAccessPolicyService
context
- the SearchContextDTO
for the search querysolrQuery
- the SolrQuery
public List<String> createSolrFiltersForPolicy(CatalogAccessPolicy policy)
CatalogAccessPolicyService
SolrQuery
to filter search results.createSolrFiltersForPolicy
in interface CatalogAccessPolicyService
policy
- the policyprotected Collection<String> convertAdditionalRuleToFilters(CatalogAccessPolicy policy, String key, String matchRule)
policy
- the CatalogAccessPolicy
key
- the field key for the rulematchRule
- the mvel expressionprotected Collection<String> convertCategoryRuleToFilters(String matchRule)
protected Collection<String> convertProductRuleToFilters(String matchRule)
protected boolean isWildCardSearch(String fieldValue)
fieldValue
- the String field valueCopyright © 2019. All rights reserved.