com.atlassian.bitbucket.migration.ExportContext |
Represents the context for the current export job. An Exporter
that wishes to make state available for the
lifetime of an export 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 Exporter
may raise during the export process.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Ensures that the export has not been canceled.
| |||||||||||
Report a failed export of the provided entity
| |||||||||||
Report an error during an export for the provided entity and with an optional
Throwable
to log | |||||||||||
Creates a
section with the given relative path inside the export archive. | |||||||||||
Report a warning during an export for the provided entity
| |||||||||||
Report a warning during an export for the provided entity and with an optional
Throwable
to log | |||||||||||
Returns the
AttributeMap object for this context. | |||||||||||
Returns the
EntityExportMapping of the MigrationEntityType for this context. | |||||||||||
Does this
export context contain a section with the given path |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.atlassian.bitbucket.migration.ExportSection
|
Ensures that the export has not been canceled. This should be called occasionally during long running operations in order to react to cancellation requests quickly. Cleanup code can be handled in a try-catch block, but the exception should be re-thrown without modifications.
Note: onEnd(ExportContext)
will always be called, even if this method throws an exception.
Additional cleanup can be done there as well.
Example:
try { context.abortIfCanceled(); } catch (Exception e) { // cleanup code throw e; }
CanceledMigrationException | if the job for this context has been canceled |
---|
Report a failed export of the provided entity
message | the failure message |
---|---|
entity | the entity for which export failed, or null for general failures
|
Creates a section
with the given relative path inside the export archive. If a section
with this name has already been added in the export, it will not be added.
path | a path relative to the export root directory specific to the caller, inside the export archive. Use Paths#get(String, String...) to use this method efficiently. |
---|---|
exportSection | Consumer consumer that writes the contents of the section
relative to the section path |
section
did not exist and has been created as a result of this call,
false otherwise
Report a warning during an export for the provided entity
message | the failure message |
---|---|
entity | the entity for which export failed, or null for general failures
|
Returns the AttributeMap
object for this context. This allows storage of attributes associated with this
context for the lifetime of this context.
AttributeMap
object for this contextReturns the EntityExportMapping
of the MigrationEntityType
for this context. If the mapping
does not exist for the type, it'll be created.
entityType | Entity type that this mapping should map, e.g. Repository or Project |
---|
EntityExportMapping
of the MigrationEntityType
for this context
Does this export context
contain a section
with the given path
path | the path of the section to check for |
---|
export context
contain a section
with the given
path, false otherwise