Class DefaultContextRequestHydrator
java.lang.Object
com.broadleafcommerce.data.tracking.core.web.DefaultContextRequestHydrator
- All Implemented Interfaces:
ContextRequestHydrator
,org.springframework.core.Ordered
Looks up partial data passed in through a
ContextRequest
like through an API or other
integration and hydrates all of the data within the ContextRequest
- Author:
- Phillip Verheyden (phillipuniverse)
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
determineCatalog
(ContextRequest request) Given the requested catalog id (ContextRequest.getCatalogId()
), figure out the correct Catalog instance to set on the ContextRequest.protected Application
fetchFromCache
(String applicationId, boolean processCatalog, boolean isProductionRequest) hydrate
(ContextRequest dehydrated) Hydrates a ContextRequest with all of the hierarchical tenant data necessary to drive a discriminated request.void
setApplicationService
(CommonApplicationService<Application> applicationService) An optional application service used to initializeContextRequest.setApplication(Application)
from a givenContextRequest.getApplicationId()
void
setAttributesConverter
(org.springframework.core.convert.converter.Converter<org.springframework.security.core.Authentication, Map<String, Object>> attributesConverter) Set the appropriate attributes converter for the policy utils.void
setCatalogService
(CommonCatalogService<Catalog> catalogService) An optional catalog service used to initializeContextRequest.setCatalog(Catalog)
from a givenContextRequest.getCatalogId()
void
setDataRouteReference
(com.broadleafcommerce.common.extension.data.DataRouteReference reference) void
setEnvironment
(org.springframework.core.env.Environment environment) protected void
setupCurrentCatalog
(ContextRequest request) Establish theContextRequest.getCatalogHierarchy()
()} andContextRequest.getCatalogLevel()
values.protected void
setupSiteInheritanceLines
(Application application) Establish theApplication.getInheritanceLines()
valueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator
getOrder
-
Constructor Details
-
DefaultContextRequestHydrator
public DefaultContextRequestHydrator()
-
-
Method Details
-
setApplicationService
@Autowired public void setApplicationService(@Nullable CommonApplicationService<Application> applicationService) An optional application service used to initializeContextRequest.setApplication(Application)
from a givenContextRequest.getApplicationId()
- Parameters:
applicationService
- a service that can give fully-initializedApplication
s
-
setCatalogService
An optional catalog service used to initializeContextRequest.setCatalog(Catalog)
from a givenContextRequest.getCatalogId()
- Parameters:
catalogService
- a service that can give fully-initializedCatalog
s
-
setDataRouteReference
@Autowired public void setDataRouteReference(@Nullable com.broadleafcommerce.common.extension.data.DataRouteReference reference) -
setEnvironment
@Autowired public void setEnvironment(@Nullable org.springframework.core.env.Environment environment) -
setAttributesConverter
@Autowired @Qualifier("authenticationAttributesConverter") public void setAttributesConverter(@Nullable org.springframework.core.convert.converter.Converter<org.springframework.security.core.Authentication, Map<String, Object>> attributesConverter) Set the appropriate attributes converter for the policy utils.- Parameters:
attributesConverter
- the attributes converter to set on policy utils
-
hydrate
Hydrates a ContextRequest with all of the hierarchical tenant data necessary to drive a discriminated request. For instance, ifContextRequest.getApplicationId()
is non-empty, this will attempt to initializeContextRequest.setApplication(Application)
from the data store, overwriting any previously-set value.- Specified by:
hydrate
in interfaceContextRequestHydrator
- Parameters:
dehydrated
- a context request that does not have full data initialized on it- Returns:
- a fully-hydrated ContextRequest assuming that the hydration parameters were non-null
-
fetchFromCache
protected Application fetchFromCache(String applicationId, boolean processCatalog, boolean isProductionRequest) -
setupCurrentCatalog
Establish theContextRequest.getCatalogHierarchy()
()} andContextRequest.getCatalogLevel()
values.- Parameters:
request
- the request context
-
determineCatalog
Given the requested catalog id (ContextRequest.getCatalogId()
), figure out the correct Catalog instance to set on the ContextRequest. For example, for standard sites, the catalog will generally be the implicit catalog assigned to the site for the requested catalog. For global sites, the catalog will generally be the same as what was requested.- Parameters:
request
- the request context
-
setupSiteInheritanceLines
Establish theApplication.getInheritanceLines()
value- Parameters:
application
- The recently fetched application instance
-