[profile gen] In SEDA 1.0, archival agency should occurs before transferring agency
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 07 Nov 2017 14:40:09 +0100
changeset 2872 1e715baea780
parent 2871 20d1509fb15a
child 2873 9a89315814f7
[profile gen] In SEDA 1.0, archival agency should occurs before transferring agency Related to #17113836
cubicweb_seda/entities/profile_generation.py
test/data/seda_1_export.rng
test/data/seda_1_export.xsd
--- a/cubicweb_seda/entities/profile_generation.py	Tue Nov 07 14:38:33 2017 +0100
+++ b/cubicweb_seda/entities/profile_generation.py	Tue Nov 07 14:40:09 2017 +0100
@@ -871,6 +871,8 @@
                 assert au_or_bdo.cw_etype == 'SEDAArchiveUnit'
                 self.xsd_archive_object(parent, au_or_bdo)
 
+    agencies_in_order = ('ArchivalAgency', 'TransferringAgency')
+
     def xsd_transfer_base(self, parent, archive_transfer):
         """Create ArchiveTransfer element and add child which are common in 0.2 and 1.0.
         """
@@ -886,7 +888,7 @@
         self.element_schema(transfer_node, 'Date', 'udt:DateTimeType')
         self.element_schema(transfer_node, 'TransferIdentifier', 'qdt:ArchivesIDType',
                             xsd_attributes=self.xsd_attributes_scheme())
-        for agency_type in ('TransferringAgency', 'ArchivalAgency'):
+        for agency_type in self.agencies_in_order:
             self.xsd_agency(transfer_node, agency_type)
         return transfer_node
 
@@ -1201,6 +1203,8 @@
 
     concepts_language = 'seda-02'
 
+    agencies_in_order = ('TransferringAgency', 'ArchivalAgency')
+
     def xsd_transfer(self, parent, archive_transfer):
         """Append XSD elements for the archive transfer to the given parent node."""
         transfer_node = self.xsd_transfer_base(parent, archive_transfer)
--- a/test/data/seda_1_export.rng	Tue Nov 07 14:38:33 2017 +0100
+++ b/test/data/seda_1_export.rng	Tue Nov 07 14:40:09 2017 +0100
@@ -68,7 +68,7 @@
         </rng:optional>
         <rng:data type="string"/>
       </rng:element>
-      <rng:element name="TransferringAgency">
+      <rng:element name="ArchivalAgency">
         <rng:element name="Identification">
           <rng:optional>
             <rng:attribute name="schemeID">
@@ -108,7 +108,7 @@
           </rng:element>
         </rng:optional>
       </rng:element>
-      <rng:element name="ArchivalAgency">
+      <rng:element name="TransferringAgency">
         <rng:element name="Identification">
           <rng:optional>
             <rng:attribute name="schemeID">
--- a/test/data/seda_1_export.xsd	Tue Nov 07 14:38:33 2017 +0100
+++ b/test/data/seda_1_export.xsd	Tue Nov 07 14:40:09 2017 +0100
@@ -44,7 +44,7 @@
             </xsd:simpleContent>
           </xsd:complexType>
         </xsd:element>
-        <xsd:element name="TransferringAgency">
+        <xsd:element name="ArchivalAgency">
           <xsd:complexType>
             <xsd:sequence>
               <xsd:element name="Identification">
@@ -65,7 +65,7 @@
             </xsd:sequence>
           </xsd:complexType>
         </xsd:element>
-        <xsd:element name="ArchivalAgency">
+        <xsd:element name="TransferringAgency">
           <xsd:complexType>
             <xsd:sequence>
               <xsd:element name="Identification">