Interface BackupOperation
Backup operation allows to set backup parameters and run the backup.
Note that for security reasons, if the file name is entered by the user, you must check that it is located under the JIRA home directory, or force the file to be under that directory. This operation trusts the caller and doesn't do any checking.
If the specified backup file already exists, it will be overwritten.
-
Method Summary
Modifier and TypeMethodDescriptionbackup()
Performs the backup synchronously.Performs the backup synchronously, writing the data to the suppliedOutputStream
instead of a file.setBackupAppConfiguration
(boolean backupAppConfiguration) Controls whether Structure's app-level configuration and settings are backed up.setBackupExtensions
(Set<String> extensionKeys) Sets the extension keys to back up.setBackupFavorites
(boolean backupFavorites) Controls whether users' favorite structures are backed up.setBackupGenericItemHistory
(boolean backupGenericItemHistory) Sets thebackupGenericItemHistory
flag.setBackupHistory
(boolean backupHistory) Sets thebackupHistory
flag.setBackupPerspectives
(boolean backupPerspectives) Controls whether perspectives are backed up.setBackupSavedColumns
(boolean backupSavedColumns) Controls whether saved columns are backed up.setBackupStructureIds
(LongIterable structureIds) Sets the structure IDs to back up.setBackupViewIds
(LongIterable viewIds) Sets the view IDs to back up.Sets the target file for the backup.setUseZip
(boolean useZip) Sets theuseZip
flag.
-
Method Details
-
setFile
Sets the target file for the backup. If the filename does not have extension, ".xml" or ".zip" will be appended automatically, depending on the
useZip
flag.The file must be an absolute path.
- Parameters:
file
- backup file- Returns:
- this operation
- Throws:
IllegalArgumentException
- if the file is not a valid path
-
setUseZip
Sets the
useZip
flag. When the flag is set, the target file will be a zipped XML file, otherwise it will be a plain XML file.The default is
false
.- Parameters:
useZip
- true if the file content should be compressed- Returns:
- this operation
-
setBackupStructureIds
Sets the structure IDs to back up. If set to
null
, all structures will be backed up. If set to an empty collection, no structures will be backed up.The default is
null
(all structures).- Parameters:
structureIds
- the collection of structure IDs;null
means all structures- Returns:
- this operation
-
setBackupViewIds
Sets the view IDs to back up. If set to
null
, all views will be backed up. If set to an empty collection, no views will be backed up.The default is
null
(all views).- Parameters:
viewIds
- the collection of view IDs;null
means all views- Returns:
- this operation
-
setBackupAppConfiguration
Controls whether Structure's app-level configuration and settings are backed up. This includes:
- the list of projects enabled for Structure;
- Structure app permissions (who can use the app, create new structures, etc.);
- attribute sensitivity settings;
- scheduled maintenance settings;
- dark features, and several other settings.
The default is
true
.- Parameters:
backupAppConfiguration
-true
to back up Structure app configuration and global permissions;false
to skip them- Returns:
- this operation
-
setBackupPerspectives
Controls whether perspectives are backed up.
The default is
true
.- Parameters:
backupPerspectives
-true
to back up perspectives,false
to skip them- Returns:
- this operation
-
setBackupFavorites
Controls whether users' favorite structures are backed up.
The default is
true
.- Parameters:
backupFavorites
-true
to back up favorites,false
to skip them- Returns:
- this operation
-
setBackupSavedColumns
Controls whether saved columns are backed up.
The default is
true
.- Parameters:
backupSavedColumns
-true
to back up saved columns,false
to skip them- Returns:
- this operation
-
setBackupHistory
Sets the
backupHistory
flag. When the flag is set, full structure history will be backed up, otherwise the target file will only contain the current state of the structures.The default is
false
.- Parameters:
backupHistory
- true if structure history should be backed up- Returns:
- this operation
-
setBackupGenericItemHistory
Sets the
backupGenericItemHistory
flag. When the flag is set, full generic item history will be backed up/The default is
true
.- Parameters:
backupGenericItemHistory
- true if generic item history should be backed up- Returns:
- this operation
-
setBackupExtensions
Sets the extension keys to back up. If set to
null
, all supported extensions will be backed up. If set to an empty set, no extensions will be backed up.The default is
null
(all supported extensions).- Parameters:
extensionKeys
- the set of extension keys;null
means all supported extensions- Returns:
- this operation
-
backup
Performs the backup synchronously.- Returns:
- this operation
- Throws:
Exception
- if file cannot be written or any other problem happens
-
backupToStream
Performs the backup synchronously, writing the data to the supplied
OutputStream
instead of a file. Does not close the stream.If the
useZip
flag was set, the data will be zipped, otherwise it will be plain XML.When backing up to a stream, the file path supplied to
setFile(File)
is ignored, andgetFinalFile()
will always throw anIllegalStateException
.- Parameters:
out
- the output stream- Returns:
- this operation
- Throws:
Exception
- if data cannot be written or any other problem happens
-
getFinalFile
- Returns:
- the file name that will be used for backup - that was set with
setFile(java.io.File)
method, but probably with added extension. - Throws:
IllegalStateException
- if the file has not been set
-