Package com.atlassian.jira.bc.dataimport
Interface DataImportService
- All Known Implementing Classes:
DefaultDataImportService
public interface DataImportService
Performs an XML import used both during setup and xml restore. XML import is an action only system administrators
can perform.
This service is responsible for performing some basic validation of the input as well as more advanced validation of the actual data provided. An import consists of the following steps:
- Basic input validation (
validateImport(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.bc.dataimport.DataImportParams)
) - Initial parse of the XML file for validation purposes
- Checks to ensure the build number of the data is not too old or newer than the current build number
- Checks to ensure the license is valid (either from the user provided input or from the data)
- Checks to ensure the indexing & attachment directories exist and are writable
- If there's any errors at this stage the import will be aborted
- Otherwise we start to perform the import
- Shutdown the scheduler and flush the current mailqueue
- Remove all entities from the database
- Parse the XML file again this time creating entities in the database
- Refresh the ofbiz id sequencer
- Refresh pico container including the plugins system
- Run the DB consistency checker
- Perform a DB upgrade if necessary
- Run a reindex of the data
- Restart the scheduler
- Since:
- v4.4
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
Returned by theDataImportService.ImportResult
from a call toDataImportService#doImport(com.atlassian.crowd.embedded.api.User, com.atlassian.jira.bc.dataimport.DataImportService.ImportValidationResult, TaskProgressSink)
static class
Represents the result of performing an import.static class
An import validation result returned by theDataImportService#validateImport(com.atlassian.crowd.embedded.api.User, DataImportParams)
method. -
Method Summary
Modifier and TypeMethodDescriptiondoImport
(ApplicationUser loggedInUser, DataImportService.ImportValidationResult result, TaskProgressSink taskProgressSink) Performs the actual import given a valid validation result.validateImport
(ApplicationUser loggedInUser, DataImportParams params) Given the currently loggedInUser and import params this method does some basic validation of the input.
-
Method Details
-
validateImport
DataImportService.ImportValidationResult validateImport(ApplicationUser loggedInUser, DataImportParams params) Given the currently loggedInUser and import params this method does some basic validation of the input. This method returns quickly. It does *not* parse the entire XML file. It can be used to check that the user has entered all the required input correctly for the front-end.In particular this method checks if the user has sysadmin permission. If this method is called from Setup (as indicated by the DataImportParams) the permission check is skipped. Further it will validate that the import xml file exists and verify that the pasted license is valid (if one was provided).
- Parameters:
loggedInUser
- The currently logged in user (may be null during setup)params
- TheDataImportParams
contain information provided by the user during import or setup- Returns:
- A validation result with the input as well as any errors.
-
doImport
DataImportService.ImportResult doImport(ApplicationUser loggedInUser, DataImportService.ImportValidationResult result, TaskProgressSink taskProgressSink) Performs the actual import given a valid validation result. This method is slow! It performs the majority of the tasks outlined in the interface definition.- Parameters:
loggedInUser
- The currently logged in user (may be null during setup)result
- A valid validation result containing theDataImportParams
providedtaskProgressSink
- A task progress counter that can be used to indicate how much longer the import has to go. if no progress needs to be recorded simply provide aTaskProgressSink.NULL_SINK
- Returns:
- The import result potentially containing an errorcollection and more specific overall error result
-