Class DefaultContextRequestHydrator
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.web.DefaultContextRequestHydrator
-
- All Implemented Interfaces:
ContextRequestHydrator
,org.springframework.core.Ordered
public class DefaultContextRequestHydrator extends Object implements ContextRequestHydrator
Looks up partial data passed in through aContextRequest
like through an API or other integration and hydrates all of the data within theContextRequest
- Author:
- Phillip Verheyden (phillipuniverse)
- See Also:
CommonApplicationService
,CommonCatalogService
-
-
Constructor Summary
Constructors Constructor Description DefaultContextRequestHydrator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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)
ContextRequest
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()
value-
Methods 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
-
-
-
-
Method Detail
-
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
@Autowired public void setCatalogService(@Nullable CommonCatalogService<Catalog> catalogService)
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
public ContextRequest hydrate(ContextRequest dehydrated)
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
protected void setupCurrentCatalog(ContextRequest request)
Establish theContextRequest.getCatalogHierarchy()
()} andContextRequest.getCatalogLevel()
values.- Parameters:
request
- the request context
-
determineCatalog
protected void determineCatalog(ContextRequest request)
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
protected void setupSiteInheritanceLines(Application application)
Establish theApplication.getInheritanceLines()
value- Parameters:
application
- The recently fetched application instance
-
-