stable
Clone or download
Sorry about the giantic review, I didn't manage to slim it more as we need to transform the way Tuleap XML is built for fields and it's quite central to the import process. In this refactoring I tried to limit as much as possible the changes so basic things were not changed like the name of `ContainersXMLCollectionBuilder` class that no longer build a collection of containers but I feel that adding a proper rename on top of that would be a nightmare for review. The keys to understand the refactoring: - First we need it because we will have to distinguish in future the fields that can be seen at submit time and fields that can be seen at update time only. With previous code (before this commit) the transformation done in `JiraToTuleapFieldTypeMapper` to directly get bare XML made impossible to carry information about the permissions (handled way after in the PermissionXMLExporter without connection with actual JiraField). By using the XMLTracker & XMLField objects we introduce an intermidiate representation that will allow to introduce what we want (in that case, permissions). However at this stage, to limit the refactoring, permissions are still managed by the original code. - `ContainersXMLCollectionBuilder` was merged with `AlwaysThereFieldsExporter` - FieldMapperXml is gone (replaced by XMLTracker->export()) but we still need to generate the XML after creation of fields otherwise all the reports and semantic stuff should be converted to XMLTracker way of doing the things and that would be too much for one commit. In the meantime I dropped usage of FieldName formatter because it seems that field names are always compliant with Tuleap norms because they are either hard coded (so we can check easily) or they are custom and jira custom fields are always custom_XXXX where XXXX is a number. As a matter of fact it seems name formatter was only needed for cross reference field whose pseudo name (to match jira stuff) was made with dot. I choose to renamed the constant value at source instead. The tricky part is about the list values (like status or select box options) because in the previous implementation the XML id (for Tuleap) was actually generated when the value was fetched from Jira aka JiraFieldAPIAllowedValueRepresentation. As field values, at Tuleap side, are now created when the XMLListField is created (see JiraToTuleapFieldTypeMapper for select fields for instance) we have to re-create the values so they match the actual value ids in FieldMappingCollection. This is far from perfect but, again, it's a tradeoff to limit the impact of this refactoring. Part of: request #24222 Jira import fields that are only updated Change-Id: If0f919904d0262cfab2013ab4cc1459280045ca1
Modified Files
Name | ||||
---|---|---|---|---|
M | plugins/agiledashboard/tests/unit/AgileDashboard/Semantic/XML/SemanticExporterTest.php | +4 | −5 | Go to diff View file |
M | plugins/jira_import/include/Project/CreateProjectFromJira.php | +5 | −4 | Go to diff View file |
M | plugins/jira_import/include/Project/ReplayImportCommand.php | +4 | −8 | Go to diff View file |
M | plugins/tracker/include/Tracker/Creation/JiraImporter/FromJiraTrackerCreator.php | +4 | −7 | Go to diff View file |
M | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/AlwaysThereFieldsExporter.php | +158 | −167 | Go to diff View file |
M | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/JiraXmlExporter.php | +57 | −45 | Go to diff View file |
D | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/Structure/ContainersXMLCollection.php | +0 | −66 | Go to diff View file |
D | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/Structure/ContainersXMLCollectionBuilder.php | +0 | −147 | Go to diff View file |
M | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/Structure/FieldMappingCollection.php | +10 | −13 | Go to diff View file |
D | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/Structure/FieldXmlExporter.php | +0 | −134 | Go to diff View file |
M | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/Structure/JiraFieldAPIAllowedValueRepresentation.php | +10 | −0 | Go to diff View file |
M | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/Structure/JiraToTuleapFieldTypeMapper.php | +221 | −241 | Go to diff View file |
M | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/Structure/ListFieldMapping.php | +32 | −0 | Go to diff View file |
M | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/Structure/ScalarFieldMapping.php | +13 | −0 | Go to diff View file |
M | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/Structure/StoryPointFieldExporter.php | +29 | −29 | Go to diff View file |
A | plugins/tracker/include/Tracker/FormElement/Field/File/XML/XMLFileField.php | +36 | −0 | Go to diff View file |
A | plugins/tracker/include/Tracker/FormElement/Field/ListFields/Bind/BindStatic/XML/XMLBindUsersValue.php | +43 | −0 | Go to diff View file |
A | plugins/tracker/include/Tracker/FormElement/Field/ListFields/XML/XMLListField.php | +118 | −0 | Go to diff View file |
A | plugins/tracker/include/Tracker/FormElement/Field/ListFields/XML/XMLMultiSelectBoxField.php | +34 | −0 | Go to diff View file |
A | plugins/tracker/include/Tracker/FormElement/Field/ListFields/XML/XMLRadioButtonField.php | +34 | −0 | Go to diff View file |
M | plugins/tracker/include/Tracker/FormElement/Field/ListFields/XML/XMLSelectBoxField.php | +2 | −75 | Go to diff View file |
A | plugins/tracker/include/Tracker/FormElement/Field/Text/XML/XMLTextField.php | +35 | −0 | Go to diff View file |
M | plugins/tracker/include/Tracker/FormElement/XML/XMLFormElement.php | +2 | −2 | Go to diff View file |
M | plugins/tracker/include/Tracker/XML/XMLTracker.php | +12 | −2 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/FromJiraTrackerCreatorTest.php | +2 | −1 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/AlwaysThereFieldsExporterTest.php | +47 | −296 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/Artifact/ArtifactsXMLExporterTest.php | +2 | −3 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/Artifact/Snapshot/ChangelogSnapshotBuilderTest.php | +1 | −2 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/Artifact/Snapshot/CurrentSnapshotBuilderTest.php | +3 | −4 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/Artifact/Snapshot/InitialSnapshotBuilderTest.php | +1 | −2 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/Artifact/Snapshot/IssueSnapshotCollectionBuilderTest.php | +1 | −2 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/JiraXmlExporterTest.php | +5 | −22 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/Permissions/PermissionsXMLExporterTest.php | +3 | −4 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/Semantic/SemanticsXMLExporterTest.php | +2 | −2 | Go to diff View file |
D | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/Structure/ContainersXMLCollectionBuilderTest.php | +0 | −89 | Go to diff View file |
D | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/Structure/FieldXmlExporterTest.php | +0 | −82 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/Structure/JiraToTuleapFieldTypeMapperTest.php | +381 | −504 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/Structure/StoryPointFieldExporterTest.php | +61 | −50 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/_fixtures/IXMC/tracker.xml | +139 | −139 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/_fixtures/SBX/tracker.xml | +224 | −225 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/_fixtures/SP/tracker.xml | +104 | −104 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/FormElement/Field/ListFields/XML/XMLSelectBoxFieldTest.php | +45 | −3 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/XML/XMLTrackerTest.php | +12 | −0 | Go to diff View file |