dev

Forked from tuleap/dev

Clone or download

Read-only

story #6855 - artifact copy: Recursive copy

XML export of an artifact has now a new field exported: artifact link. This field expose only children of the artifact, other relations are ignored. The logic mostly revolves around a ChildrenCollector object. This class is responsible of collecting in a stack the various children we encounter during the xml export, starting from the root artifact (the one that is copied). Then, until this stack is empty, we continue to export in xml the corresponding artifacts, à la breadth-first search. This mechanism is then reused during the xml import: each child that is present in the xml is added to a ChildrenCollector and with the help of a mapping between original and new artifacts, we can add the children to artifacts in a new changeset. Notes: If a child is not readable by the current user, then it will not be exported in xml (thus not copied) as well as its own children. Please note that the xml is flat: no hierarchy is shown, only artifact links field links artifacts to each other. We should add semantic to the link when we will extend the xml import to handle other types of artifacts relationship. In order to be able to import a hierarchy of artifacts, the xml must contain reference to the tracker ids. It is of course optional when you do not have hierarchy like in tv3 to tv5 migration. Change-Id: I9a7f78bc7b57c57f71efa1a64cae9cc1c013357f

Modified Files

Name
M plugins/tracker/include/Tracker/Action/CopyArtifact.class.php +36 −9 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/XMLImport/ArtifactFieldsDataBuilder.class.php +5 −0 Go to diff View file
A plugins/tracker/include/Tracker/Artifact/XMLImport/Exception/ArtifactLinksAreIgnoredException.php +23 −0 Go to diff View file
M plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field_ArtifactLink.class.php +1 −0 Go to diff View file
M plugins/tracker/include/Tracker/Tracker.class.php +130 −104 Go to diff View file
R plugins/tracker/include/Tracker/XMLExporter/ArtifactXMLExporter.class.php Go to diff View file
A plugins/tracker/include/Tracker/XMLExporter/ChangesetValue/ChangesetValueArtifactLinkXMLExporter.class.php +91 −0 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValue/ChangesetValueDateXMLExporter.class.php +1 −0 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValue/ChangesetValueFileXMLExporter.class.php +1 −0 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValue/ChangesetValueFloatXMLExporter.class.php +1 −0 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValue/ChangesetValueIntegerXMLExporter.class.php +1 −0 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValue/ChangesetValueListXMLExporter.class.php +1 −0 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValue/ChangesetValuePermissionsOnArtifactXMLExporter.class.php +6 −1 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValue/ChangesetValueStringXMLExporter.class.php +1 −0 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValue/ChangesetValueTextXMLExporter.class.php +1 −0 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValue/ChangesetValueUnknownXMLExporter.class.php +1 −0 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValue/ChangesetValueXMLExporter.class.php +1 −0 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValueXMLExporterVisitor.class.php +10 −2 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetValuesXMLExporter.class.php +4 −0 Go to diff View file
M plugins/tracker/include/Tracker/XMLExporter/ChangesetXMLExporter.class.php +1 −1 Go to diff View file
A plugins/tracker/include/Tracker/XMLExporter/ChildrenCollector.php +91 −0 Go to diff View file
A plugins/tracker/include/Tracker/XMLExporter/ChildrenXMLExporter.php +69 −0 Go to diff View file
A plugins/tracker/include/Tracker/XMLExporter/TooManyChildrenException.php +22 −0 Go to diff View file
A plugins/tracker/include/Tracker/XMLImporter/ArtifactImportedMapping.php +36 −0 Go to diff View file
A plugins/tracker/include/Tracker/XMLImporter/ChildrenXMLImporter.php +149 −0 Go to diff View file
A plugins/tracker/include/Tracker/XMLImporter/TrackerIdNotDefinedException.php +22 −0 Go to diff View file
M plugins/tracker/include/autoload.php +11 −3 Go to diff View file
M plugins/tracker/tests/Artifact/XMLImportTest.php +41 −0 Go to diff View file
M plugins/tracker/tests/Tracker/Action/CopyArtifactTest.php +44 −3 Go to diff View file
M plugins/tracker/tests/Tracker/XMLExporter/ArtifactXMLExporterTest.php +2 −1 Go to diff View file
A plugins/tracker/tests/Tracker/XMLExporter/ChangesetValue/ChangesetValueArtifactLinkXMLExporterTest.php +187 −0 Go to diff View file
M plugins/tracker/tests/Tracker/XMLExporter/ChangesetValue/ChangesetValueFileXMLExporterTest.php +3 −0 Go to diff View file
M plugins/tracker/tests/Tracker/XMLExporter/ChangesetValue/ChangesetValueIntegerXMLExporterTest.php +1 −0 Go to diff View file
M plugins/tracker/tests/Tracker/XMLExporter/ChangesetValue/ChangesetValueListXMLExporterTest.php +2 −0 Go to diff View file
M plugins/tracker/tests/Tracker/XMLExporter/ChangesetValue/ChangesetValueOpenListXMLExporterTest.php +1 −0 Go to diff View file
M plugins/tracker/tests/Tracker/XMLExporter/ChangesetValue/ChangesetValuePermissionsOnArtifactXMLExporterTest.php +1 −0 Go to diff View file
M plugins/tracker/tests/Tracker/XMLExporter/ChangesetValue/ChangesetValueTextXMLExporterTest.php +1 −0 Go to diff View file
M plugins/tracker/tests/Tracker/XMLExporter/ChangesetValueXMLExporterVisitorTest.php +34 −7 Go to diff View file
M plugins/tracker/tests/Tracker/XMLExporter/ChangesetValuesXMLExporterTest.php +8 −2 Go to diff View file
M plugins/tracker/tests/Tracker/XMLExporter/ChangesetXMLExporterTest.php +6 −1 Go to diff View file
A plugins/tracker/tests/Tracker/XMLExporter/ChildrenCollectorTest.php +89 −0 Go to diff View file
A plugins/tracker/tests/Tracker/XMLExporter/ChildrenXMLExporterTest.php +150 −0 Go to diff View file
A plugins/tracker/tests/Tracker/XMLImporter/ChildrenXMLImporterTest.php +297 −0 Go to diff View file
M plugins/tracker/tests/builders/aChangeset.php +5 −0 Go to diff View file
M plugins/tracker/www/resources/artifacts.rnc +6 −0 Go to diff View file
M plugins/tracker/www/resources/artifacts.rng +16 −0 Go to diff View file