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 TypeMethodDescriptionvoidReport a failed importvoidReport a failed importvoidaddWarning(com.atlassian.bitbucket.i18n.KeyedMessage message, Object entity) Report a warning during an importvoidaddWarning(com.atlassian.bitbucket.i18n.KeyedMessage message, Object entity, Throwable t) Report a warning during an importcom.atlassian.bitbucket.attribute.AttributeMapReturns theAttributeMapobject for this context.Returns the current hierarchy ID the importer is importing.<T> EntityImportMapping<T>getEntityMapping(MigrationEntityType<T> entityType) Returns theEntityImportMappingof theMigrationEntityTypefor 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 optionalThrowablefor 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 optionalThrowablefor the warning
-
getAttributeMap
@Nonnull com.atlassian.bitbucket.attribute.AttributeMap getAttributeMap()Returns theAttributeMapobject for this context. This allows storage of attributes associated with this context for the lifetime of this context.- Returns:
- the
AttributeMapobject 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 theEntityImportMappingof theMigrationEntityTypefor 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
EntityImportMappingof theMigrationEntityTypefor this context
-
hasErrors
boolean hasErrors()- Returns:
- true if
addError(KeyedMessage, Object)has been called
-