java.lang.Object
com.broadleafcommerce.dataimport.domain.Import
All Implemented Interfaces:
Serializable

public class Import extends Object implements Serializable
Service representation of a persisted import
Author:
Phillip Verheyden (phillipuniverse)
See Also:
  • Constructor Details

    • Import

      public Import(DefaultImportType type)
      Convenience constructor with import type.
      Parameters:
      type -
    • Import

      public Import(String id, ImportStatus status)
      Convenience constructor, primarily for testing with id and status.
      Parameters:
      id -
      status -
    • Import

      public Import()
  • Method Details

    • getCompleteCount

      public long getCompleteCount()
      The count of all items that have been processed. Can be used in conjunction with getTotalItems() to determine total completion
      Returns:
      the count of all of the items that we have processed
    • getId

      public String getId()
      The unique ID of this import
    • getName

      public String getName()
      The name of this import.
      Returns:
      the name of this import
    • getType

      public String getType()
      Configurable type of this import, like product, catalog, etc
      See Also:
    • getFileType

      public String getFileType()
      The original file type that this import comes from
      See Also:
    • getIncludedHeaders

      public Set<String> getIncludedHeaders()
      Restrictive defined headers to use for the import. If null or empty, this assumes that all headers in the import will be used
    • getParameters

      public Map<String,Object> getParameters()
      Additional information passed down to each batch to the resource tier. These are attached to each BatchRequest
    • getStatus

      public ImportStatus getStatus()
      Current status, see state diagram for statuses as they flow through the system
    • getErrorMessage

      public String getErrorMessage()
      If the import as a whole encountered an error and needed to stop, this field holds a description of the error.
      Returns:
      a description of the error (if any) that caused the import to fail
    • getFileLocation

      public String getFileLocation()
      The location to the file that was uploaded representing this import. The binary data from this path can be looked up using the StorageService.
    • getStarted

      public Instant getStarted()
      When this import was started, meaning the file was being read and batches created
    • getStopped

      public Instant getStopped()
      When this import was last stopped
    • getLastUpdated

      public Instant getLastUpdated()
      When this import was last touched
    • getTotalItems

      public long getTotalItems()
    • getSuccessCount

      public long getSuccessCount()
    • getErrorCount

      public long getErrorCount()
    • getAuthor

      public String getAuthor()
      Who is making the change
    • getApplicationId

      @Nullable public String getApplicationId()
      The application that the import is initialized on. This can be different than the importingApplicationId.
      Returns:
      the application that the import is initialized on
    • getTenantId

      public String getTenantId()
      The tenant that the import is initialized on.
      Returns:
      the tenant that the import is initialized on
    • isProductionImport

      public boolean isProductionImport()
      Whether or not this import should go straight to production or into a sandbox.
      See Also:
      • importingSandboxId
    • getImportingCatalogId

      @Nullable public String getImportingCatalogId()
      The catalog that the import items should go into. Required when importing items that are catalog-discriminated as determined by type.

      In the case of hierarchical catalogs, this is most-derived catalog id.

      Returns:
      the catalog that the import items should go into
    • getImportingApplicationId

      @Nullable public String getImportingApplicationId()
      The application that the import items should go into.
      Returns:
      the application that the import items should go into
    • getImportingSandboxId

      @Nullable public String getImportingSandboxId()
      The sandbox that the import items should go into.

      This field only has any meaning if productionImport is false. This should always be null if productionImport is true.

      If a new sandbox needs to be created for this import, initially this field's value will be set to null by ImportManager.initiateImport(ImportRequest, InputStreamSource, ContextInfo), but then ImportManager.processImport(String) will generate and initialize a value for it.

      As a result, ultimately every non-production import will have a non-null value for this field.

      Returns:
      the sandbox that the import items should go into
      See Also:
    • getImportingSandboxNameToCreate

      @Nullable public String getImportingSandboxNameToCreate()
      If and only if a new sandbox needs to be created for the current import (determined using the logic described in importingSandboxId), this field will hold the name of the sandbox that will be created.

      If not supplied in the ImportRequest.importingSandboxNameToCreate, the name of the import will be used (will be the generated name if the import name had to be generated as described on ImportRequest.name).

      Returns:
      the name of the sandbox that should be created for this import
    • getImportingCustomerContextId

      @Nullable public String getImportingCustomerContextId()
      The ID of the customer context that the import items should go into.
      Returns:
      the customer context that the import items should go into
    • getParentEntityId

      @Nullable public String getParentEntityId()
      Certain imports may be responsible for importing entities under a common 'parent entity'. For example, an import of price data should place all the price data entities in the import under the same parent price list.

      To make it easier to support such use-cases without requiring the parent entity information to be supplied in the imported file itself, this first-class field is accepted in ImportRequest.getParentEntityId() and eventually passed to the resource-tier batch handler through BatchRequest.BatchContext.getParentEntityId().

      Ultimately, the usage of this value is entirely determined by the resource tier handler implementation.

      Returns:
      the parent entity id common to all imported entities (if applicable)
      See Also:
    • getVendorRef

      @Nullable public String getVendorRef()
      The reference to the vendor associated with this import. This value can be null, in which case, no vendor is associated.
      Returns:
      the reference to the vendor associated with this import
    • getSpecificationRef

      @Nullable public String getSpecificationRef()
      Reference to the specification used for this import. Please see ImportSpecificationService and DefaultImportSpecificationService for how this is used.
      Returns:
      reference to the specification used for this import
    • getChangeContainer

      @Nullable public com.broadleafcommerce.data.tracking.core.filtering.domain.ChangeContainer getChangeContainer()
      Metadata used to populate any ChangeEvent created from this request.
      Returns:
      Metadata used to populate any ChangeEvent created from this request
    • setId

      public void setId(String id)
      The unique ID of this import
    • setName

      public void setName(String name)
      The name of this import.
      Parameters:
      name - the name of this import
    • setType

      public void setType(String type)
      Configurable type of this import, like product, catalog, etc
      See Also:
    • setFileType

      public void setFileType(String fileType)
      The original file type that this import comes from
      See Also:
    • setIncludedHeaders

      public void setIncludedHeaders(Set<String> includedHeaders)
      Restrictive defined headers to use for the import. If null or empty, this assumes that all headers in the import will be used
    • setParameters

      public void setParameters(Map<String,Object> parameters)
      Additional information passed down to each batch to the resource tier. These are attached to each BatchRequest
    • setStatus

      public void setStatus(ImportStatus status)
      Current status, see state diagram for statuses as they flow through the system
    • setErrorMessage

      public void setErrorMessage(String errorMessage)
      If the import as a whole encountered an error and needed to stop, this field holds a description of the error.
      Parameters:
      errorMessage - a description of the error (if any) that caused the import to fail
    • setFileLocation

      public void setFileLocation(String fileLocation)
      The location to the file that was uploaded representing this import. The binary data from this path can be looked up using the StorageService.
    • setStarted

      public void setStarted(Instant started)
      When this import was started, meaning the file was being read and batches created
    • setStopped

      public void setStopped(Instant stopped)
      When this import was last stopped
    • setLastUpdated

      public void setLastUpdated(Instant lastUpdated)
      When this import was last touched
    • setTotalItems

      public void setTotalItems(long totalItems)
    • setSuccessCount

      public void setSuccessCount(long successCount)
    • setErrorCount

      public void setErrorCount(long errorCount)
    • setAuthor

      public void setAuthor(String author)
      Who is making the change
    • setApplicationId

      public void setApplicationId(@Nullable String applicationId)
      The application that the import is initialized on. This can be different than the importingApplicationId.
      Parameters:
      applicationId - the application that the import is initialized on
    • setTenantId

      public void setTenantId(String tenantId)
      The tenant that the import is initialized on.
      Parameters:
      tenantId - the tenant that the import is initialized on
    • setProductionImport

      public void setProductionImport(boolean productionImport)
      Whether or not this import should go straight to production or into a sandbox.
      See Also:
      • importingSandboxId
    • setImportingCatalogId

      public void setImportingCatalogId(@Nullable String importingCatalogId)
      The catalog that the import items should go into. Required when importing items that are catalog-discriminated as determined by type.

      In the case of hierarchical catalogs, this is most-derived catalog id.

      Parameters:
      importingCatalogId - the catalog that the import items should go into
    • setImportingApplicationId

      public void setImportingApplicationId(@Nullable String importingApplicationId)
      The application that the import items should go into.
      Parameters:
      importingApplicationId - the application that the import items should go into
    • setImportingSandboxId

      public void setImportingSandboxId(@Nullable String importingSandboxId)
      The sandbox that the import items should go into.

      This field only has any meaning if productionImport is false. This should always be null if productionImport is true.

      If a new sandbox needs to be created for this import, initially this field's value will be set to null by ImportManager.initiateImport(ImportRequest, InputStreamSource, ContextInfo), but then ImportManager.processImport(String) will generate and initialize a value for it.

      As a result, ultimately every non-production import will have a non-null value for this field.

      Parameters:
      importingSandboxId - the sandbox that the import items should go into
      See Also:
    • setImportingSandboxNameToCreate

      public void setImportingSandboxNameToCreate(@Nullable String importingSandboxNameToCreate)
      If and only if a new sandbox needs to be created for the current import (determined using the logic described in importingSandboxId), this field will hold the name of the sandbox that will be created.

      If not supplied in the ImportRequest.importingSandboxNameToCreate, the name of the import will be used (will be the generated name if the import name had to be generated as described on ImportRequest.name).

      Parameters:
      importingSandboxNameToCreate - the name of the sandbox that should be created for this import
    • setImportingCustomerContextId

      public void setImportingCustomerContextId(@Nullable String importingCustomerContextId)
      The ID of the customer context that the import items should go into.
      Parameters:
      importingCustomerContextId - the customer context that the import items should go into
    • setParentEntityId

      public void setParentEntityId(@Nullable String parentEntityId)
      Certain imports may be responsible for importing entities under a common 'parent entity'. For example, an import of price data should place all the price data entities in the import under the same parent price list.

      To make it easier to support such use-cases without requiring the parent entity information to be supplied in the imported file itself, this first-class field is accepted in ImportRequest.getParentEntityId() and eventually passed to the resource-tier batch handler through BatchRequest.BatchContext.getParentEntityId().

      Ultimately, the usage of this value is entirely determined by the resource tier handler implementation.

      Parameters:
      parentEntityId - id of the parent entity common to all imported entities (if applicable)
      See Also:
    • setVendorRef

      public void setVendorRef(@Nullable String vendorRef)
      The reference to the vendor associated with this import. This value can be null, in which case, no vendor is associated.
      Parameters:
      vendorRef - the reference to the vendor associated with this import
    • setSpecificationRef

      public void setSpecificationRef(@Nullable String specificationRef)
      Reference to the specification used for this import. Please see ImportSpecificationService and DefaultImportSpecificationService for how this is used.
      Parameters:
      specificationRef - reference to the specification used for this import
    • setChangeContainer

      public void setChangeContainer(@Nullable com.broadleafcommerce.data.tracking.core.filtering.domain.ChangeContainer changeContainer)
      Metadata used to populate any ChangeEvent created from this request.
      Parameters:
      changeContainer - Metadata used to populate any ChangeEvent created from this request
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object