Class DefaultAirlineWsContextInformationLoaderV2

java.lang.Object
de.hybris.platform.coreairlinecommonsocc.context.impl.DefaultAirlineWsContextInformationLoaderV2
All Implemented Interfaces:
AirlineContextInformationLoader

public class DefaultAirlineWsContextInformationLoaderV2 extends Object implements AirlineContextInformationLoader
Default context information loader
  • Constructor Details

    • DefaultAirlineWsContextInformationLoaderV2

      public DefaultAirlineWsContextInformationLoaderV2()
  • Method Details

    • setLanguageFromRequest

      public LanguageModel setLanguageFromRequest(javax.servlet.http.HttpServletRequest request) throws UnsupportedLanguageWsException
      This method sets the locale language from Accept-Language in the Request Header. Examples of Accept-Language syntax: Accept-Language: de Accept-Language: de-CH Accept-Language: en-US,en;q=0.5 Accept-Language: fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5 (Multiple types, weighted with the quality value syntax)
      Specified by:
      setLanguageFromRequest in interface AirlineContextInformationLoader
      Parameters:
      request - the request from which we should get language information
      Returns:
      the language to be set in the system
      Throws:
      UnsupportedLanguageWsException
    • setCurrencyFromRequest

      public CurrencyModel setCurrencyFromRequest(javax.servlet.http.HttpServletRequest request) throws UnsupportedCurrencyWsException, RecalculationWsException
      Description copied from interface: AirlineContextInformationLoader
      Method set current currency based on information from request and recalculate cart for current session
      Specified by:
      setCurrencyFromRequest in interface AirlineContextInformationLoader
      Parameters:
      request - - request from which we should get currency information
      Returns:
      currency set as current
      Throws:
      UnsupportedCurrencyWsException
      RecalculationWsException
    • initializeSiteFromRequest

      public BaseSiteModel initializeSiteFromRequest(javax.servlet.http.HttpServletRequest request) throws InvalidResourceWsException
      Method resolves base site uid from request URL and set it as current site i.e
      /rest/v1/mysite/cart, or
      /rest/v1/mysite/customers/current
      would try to set base site with uid=mysite as a current site.

      One should define the path which is expected to be before the site resource in the project properties file (commercewebservices.rootcontext).
      Default and fallback value equals to /rest/v1/

      Method uses also a comma separated list of url special characters that are used to parse the site id resource. You can reconfigure it in properties file (commercewebservices.url.special.characters). The default and fallback value is equal to "?,/".

      Method will throw InvalidResourceException if it fails to find the site which is in the resource url.
      However, you can configure exceptions that doesn't require the site mapping in the resource path. You can configure them in a spring bean called 'baseFilterResourceExceptions'.

      Specified by:
      initializeSiteFromRequest in interface AirlineContextInformationLoader
      Parameters:
      request - - request from which we should get base site uid
      Returns:
      baseSite set as current site or null
      Throws:
      InvalidResourceWsException
    • getRequestMapping

      protected String getRequestMapping(String queryString)
      Get the request mapping from the input.
      Parameters:
      queryString -
      Returns:
      request mapping
    • isNotBaseSiteResource

      protected boolean isNotBaseSiteResource(String requestMapping)
      Validates the input for baseSite resource exception.
      Parameters:
      requestMapping -
      Returns:
      true if url is not base site resource
    • parseBaseSiteId

      protected String parseBaseSiteId(String requestMapping)
      Get the baseSiteId from the request mapping.
      Parameters:
      requestMapping -
      Returns:
      baseSiteId
    • getSpecialUrlCharacters

      protected String[] getSpecialUrlCharacters()
      get the special url characters from the configuration.
      Returns:
      special url characters
    • setCurrentBaseSite

      protected void setCurrentBaseSite(BaseSiteModel baseSiteModel)
      Sets the given bases site in the session.
      Parameters:
      baseSiteModel -
    • isExcludedURL

      protected boolean isExcludedURL(String path)
      This method check whether the given path is part of excluded url as configured in the properties file.
      Parameters:
      path -
      Returns:
      true if url is excluded
    • getExcludedUrls

      protected String[] getExcludedUrls()
      Gets excluded urls.
      Returns:
      excluded url
    • getStoresLanguages

      protected Collection<LanguageModel> getStoresLanguages(BaseStoreModel currentBaseStore)
      Gets the stores languages from the base store.
      Parameters:
      currentBaseStore -
      Returns:
      languages
    • getConfigurationService

      public de.hybris.platform.servicelayer.config.ConfigurationService getConfigurationService()
      Gets configurationService.
      Returns:
      the configuration service
    • setConfigurationService

      public void setConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService)
      Sets the configurationService
      Parameters:
      configurationService -
    • getBaseSiteResourceExceptions

      public Set<String> getBaseSiteResourceExceptions()
      Gets baseSiteResourceExceptions.
      Returns:
      the base Site Resource Exceptions
    • setBaseSiteResourceExceptions

      public void setBaseSiteResourceExceptions(Set<String> baseSiteResourceExceptions)
      Sets the baseSiteResourceExceptions
      Parameters:
      baseSiteResourceExceptions -
    • getBaseSiteService

      public de.hybris.platform.site.BaseSiteService getBaseSiteService()
      Gets baseSiteService.
      Returns:
      the base site Service
    • setBaseSiteService

      public void setBaseSiteService(de.hybris.platform.site.BaseSiteService baseSiteService)
      Sets the base Site Service
      Parameters:
      baseSiteService -
    • getActivateBaseSiteInSessionStrategy

      public de.hybris.platform.basecommerce.strategies.ActivateBaseSiteInSessionStrategy<BaseSiteModel> getActivateBaseSiteInSessionStrategy()
      Gets the activate BaseSite In SessionStrategy

      return activateBaseSiteInSessionStrategy

    • setActivateBaseSiteInSessionStrategy

      public void setActivateBaseSiteInSessionStrategy(de.hybris.platform.basecommerce.strategies.ActivateBaseSiteInSessionStrategy<BaseSiteModel> activateBaseSiteInSessionStrategy)
      Sets the activate BaseSite In SessionStrategy
      Parameters:
      activateBaseSiteInSessionStrategy -
    • getCommonI18NService

      public de.hybris.platform.servicelayer.i18n.CommonI18NService getCommonI18NService()
      Gets commonI18NService.
      Returns:
      the commonI18NService
    • setCommonI18NService

      public void setCommonI18NService(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService)
      Sets the common I18N Service
      Parameters:
      commonI18NService -
    • getCommerceCommonI18NService

      public de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService getCommerceCommonI18NService()
      Gets commerceCommonI18NService.
      Returns:
      the commerce Common I18NService
    • setCommerceCommonI18NService

      public void setCommerceCommonI18NService(de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService commerceCommonI18NService)
      Sets the commerce Common I18N Service
      Parameters:
      commerceCommonI18NService -
    • getBaseStoreService

      public de.hybris.platform.store.services.BaseStoreService getBaseStoreService()
      Gets base store service.
      Returns:
      the base store service
    • setBaseStoreService

      public void setBaseStoreService(de.hybris.platform.store.services.BaseStoreService baseStoreService)
      Sets the base store Service
      Parameters:
      baseStoreService -
    • getCartService

      public de.hybris.platform.order.CartService getCartService()
      Gets cart service.
      Returns:
      the cart service
    • setCartService

      public void setCartService(de.hybris.platform.order.CartService cartService)
      Sets the cart service
      Parameters:
      cartService -
    • getCalculationService

      public de.hybris.platform.order.CalculationService getCalculationService()
      Gets the calculation service
      Returns:
      calculationService
    • setCalculationService

      public void setCalculationService(de.hybris.platform.order.CalculationService calculationService)
      Sets the calculationService
      Parameters:
      calculationService -
    • getErrorCodeResolver

      protected ErrorCodeResolver getErrorCodeResolver()
      Gets error code resolver.
      Returns:
      the error code resolver
    • setErrorCodeResolver

      public void setErrorCodeResolver(ErrorCodeResolver errorCodeResolver)
      Sets error code resolver.
      Parameters:
      errorCodeResolver - the error code resolver