Class SearchSettingsUtils
java.lang.Object
com.broadleafcommerce.search.core.utils.SearchSettingsUtils
Utilities to help when working or resolving
SearchSettings
and related entities.- Author:
- Nathan Moore (nathandmoore)
-
Constructor Summary
ConstructorsConstructorDescriptionSearchSettingsUtils
(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, SearchSettingsService<com.broadleafcommerce.search.api.domain.SearchSettings> searchSettingsService, com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator hydrator) -
Method Summary
Modifier and TypeMethodDescriptioncom.broadleafcommerce.data.tracking.core.context.ContextInfo
buildSearchSettingsBasedContextInfo
(@NonNull com.broadleafcommerce.search.api.domain.SearchSettings searchSettings, com.broadleafcommerce.data.tracking.core.context.ContextInfo originalContext) Establish a newContextInfo
based on the resolvedSearchSettings
.Optional<com.broadleafcommerce.search.api.domain.SearchSettings>
determineSearchSettingsForContext
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines the correctSearchSettings
for the context, whether Admin or Storefront.protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils
protected com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator
protected SearchSettingsService<com.broadleafcommerce.search.api.domain.SearchSettings>
-
Constructor Details
-
SearchSettingsUtils
public SearchSettingsUtils(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, SearchSettingsService<com.broadleafcommerce.search.api.domain.SearchSettings> searchSettingsService, com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator hydrator)
-
-
Method Details
-
buildSearchSettingsBasedContextInfo
public com.broadleafcommerce.data.tracking.core.context.ContextInfo buildSearchSettingsBasedContextInfo(@NonNull @NonNull com.broadleafcommerce.search.api.domain.SearchSettings searchSettings, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo originalContext) Establish a newContextInfo
based on the resolvedSearchSettings
. This is useful to correctly filter related facets in the correct Catalog when searching for Products since the Product Catalog passed on the request is different from the Search Group Catalog containing the Search Settings entities.- Parameters:
searchSettings
- TheSearchSettings
resolved for the contextoriginalContext
- The original context info to base some information on for the new one.- Returns:
- A new
ContextInfo
for reading search settings entities.
-
determineSearchSettingsForContext
public Optional<com.broadleafcommerce.search.api.domain.SearchSettings> determineSearchSettingsForContext(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines the correctSearchSettings
for the context, whether Admin or Storefront.- Parameters:
contextInfo
- Additional context information regarding the current API request.- Returns:
- The correct
SearchSettings
for the context, whether Admin or Storefront.
-
getAuthenticationUtils
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils() -
getSearchSettingsService
protected SearchSettingsService<com.broadleafcommerce.search.api.domain.SearchSettings> getSearchSettingsService() -
getHydrator
protected com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator getHydrator()
-