Class InitialDataAutoConfiguration

java.lang.Object
com.broadleafcommerce.asset.autoconfigure.InitialDataAutoConfiguration
All Implemented Interfaces:
org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

@Configuration @EnableConfigurationProperties(InitialDataProperties.class) @ConditionalOnProperty(prefix="broadleaf.asset.data", name="load-on-startup") public class InitialDataAutoConfiguration extends Object implements org.springframework.context.SmartLifecycle
Configuration class for initializing the base seed data for the app. This will load data from a configurable set of zip files on the filesystem if broadleaf.asset.data.load-on-startup is not false. The process will also spawn a FileUploadState for audit and debugging purposes.
Author:
Nathan Moore (nathandmoore), Nick Crum (ncrum)
  • Constructor Details

  • Method Details

    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle
    • loadInitialDataForFile

      protected void loadInitialDataForFile(InitialDataAutoConfiguration.InitialDataProperties.DataImportFile file)
    • getFileUploadState

      protected Optional<FileUploadState> getFileUploadState(String path, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
      Looks for an existing FileUploadState matching the path or creates one if none found.
      Returns:
      An existing or new FileUploadState for the initial data found at the path
    • getStorageService

      protected StorageService getStorageService()
    • getFileUploadStateService

      protected FileUploadStateService<FileUploadState> getFileUploadStateService()
    • getResourceLoader

      protected org.springframework.core.io.ResourceLoader getResourceLoader()
    • getInitialDataProperties

      protected InitialDataAutoConfiguration.InitialDataProperties getInitialDataProperties()