public class DefaultProjectImportManager extends Object implements ProjectImportManager
Constructor and Description |
---|
DefaultProjectImportManager(BackupXmlParser backupXmlParser,
org.ofbiz.core.entity.DelegatorInterface genericDelegator,
ApplicationProperties applicationProperties,
IssueManager issueManager,
IssueLinkManager issueLinkManager,
CustomFieldManager customFieldManager,
AutomaticDataMapper automaticDataMapper,
ProjectImportValidators projectImportValidators,
ProjectImportPersister projectImportPersister,
UserUtil userUtil,
GroupManager groupManager,
ProjectRoleManager projectRoleManager,
ProjectManager projectManager,
ProjectRoleAndActorStore projectRoleAndActorStore,
AttachmentStore attachmentStore,
com.atlassian.plugin.PluginAccessor pluginAccessor,
java.time.Clock clock) |
Modifier and Type | Method and Description |
---|---|
void |
autoMapAndValidateCustomFields(ProjectImportData projectImportData,
MappingResult mappingResult,
BackupProject backupProject,
I18nHelper i18nBean)
Performs an automatic mapping of the custom fields from the backup system to the current systems custom field's and
validates that all mappings are possible.
|
void |
autoMapAndValidateIssueTypes(ProjectImportData projectImportData,
MappingResult mappingResult,
BackupProject backupProject,
I18nHelper i18nBean)
Performs an automatic mapping of the IssueTypes from the backup system to the current systems issue types and
validates that all mappings are possible.
|
void |
autoMapCustomFieldOptions(ProjectImportData projectImportData,
BackupProject backupProject)
Performs an automatic mapping of the custom field options from the backup system to the current systems values.
|
void |
autoMapProjectRoles(ProjectImportData projectImportData)
Performs an automatic mapping of the project roles from the backup system to the current systems values.
|
void |
autoMapSystemFields(ProjectImportData projectImportData,
BackupProject backupProject)
Performs an automatic mapping of the system fields from the backup system to the current systems system
field values The fields that are mapped are:
Priority
Resolution
Status
IssueLinkTypes
Projects
IssueSecurityLevels
|
void |
createMissingUsers(UserMapper userMapper,
ProjectImportResults projectImportResults,
TaskProgressInterval taskProgressInterval)
Creates all the Missing users that we have details for.
|
void |
doImport(ProjectImportOptions projectImportOptions,
ProjectImportData projectImportData,
BackupProject backupProject,
BackupSystemInformation backupSystemInformation,
ProjectImportResults projectImportResults,
TaskProgressInterval taskProgressInterval,
I18nHelper i18n,
ApplicationUser importAuthor)
This will perform the project import based on the mappings provided.
|
List<ValidationMessage> |
doPluginValidation(BackupProject backupProject,
TaskProgressInterval sysFieldSubInterval,
I18nHelper i18n)
Call any plugin handlers that have registered to do validation
|
BackupOverview |
getBackupOverview(String pathToBackupXml,
TaskProgressSink taskProgressSink,
I18nHelper i18n)
Parses through the provided JIRA XML backup file and creates a BackupOverview.
|
ProjectImportData |
getProjectImportData(ProjectImportOptions projectImportOptions,
BackupProject backupProject,
BackupSystemInformation backupSystemInformation,
TaskProgressProcessor taskProgressProcessor)
Parses through the provided JIRA XML backup file and creates a MappingResult.
|
void |
importProject(ProjectImportOptions projectImportOptions,
ProjectImportMapper projectImportMapper,
BackupProject backupProject,
ProjectImportResults projectImportResults,
TaskProgressInterval taskProgressInterval)
This will create or update a project and all its versions, components, and project role membership.
|
void |
importProjectRoleMembers(Project project,
ProjectImportMapper projectImportMapper,
ProjectImportResults projectImportResults,
TaskProgressInterval taskProgressInterval) |
void |
validateCustomFieldValues(ProjectImportData projectImportData,
MappingResult mappingResult,
BackupProject backupProject,
TaskProgressProcessor taskProgressProcessor,
I18nHelper i18n)
Parses the partitioned custom field value XML and gets the custom fields to validate that they can handle the values.
|
void |
validateFileAttachments(ProjectImportOptions projectImportOptions,
ProjectImportData projectImportData,
MappingResult mappingResult,
BackupProject backupProject,
BackupSystemInformation backupSystemInformation,
TaskProgressProcessor taskProgressProcessor,
I18nHelper i18n)
Parses the partitioned file attachment XML and validates that the referenced file attachment exists in the
user provided attachment directory.
|
void |
validateSystemFields(ProjectImportData projectImportData,
MappingResult mappingResult,
ProjectImportOptions projectImportOptions,
BackupProject backupProject,
TaskProgressInterval taskProgressInterval,
I18nHelper i18nBean)
Validates that all mappings are possible.
|
public DefaultProjectImportManager(BackupXmlParser backupXmlParser, org.ofbiz.core.entity.DelegatorInterface genericDelegator, ApplicationProperties applicationProperties, IssueManager issueManager, IssueLinkManager issueLinkManager, CustomFieldManager customFieldManager, AutomaticDataMapper automaticDataMapper, ProjectImportValidators projectImportValidators, ProjectImportPersister projectImportPersister, UserUtil userUtil, GroupManager groupManager, ProjectRoleManager projectRoleManager, ProjectManager projectManager, ProjectRoleAndActorStore projectRoleAndActorStore, AttachmentStore attachmentStore, com.atlassian.plugin.PluginAccessor pluginAccessor, java.time.Clock clock)
public BackupOverview getBackupOverview(String pathToBackupXml, TaskProgressSink taskProgressSink, I18nHelper i18n) throws IOException, SAXException
ProjectImportManager
If the optional parameter taskProgressSink is provided, then it is used to send information about the progress of this operation. This is used for the "Long Running Task" progress bar.
getBackupOverview
in interface ProjectImportManager
pathToBackupXml
- must be a valid path, on disk, to a valid JIRA XML backup file.taskProgressSink
- Used to provide progress feedback, can be null.i18n
- used to internationalize the error messagesIOException
- if there is a problem reading/finding the fileSAXException
- if something goes wrong with processing the XMLpublic ProjectImportData getProjectImportData(ProjectImportOptions projectImportOptions, BackupProject backupProject, BackupSystemInformation backupSystemInformation, TaskProgressProcessor taskProgressProcessor) throws IOException, SAXException
ProjectImportManager
getProjectImportData
in interface ProjectImportManager
projectImportOptions
- User options for the project import, including the pathToBackupXML, attachmentPath, and "overwriteProjectDetails" flag.backupProject
- is the selected project that is used to inform creation of a mapper and a subset of XML data files.backupSystemInformation
- system-wide info from the backup file.taskProgressProcessor
- Used to provide progress feedback, can be null.IOException
- if something goes wrong handling the backup or partitioned XML filesSAXException
- if something goes wrong with processing the XMLpublic void createMissingUsers(UserMapper userMapper, ProjectImportResults projectImportResults, TaskProgressInterval taskProgressInterval) throws AbortImportException
ProjectImportManager
createMissingUsers
in interface ProjectImportManager
userMapper
- The UserMapper which is used to determine missing users.projectImportResults
- used to collect the statistics of what was created during the import, if it was a success, and any errors that may have occurred.taskProgressInterval
- used to show task progress to the user while this long running task is happening.AbortImportException
- if the import is aborted due to too many errors.public void importProjectRoleMembers(Project project, ProjectImportMapper projectImportMapper, ProjectImportResults projectImportResults, TaskProgressInterval taskProgressInterval) throws AbortImportException
AbortImportException
public void importProject(ProjectImportOptions projectImportOptions, ProjectImportMapper projectImportMapper, BackupProject backupProject, ProjectImportResults projectImportResults, TaskProgressInterval taskProgressInterval) throws AbortImportException
ProjectImportManager
If the project does not exist then it will be created with default schemes and the details from the ExternalProject from the backup file.
If the project exists then the details will be updated to match that of the ExternalProject.
This will also have the side-effect of populating the ProjectImportMapper.getProjectMapper()
and the ProjectImportMapper.getVersionMapper()
and
ProjectImportMapper.getComponentMapper()
.
importProject
in interface ProjectImportManager
projectImportOptions
- Contains user inputted options related to the project import.projectImportMapper
- contains the project, version, and component mappers. If the external projects id is
not mapped then this method will try to create the project.backupProject
- contains the project details used to clobber an existing project or as the details for the new projectprojectImportResults
- used to collect the statistics of what was created during the import, if it was a success, and any errors that may have occurred.taskProgressInterval
- used to show task progress to the user while this long running task is happening.AbortImportException
- if the import is aborted due to errors.public void doImport(ProjectImportOptions projectImportOptions, ProjectImportData projectImportData, BackupProject backupProject, BackupSystemInformation backupSystemInformation, ProjectImportResults projectImportResults, TaskProgressInterval taskProgressInterval, I18nHelper i18n, ApplicationUser importAuthor) throws IOException, SAXException, IndexException
ProjectImportManager
doImport
in interface ProjectImportManager
projectImportOptions
- User options for the project import, including the pathToBackupXML, attachmentPath, and "overwriteProjectDetails" flag.projectImportData
- contains a projectImportMapper that has been through the automatic mapping and validation process and
the paths, on disk, to the partitioned xml files.backupProject
- contains the import project details.backupSystemInformation
- system-wide info from the backup file.projectImportResults
- used to collect the statistics of what was created during the import, if it was a success, and any errors that may have occurred.taskProgressInterval
- used to show task progress to the user while this long running task is happening.i18n
- used to internationalize the error messagesimportAuthor
- the user who is performing the project import, this is used as the author of the change item marker for created issues @throws IOException if something goes wrong handling the partitioned XML files @throws SAXException if something goes wrong with processing the XML @throws IOException if something goes wrong handling the backup or partitioned XML filesIOException
- IOExceptionSAXException
- if something goes wrong with processing the XMLIndexException
- if there is a problem re-indexing JIRA.public void validateCustomFieldValues(ProjectImportData projectImportData, MappingResult mappingResult, BackupProject backupProject, TaskProgressProcessor taskProgressProcessor, I18nHelper i18n) throws IOException, SAXException
ProjectImportManager
validateCustomFieldValues
in interface ProjectImportManager
projectImportData
- which holds the initial projectImportMapper and the partitioned XML file paths for the project XML data that was partitioned from the main XML backup.mappingResult
- this was the result containing the path to the partitioned XML files and the ProjectImportMapperbackupProject
- the selected project to importtaskProgressProcessor
- Used to provide progress feedback, can be null.i18n
- used to internationalize the error messagesIOException
- if something goes wrong handling the partitioned XML filesSAXException
- if something goes wrong with processing the XMLpublic void validateFileAttachments(ProjectImportOptions projectImportOptions, ProjectImportData projectImportData, MappingResult mappingResult, BackupProject backupProject, BackupSystemInformation backupSystemInformation, TaskProgressProcessor taskProgressProcessor, I18nHelper i18n) throws IOException, SAXException
ProjectImportManager
If any files do not exist a warning will be added to the file attachment message set in the mapping result.
NOTE: this validation only happens if ProjectImportOptions.getAttachmentPath()
is non-null meaning that the user wants to restore attachments.
validateFileAttachments
in interface ProjectImportManager
projectImportOptions
- User options for the project import, including the pathToBackupXML, attachmentPath, and "overwriteProjectDetails" flag.projectImportData
- which holds the initial projectImportMapper and the partitioned XML file paths for the project XML data that was partitioned from the main XML backup.mappingResult
- this was the result containing the path to the partitioned XML files and the ProjectImportMapperbackupProject
- the selected project to importbackupSystemInformation
- system-wide info from the backup file.taskProgressProcessor
- Used to provide progress feedback, can be null.i18n
- used to internationalize the error messagesIOException
- if something goes wrong handling the partitioned XML filesSAXException
- if something goes wrong with processing the XMLpublic void autoMapAndValidateIssueTypes(ProjectImportData projectImportData, MappingResult mappingResult, BackupProject backupProject, I18nHelper i18nBean)
ProjectImportManager
MappingResult.getIssueTypeMessageSet()
.autoMapAndValidateIssueTypes
in interface ProjectImportManager
projectImportData
- which holds the initial projectImportMapper and the partitioned XML file paths for the project XML data that was partitioned from the main XML backup.mappingResult
- this was the result containing the path to the partitioned XML files,the ProjectImportMapper, and the MessageSetsbackupProject
- the selected project to importi18nBean
- used to internationalize the error messagespublic void autoMapAndValidateCustomFields(ProjectImportData projectImportData, MappingResult mappingResult, BackupProject backupProject, I18nHelper i18nBean)
ProjectImportManager
MappingResult.getCustomFieldMessageSet()
.autoMapAndValidateCustomFields
in interface ProjectImportManager
projectImportData
- which holds the initial projectImportMapper and the partitioned XML file paths for the project XML data that was partitioned from the main XML backup.mappingResult
- this was the result containing the path to the partitioned XML files,the ProjectImportMapper, and the MessageSetsbackupProject
- the selected project to importi18nBean
- used to internationalize the error messagespublic void autoMapCustomFieldOptions(ProjectImportData projectImportData, BackupProject backupProject)
ProjectImportManager
autoMapCustomFieldOptions
in interface ProjectImportManager
projectImportData
- which holds the initial projectImportMapper and the partitioned XML file paths for the project XML data that was partitioned from the main XML backup.backupProject
- the selected project to importpublic void autoMapProjectRoles(ProjectImportData projectImportData)
ProjectImportManager
autoMapProjectRoles
in interface ProjectImportManager
projectImportData
- which holds the initial projectImportMapper and the partitioned XML file paths for the project XML data that was partitioned from the main XML backup.public void autoMapSystemFields(ProjectImportData projectImportData, BackupProject backupProject)
ProjectImportManager
autoMapSystemFields
in interface ProjectImportManager
projectImportData
- which holds the initial projectImportMapper and the partitioned XML file paths for the project XML data that was partitioned from the main XML backup.backupProject
- the selected project to importpublic void validateSystemFields(ProjectImportData projectImportData, MappingResult mappingResult, ProjectImportOptions projectImportOptions, BackupProject backupProject, TaskProgressInterval taskProgressInterval, I18nHelper i18nBean)
ProjectImportManager
validateSystemFields
in interface ProjectImportManager
projectImportData
- which holds the initial projectImportMapper and the partitioned XML file paths for the project XML data that was partitioned from the main XML backup.mappingResult
- this was the result containing the path to the partitioned XML files,the ProjectImportMapper, and the MessageSetsprojectImportOptions
- Contains user inputted options related to the project import.backupProject
- the selected project to importtaskProgressInterval
- Used to provide progress feedback, can be null.i18nBean
- used to internationalize the error messagespublic List<ValidationMessage> doPluginValidation(BackupProject backupProject, TaskProgressInterval sysFieldSubInterval, I18nHelper i18n)
ProjectImportManager
doPluginValidation
in interface ProjectImportManager
backupProject
- the selected project to importsysFieldSubInterval
- Used to provide progress feedback, can be null.i18n
- used to internationalize the error messagesCopyright © 2002-2021 Atlassian. All Rights Reserved.