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 Summary
Modifier and TypeMethodDescriptionvoid
Report a failed importvoid
Report a failed importvoid
addWarning
(com.atlassian.bitbucket.i18n.KeyedMessage message, Object entity) Report a warning during an importvoid
addWarning
(com.atlassian.bitbucket.i18n.KeyedMessage message, Object entity, Throwable t) Report a warning during an importcom.atlassian.bitbucket.attribute.AttributeMap
Returns theAttributeMap
object for this context.Returns the current hierarchy ID the importer is importing.<T> EntityImportMapping<T>
getEntityMapping
(MigrationEntityType<T> entityType) Returns theEntityImportMapping
of theMigrationEntityType
for this context.boolean
-
Method Details
-
addError
Report a failed import- Parameters:
message
- the failure messageentity
- 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 messageentity
- the entity for which export failedt
- an optionalThrowable
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 messageentity
- 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 messageentity
- the entity for which export failedt
- an optionalThrowable
for the warning
-
getAttributeMap
@Nonnull com.atlassian.bitbucket.attribute.AttributeMap getAttributeMap()Returns theAttributeMap
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
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
Returns theEntityImportMapping
of theMigrationEntityType
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 theMigrationEntityType
for this context
-
hasErrors
boolean hasErrors()- Returns:
- true if
addError(KeyedMessage, Object)
has been called
-