Interface ImportManager

All Known Implementing Classes:
DefaultImportManager

public interface ImportManager
Manages the lifecycle of an import
Author:
Phillip Verheyden (phillipuniverse)
  • Method Summary

    Modifier and Type
    Method
    Description
    com.broadleafcommerce.data.tracking.core.context.ContextInfo
    buildImportingContextInfo(Import metadata, com.broadleafcommerce.data.tracking.core.type.OperationType operationType)
    Convenience method to construct the 'importing' ContextInfo based on the Import metadata.
    initiateImport(ImportRequest request, org.springframework.core.io.InputStreamSource inputStreamSource, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Validates, prepares, and requests an import to be executed from the given request, but does not actually execute the import.
    void
    Begins processing the import by reading the uploaded file and parsing out the items within it.
  • Method Details

    • initiateImport

      Import initiateImport(ImportRequest request, org.springframework.core.io.InputStreamSource inputStreamSource, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)

      Validates, prepares, and requests an import to be executed from the given request, but does not actually execute the import. The output of this is that the import is scheduled and returned back to the caller.

      Emits a ProcessImportRequest.

      Delegates to ImportValidator for validation.

      Parameters:
      request - metadata around where the import will go.

      For each of the "importing context" fields describing where the operation will be performed, the default implementation will first check if the field is supplied in ImportRequest, and if not, use the value from the ContextInfo.

      inputStreamSource - an input stream source for the data that should be used to import
      contextInfo - context information surrounding sandboxing and multitenant state. This is the context from which the operation itself is being initiated.
      Returns:
      the newly created Import if valid
      Throws:
      ImportValidationException - if there is a validation error with the request
      com.broadleafcommerce.data.tracking.core.exception.NotVisibleException - if the final determined importing context is not visible by the current user
      com.broadleafcommerce.data.tracking.core.exception.NotMutableException - if the final determined importing context is not mutable by the current user
    • processImport

      void processImport(String importId)
      Begins processing the import by reading the uploaded file and parsing out the items within it.

      If a new sandbox needs to be created for the import, emits a CreateSandboxRequest.

      Parameters:
      importId - an import managed by the persistent store. The import passed here should have its status as ImportStatus.REQUESTED
    • buildImportingContextInfo

      com.broadleafcommerce.data.tracking.core.context.ContextInfo buildImportingContextInfo(Import metadata, com.broadleafcommerce.data.tracking.core.type.OperationType operationType)
      Convenience method to construct the 'importing' ContextInfo based on the Import metadata.

      This represents the context that the import will actually be performed in, rather than the context the import itself was requested from.

      Note that this method should not perform any security or access validation on the resulting context info and is merely used to construct the instance itself.

      Parameters:
      metadata - the import instance itself from which context fields will be sourced
      operationType - the operation type to set on the context info
      Returns:
      the importing context info for the given import