Commit 8374e3cf authored by Yann Voté's avatar Yann Voté
Browse files

[code gen] Backed out 28ed3877dd2a to reintroduce CustodialHistory

Related to #13751449.
parent 5ff6441a97fe
......@@ -527,6 +527,21 @@ class SEDAKeywordType(AnyEntity):
fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
value_attr = None
class SEDACustodialHistoryItem(AnyEntity):
__regid__ = 'SEDACustodialHistoryItem'
fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality', 'custodial_history_item'])
value_attr = 'custodial_history_item'
class SEDACustodialHistoryFile(AnyEntity):
__regid__ = 'SEDACustodialHistoryFile'
fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
value_attr = None
class SEDAwhen(AnyEntity):
__regid__ = 'SEDAwhen'
fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
value_attr = None
class SEDARelationship(AnyEntity):
__regid__ = 'SEDARelationship'
fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
......
......@@ -205,22 +205,6 @@ class SEDA2XSDExport(EntityAdapter):
if xselement.local_name == 'Signature':
attrs['type'] = 'OpenType'
self._target_element(xselement, profile_element, attrs)
elif xselement.local_name == 'CustodialHistory': # XXX: do not hardcode, read it from xsd
ch = self._target_element(xselement, profile_element, {})
ch_type = self.element('xsd:complexType', ch)
ch_seq = self.element('xsd:sequence', ch_type)
chi = self.element('xsd:element', ch_seq,
attributes={'name': 'CustodialHistoryItem', 'minOccurs': '1',
'maxOccurs': 'unbounded'})
chi_type = self.element('xsd:complexType', chi)
chi_content = self.element('xsd:simpleContent', chi_type)
chi_extension = self.element('xsd:extension', chi_content,
attributes={'base': 'xsd:string'})
self.element('xsd:attribute', chi_extension,
attributes={'name': 'when', 'type': 'datedateTime', 'use': 'optional'})
self.element('xsd:element', ch_seq,
attributes={'name': 'CustodialHistoryFile', 'minOccurs': '0',
'type': 'xsd:IDREF'})
elif isinstance(occ, dict): # fake occurence introduced for some elements'content
# target element has already been introduced: it is now given as profile_element
target_element = profile_element
......
......@@ -119,6 +119,7 @@ class EnsureArchiveUnitHasAContentOp(hook.DataOperationMixIn, hook.Operation):
continue
content = self.cnx.create_entity('SEDAContent', seda_content=seq)
self.cnx.create_entity('SEDATitle', seda_title=content)
self.cnx.create_entity('SEDACustodialHistoryItem', seda_custodial_history_item=content)
class EnsureArchiveUnitHasAContentHook(hook.Hook):
......
......@@ -203,6 +203,12 @@ msgstr ""
msgid "New SEDACreatingOsVersion"
msgstr ""
msgid "New SEDACustodialHistoryFile"
msgstr ""
msgid "New SEDACustodialHistoryItem"
msgstr ""
msgid "New SEDADataObjectReference"
msgstr ""
......@@ -503,6 +509,9 @@ msgstr ""
msgid "New SEDArestrictionValue"
msgstr ""
msgid "New SEDAwhen"
msgstr ""
msgid "Relationship target of"
msgstr ""
......@@ -884,6 +893,18 @@ msgstr ""
msgid "SEDACreatingOs_plural"
msgstr ""
msgid "SEDACustodialHistoryFile"
msgstr ""
msgid "SEDACustodialHistoryFile_plural"
msgstr ""
msgid "SEDACustodialHistoryItem"
msgstr ""
msgid "SEDACustodialHistoryItem_plural"
msgstr ""
msgid "SEDADataObjectReference"
msgstr ""
......@@ -1849,6 +1870,16 @@ msgstr ""
msgid "SEDArestrictionValue_plural"
msgstr ""
msgid "SEDAwhen"
msgstr ""
msgctxt "inlined:SEDACustodialHistoryItem.seda_when.object"
msgid "SEDAwhen"
msgstr ""
msgid "SEDAwhen_plural"
msgstr ""
msgid ""
"Special relation from a concept scheme to a relation type, that may be used "
"to restrict possible concept of a particular relation without depending on "
......@@ -2101,6 +2132,18 @@ msgstr ""
msgid "This SEDACreatingOsVersion:"
msgstr ""
msgid "This SEDACustodialHistoryFile"
msgstr ""
msgid "This SEDACustodialHistoryFile:"
msgstr ""
msgid "This SEDACustodialHistoryItem"
msgstr ""
msgid "This SEDACustodialHistoryItem:"
msgstr ""
msgid "This SEDADataObjectReference"
msgstr ""
......@@ -2701,6 +2744,12 @@ msgstr ""
msgid "This SEDArestrictionValue:"
msgstr ""
msgid "This SEDAwhen"
msgstr ""
msgid "This SEDAwhen:"
msgstr ""
msgid "This object is used as a relationship target of the following entities"
msgstr ""
......@@ -2962,6 +3011,12 @@ msgstr ""
msgid "add a SEDACreatingOsVersion"
msgstr ""
msgid "add a SEDACustodialHistoryFile"
msgstr ""
msgid "add a SEDACustodialHistoryItem"
msgstr ""
msgid "add a SEDADataObjectReference"
msgstr ""
......@@ -3627,6 +3682,13 @@ msgctxt "inlined:SEDAContent.seda_restriction_value.object"
msgid "add a SEDArestrictionValue"
msgstr ""
msgid "add a SEDAwhen"
msgstr ""
msgctxt "inlined:SEDACustodialHistoryItem.seda_when.object"
msgid "add a SEDAwhen"
msgstr ""
msgid "archival_agency_archive_unit_identifier"
msgstr ""
......@@ -3828,6 +3890,14 @@ msgctxt "SEDACreatingOsVersion"
msgid "container"
msgstr ""
msgctxt "SEDACustodialHistoryFile"
msgid "container"
msgstr ""
msgctxt "SEDACustodialHistoryItem"
msgid "container"
msgstr ""
msgctxt "SEDADataObjectReference"
msgid "container"
msgstr ""
......@@ -4228,6 +4298,10 @@ msgctxt "SEDArestrictionValue"
msgid "container"
msgstr ""
msgctxt "SEDAwhen"
msgid "container"
msgstr ""
msgid "container_object"
msgstr ""
......@@ -4265,6 +4339,12 @@ msgid ""
"SEDASeqAltArchiveUnitArchiveUnitRefIdManagement %(linkto)s)"
msgstr ""
#, python-format
msgid ""
"creating SEDACustodialHistoryItem (SEDACustodialHistoryItem "
"seda_custodial_history_item SEDAContent %(linkto)s)"
msgstr ""
#, python-format
msgid ""
"creating SEDADataObjectReference (SEDADataObjectReference "
......@@ -4377,6 +4457,12 @@ msgstr ""
msgid "ctxcomponents_seda.tree_description"
msgstr ""
msgid "custodial_history_item"
msgstr ""
msgctxt "SEDACustodialHistoryItem"
msgid "custodial_history_item"
msgstr ""
msgctxt "SEDADescription"
msgid "description"
......@@ -5229,6 +5315,9 @@ msgstr ""
msgid "seda_content_gps_tab"
msgstr ""
msgid "seda_content_history_tab"
msgstr ""
msgid "seda_content_identification_tab"
msgstr ""
......@@ -5315,6 +5404,34 @@ msgctxt "SEDABinaryDataObject"
msgid "seda_creating_os_version_object"
msgstr ""
msgid "seda_custodial_history_file"
msgstr ""
msgctxt "SEDACustodialHistoryFile"
msgid "seda_custodial_history_file"
msgstr ""
msgid "seda_custodial_history_file_object"
msgstr ""
msgctxt "SEDAContent"
msgid "seda_custodial_history_file_object"
msgstr ""
msgid "seda_custodial_history_item"
msgstr ""
msgctxt "SEDACustodialHistoryItem"
msgid "seda_custodial_history_item"
msgstr ""
msgid "seda_custodial_history_item_object"
msgstr ""
msgctxt "SEDAContent"
msgid "seda_custodial_history_item_object"
msgstr ""
msgid "seda_data_object_reference"
msgstr ""
......@@ -5325,6 +5442,10 @@ msgstr ""
msgid "seda_data_object_reference_id"
msgstr ""
msgctxt "SEDACustodialHistoryFile"
msgid "seda_data_object_reference_id"
msgstr ""
msgctxt "SEDADataObjectReference"
msgid "seda_data_object_reference_id"
msgstr ""
......@@ -7341,6 +7462,20 @@ msgctxt "SEDAPhysicalDataObject"
msgid "seda_weight_object"
msgstr ""
msgid "seda_when"
msgstr ""
msgctxt "SEDAwhen"
msgid "seda_when"
msgstr ""
msgid "seda_when_object"
msgstr ""
msgctxt "SEDACustodialHistoryItem"
msgid "seda_when_object"
msgstr ""
msgid "seda_width"
msgstr ""
......@@ -7589,6 +7724,14 @@ msgctxt "SEDACreatingOsVersion"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDACustodialHistoryFile"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDACustodialHistoryItem"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDADataObjectReference"
msgid "user_cardinality"
msgstr ""
......@@ -7969,6 +8112,10 @@ msgctxt "SEDArestrictionValue"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDAwhen"
msgid "user_cardinality"
msgstr ""
msgid "version"
msgstr ""
......
......@@ -206,6 +206,12 @@ msgstr ""
msgid "New SEDACreatingOsVersion"
msgstr ""
msgid "New SEDACustodialHistoryFile"
msgstr ""
msgid "New SEDACustodialHistoryItem"
msgstr ""
msgid "New SEDADataObjectReference"
msgstr ""
......@@ -506,6 +512,9 @@ msgstr ""
msgid "New SEDArestrictionValue"
msgstr ""
msgid "New SEDAwhen"
msgstr ""
msgid "Relationship target of"
msgstr "Cible des relations"
......@@ -887,6 +896,18 @@ msgstr ""
msgid "SEDACreatingOs_plural"
msgstr ""
msgid "SEDACustodialHistoryFile"
msgstr ""
msgid "SEDACustodialHistoryFile_plural"
msgstr ""
msgid "SEDACustodialHistoryItem"
msgstr ""
msgid "SEDACustodialHistoryItem_plural"
msgstr ""
msgid "SEDADataObjectReference"
msgstr ""
......@@ -1852,6 +1873,16 @@ msgstr ""
msgid "SEDArestrictionValue_plural"
msgstr ""
msgid "SEDAwhen"
msgstr "date"
msgctxt "inlined:SEDACustodialHistoryItem.seda_when.object"
msgid "SEDAwhen"
msgstr ""
msgid "SEDAwhen_plural"
msgstr ""
msgid ""
"Special relation from a concept scheme to a relation type, that may be used "
"to restrict possible concept of a particular relation without depending on "
......@@ -2104,6 +2135,18 @@ msgstr ""
msgid "This SEDACreatingOsVersion:"
msgstr ""
msgid "This SEDACustodialHistoryFile"
msgstr ""
msgid "This SEDACustodialHistoryFile:"
msgstr ""
msgid "This SEDACustodialHistoryItem"
msgstr ""
msgid "This SEDACustodialHistoryItem:"
msgstr ""
msgid "This SEDADataObjectReference"
msgstr ""
......@@ -2704,6 +2747,12 @@ msgstr ""
msgid "This SEDArestrictionValue:"
msgstr ""
msgid "This SEDAwhen"
msgstr ""
msgid "This SEDAwhen:"
msgstr ""
msgid "This object is used as a relationship target of the following entities"
msgstr "Cet objet est utilisé comme cible des relations suivantes :"
......@@ -2965,6 +3014,12 @@ msgstr ""
msgid "add a SEDACreatingOsVersion"
msgstr ""
msgid "add a SEDACustodialHistoryFile"
msgstr "ajouter une référence à un fichier de journalisation externe"
msgid "add a SEDACustodialHistoryItem"
msgstr ""
msgid "add a SEDADataObjectReference"
msgstr ""
......@@ -3630,6 +3685,12 @@ msgctxt "inlined:SEDAContent.seda_restriction_value.object"
msgid "add a SEDArestrictionValue"
msgstr ""
msgid "add a SEDAwhen"
msgstr "ajouter un horodatage"
msgctxt "inlined:SEDACustodialHistoryItem.seda_when.object"
msgid "add a SEDAwhen"
msgstr ""
msgid "archival_agency_archive_unit_identifier"
msgstr "valeur"
......@@ -3832,6 +3893,14 @@ msgctxt "SEDACreatingOsVersion"
msgid "container"
msgstr ""
msgctxt "SEDACustodialHistoryFile"
msgid "container"
msgstr ""
msgctxt "SEDACustodialHistoryItem"
msgid "container"
msgstr ""
msgctxt "SEDADataObjectReference"
msgid "container"
msgstr ""
......@@ -4232,6 +4301,10 @@ msgctxt "SEDArestrictionValue"
msgid "container"
msgstr ""
msgctxt "SEDAwhen"
msgid "container"
msgstr ""
msgid "container_object"
msgstr ""
......@@ -4269,6 +4342,12 @@ msgid ""
"SEDASeqAltArchiveUnitArchiveUnitRefIdManagement %(linkto)s)"
msgstr "création d'un contenu dans l'unité d'archive %(linkto)s"
#, python-format
msgid ""
"creating SEDACustodialHistoryItem (SEDACustodialHistoryItem "
"seda_custodial_history_item SEDAContent %(linkto)s)"
msgstr ""
#, python-format
msgid ""
"creating SEDADataObjectReference (SEDADataObjectReference "
......@@ -4386,6 +4465,12 @@ msgstr ""
msgid "ctxcomponents_seda.tree_description"
msgstr ""
msgid "custodial_history_item"
msgstr "période ou évènement"
msgctxt "SEDACustodialHistoryItem"
msgid "custodial_history_item"
msgstr ""
msgctxt "SEDADescription"
msgid "description"
......@@ -5238,6 +5323,9 @@ msgstr "évènements"
msgid "seda_content_gps_tab"
msgstr "coordonnées GPS"
msgid "seda_content_history_tab"
msgstr "historique de conservation"
msgid "seda_content_identification_tab"
msgstr "identification"
......@@ -5324,6 +5412,34 @@ msgctxt "SEDABinaryDataObject"
msgid "seda_creating_os_version_object"
msgstr ""
msgid "seda_custodial_history_file"
msgstr ""
msgctxt "SEDACustodialHistoryFile"
msgid "seda_custodial_history_file"
msgstr ""
msgid "seda_custodial_history_file_object"
msgstr ""
msgctxt "SEDAContent"
msgid "seda_custodial_history_file_object"
msgstr ""
msgid "seda_custodial_history_item"
msgstr ""
msgctxt "SEDACustodialHistoryItem"
msgid "seda_custodial_history_item"
msgstr ""
msgid "seda_custodial_history_item_object"
msgstr "élément d'historique"
msgctxt "SEDAContent"
msgid "seda_custodial_history_item_object"
msgstr ""
msgid "seda_data_object_reference"
msgstr ""
......@@ -5334,6 +5450,10 @@ msgstr ""
msgid "seda_data_object_reference_id"
msgstr "objet-données référencé"
msgctxt "SEDACustodialHistoryFile"
msgid "seda_data_object_reference_id"
msgstr ""
msgctxt "SEDADataObjectReference"
msgid "seda_data_object_reference_id"
msgstr ""
......@@ -7350,6 +7470,20 @@ msgctxt "SEDAPhysicalDataObject"
msgid "seda_weight_object"
msgstr ""
msgid "seda_when"
msgstr ""
msgctxt "SEDAwhen"
msgid "seda_when"
msgstr ""
msgid "seda_when_object"
msgstr ""
msgctxt "SEDACustodialHistoryItem"
msgid "seda_when_object"
msgstr ""
msgid "seda_width"
msgstr ""
......@@ -7598,6 +7732,14 @@ msgctxt "SEDACreatingOsVersion"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDACustodialHistoryFile"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDACustodialHistoryItem"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDADataObjectReference"
msgid "user_cardinality"
msgstr ""
......@@ -7978,6 +8120,10 @@ msgctxt "SEDArestrictionValue"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDAwhen"
msgid "user_cardinality"
msgstr ""
msgid "version"
msgstr "valeur"
......
......@@ -1874,6 +1874,61 @@ class keyword_type_keyword_type_to(RelationDefinition):
inlined = True
constraints = [RQLConstraint('O in_scheme CS, CS scheme_relation_type CR, CR name "seda_keyword_type_to"')]
@seda_profile_element(cardinalities=['1..n', '1'], default_cardinality='1..n',
annotable=False)
class SEDACustodialHistoryItem(EntityType):
u""""""
custodial_history_item = String()
class content_custodial_history_item(RelationDefinition):
name = 'seda_custodial_history_item'
subject = 'SEDACustodialHistoryItem'
object = 'SEDAContent'
cardinality = '1+'
composite = fulltext_container = 'object'
inlined = True
constraints = []
@seda_profile_element(cardinalities=['0..1', '1'], default_cardinality='0..1',
annotable=False)
class SEDACustodialHistoryFile(EntityType):
u""""""
class content_custodial_history_file(RelationDefinition):
name = 'seda_custodial_history_file'
subject = 'SEDACustodialHistoryFile'
object = 'SEDAContent'
cardinality = '1?'
composite = fulltext_container = 'object'
inlined = True
constraints = []
class custodial_history_file_data_object_reference_id(RelationDefinition):
name = 'seda_data_object_reference_id'
subject = 'SEDACustodialHistoryFile'
object = ('SEDABinaryDataObject', 'SEDAPhysicalDataObject')
cardinality = '?*'
composite = fulltext_container = None
inlined = True
constraints = [RQLConstraint('S container C, O container C')]
@seda_profile_element(cardinalities=['0..1', '1'], default_cardinality='0..1',
annotable=False)
class SEDAwhen(EntityType):
u""""""
class custodial_history_item_when(RelationDefinition):
name = 'seda_when'
subject = 'SEDAwhen'
object = 'SEDACustodialHistoryItem'
cardinality = '1?'
composite = fulltext_container = 'object'
inlined = True
constraints = []
class seq_alt_archive_unit_archive_unit_ref_id_management_storage_rule(RelationDefinition):
name = 'seda_storage_rule'
subject = 'SEDAStorageRule'
......
......@@ -75,9 +75,10 @@ class ArchiveUnitContentTC(CubicWebTC):
au = cnx.entity_from_eid(au.eid)
# Check that a SEDAContent has been created
self.assertTrue(au.first_level_choice.content_sequence.reverse_seda_content)
# A title have also been created
# A title and a custodial history item have also been created
content = au.first_level_choice.content_sequence.reverse_seda_content[0]
self.assertTrue(content.reverse_seda_title)
self.assertTrue(content.reverse_seda_custodial_history_item)
def test_no_new_content_create(self):
"""Check that a SEDAContent entity is not created when an ArchiveUnit with one is created.
......@@ -93,6 +94,7 @@ class ArchiveUnitContentTC(CubicWebTC):
reverse_seda_seq_alt_archive_unit_archive_unit_ref_id_management=alt)
content = cnx.create_entity('SEDAContent', seda_content=seq)
cnx.create_entity('SEDATitle', seda_title=content)
cnx.create_entity('SEDACustodialHistoryItem', seda_custodial_history_item=content)
cnx.commit()