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 a ContextRequest like through an API or other integration and hydrates all of the data within the ContextRequest
Author:
Phillip Verheyden (phillipuniverse)
See Also:
  • Constructor Details

    • DefaultContextRequestHydrator

      public DefaultContextRequestHydrator()
  • Method Details

    • setApplicationService

      @Autowired public void setApplicationService(@Nullable CommonApplicationService<Application> applicationService)
      An optional application service used to initialize ContextRequest.setApplication(Application) from a given ContextRequest.getApplicationId()
      Parameters:
      applicationService - a service that can give fully-initialized Applications
    • setCatalogService

      @Autowired public void setCatalogService(@Nullable CommonCatalogService<Catalog> catalogService)
      An optional catalog service used to initialize ContextRequest.setCatalog(Catalog) from a given ContextRequest.getCatalogId()
      Parameters:
      catalogService - a service that can give fully-initialized Catalogs
    • 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, if ContextRequest.getApplicationId() is non-empty, this will attempt to initialize ContextRequest.setApplication(Application) from the data store, overwriting any previously-set value.
      Specified by:
      hydrate in interface ContextRequestHydrator
      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)
      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)
      Parameters:
      application - The recently fetched application instance