Interface StructureBackupProvider


@Internal public interface StructureBackupProvider

This is an extension point for Structure backup/restore mechanism. You need to declare its implementation in structure-backup-provider module in atlassian-plugin.xml

Example: <structure-backup-provider key="my-backup-provider" class="com.acme.myapp.MyBackupProvider"/>

You should declare only one structure-backup-provider module in your app. In case of multiple providers only one of them will be used.

  • Method Details

    • backup

      void backup(@NotNull BackupWriter writer, @Nullable LongSet structureIds)

      Called during Structure Backup procedure. Use writer to back up data in XML format. Data is written to extension section. extension element has app key and version values as attributes.

      Data format:

       <extensions>
         <extension key="com.acme.app" version="1.0">
           writer adds data here...
         </extension>
         ...
       </extensions>
       
      Parameters:
      writer - backup data writer
      structureIds - the collection of structure IDs to back up; null means all structures
    • restore

      void restore(@NotNull BackupReader reader, @NotNull ErrorsReporter errorsReporter)

      Called during Structure Restore procedure. reader points to extension element related to your app. You can get app version at the time of backup by reading "version" attribute of extension element.

      Attempts to read data outside the extension section will result in an exception.

      Use errorsReporter to warn about problems during restore. The errors will be shown on UI after Structure Restore procedure.

      Parameters:
      reader - backup data reader
      errorsReporter - reporter for errors
    • migrate

      @Deprecated void migrate(@NotNull BackupReader reader, @NotNull Map<Long,Long> backupToStoredStructureIds, @NotNull ErrorsReporter errorsReporter)
      Deprecated.
      since Structure 7.5

      Called during Migrate Structure procedure.

      Works the same way as restore(BackupReader, ErrorsReporter) but must restore data only for the provided structures.

      Parameters:
      reader - backup data reader
      backupToStoredStructureIds - keys of this map are IDs of structures to migrate as they occur in a backup; values - corresponding structure IDs in the system
      errorsReporter - reporter for migration errors
      See Also:
    • migrate

      default void migrate(@NotNull BackupReader reader, @NotNull MigrationMapping mapping, @NotNull ErrorsReporter errorsReporter)

      Called during Migrate Structure procedure.

      Works the same way as restore(BackupReader, ErrorsReporter) but must restore data only for the provided structures.

      Parameters:
      reader - backup data reader
      mapping - migrated structures and items ID mapping.
      errorsReporter - reporter for migration errors
      Since:
      Structure 7.5