Interface ImportContext


public interface ImportContext
Allows the consumption of entries contained in an import archive. An Importer that wishes to make state available for the lifetime of an import will use the facilities provided by this class such as getAttributeMap() and getEntityMapping(MigrationEntityType). This class also provides a facility for storing error and warning messages that an Importer may raise during the import process.
Since:
5.13
  • Method Details

    • addError

      void addError(@Nonnull com.atlassian.bitbucket.i18n.KeyedMessage message, @Nullable Object entity)
      Report a failed import
      Parameters:
      message - the failure message
      entity - the entity for which export failed
    • addError

      void addError(@Nonnull com.atlassian.bitbucket.i18n.KeyedMessage message, @Nullable Object entity, @Nullable Throwable t)
      Report a failed import
      Parameters:
      message - the failure message
      entity - the entity for which export failed
      t - an optional Throwable for the warning
    • addWarning

      void addWarning(@Nonnull com.atlassian.bitbucket.i18n.KeyedMessage message, @Nullable Object entity)
      Report a warning during an import
      Parameters:
      message - the failure message
      entity - the entity for which export failed
    • addWarning

      void addWarning(@Nonnull com.atlassian.bitbucket.i18n.KeyedMessage message, @Nullable Object entity, @Nullable Throwable t)
      Report a warning during an import
      Parameters:
      message - the failure message
      entity - the entity for which export failed
      t - an optional Throwable for the warning
    • getAttributeMap

      @Nonnull com.atlassian.bitbucket.attribute.AttributeMap getAttributeMap()
      Returns the AttributeMap object for this context. This allows storage of attributes associated with this context for the lifetime of this context.
      Returns:
      the AttributeMap object for this context
      See Also:
      • AttributeMap
    • getCurrentHierarchyId

      @Nonnull Optional<String> getCurrentHierarchyId()
      Returns the current hierarchy ID the importer is importing.
      Returns:
      the current hierarchy ID the importer is importing or Optional.empty() if none
      Since:
      6.0
    • getEntityMapping

      @Nonnull <T> EntityImportMapping<T> getEntityMapping(@Nonnull MigrationEntityType<T> entityType)
      Returns the EntityImportMapping of the MigrationEntityType for this context. If the mapping does not exist for the type, it'll be created.
      Type Parameters:
      T - Type of the IDs in the mapping
      Parameters:
      entityType - Entity type that this mapping should map
      Returns:
      The EntityImportMapping of the MigrationEntityType for this context
    • hasErrors

      boolean hasErrors()
      Returns:
      true if addError(KeyedMessage, Object) has been called