Commit a2e10637 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

Set default cardinality of keyword reference to 1

Now that we have a different ui for simple vs reference keyword, cardinality on
keyword reference is no more meaningful and hidden in the UI, since we would
like to always have cardinality=1 for reference keyword when generating profiles.

The easiest way to do so is to set proper default value, else by removing the
attribute we would have to do extra customization to the SEDA 2 profile
generator to consider that it shouldn't use the cardinality in the SEDA 2 XSD
(0..1).

Closes #16070921
parent 17b947d38a25
......@@ -2254,7 +2254,7 @@ class seq_alt_archive_unit_archive_unit_ref_id_management_custodial_history_file
inlined = True
constraints = []
@seda_profile_element(cardinalities=['0..1', '1'], default_cardinality='0..1',
@seda_profile_element(cardinalities=['0..1', '1'], default_cardinality='1',
annotable=True)
class SEDAKeywordReference(EntityType):
u""""""
......
......@@ -263,37 +263,35 @@
</rng:optional>
<rng:value type="string">file</rng:value>
</rng:element>
<rng:optional>
<rng:element name="KeywordReference">
<rng:optional>
<rng:attribute name="schemeID">
<rng:data type="token"/>
</rng:attribute>
</rng:optional>
<rng:attribute name="schemeName">
<rng:value type="string">seda_description_level/None vocabulary</rng:value>
<rng:element name="KeywordReference">
<rng:optional>
<rng:attribute name="schemeID">
<rng:data type="token"/>
</rng:attribute>
<rng:optional>
<rng:attribute name="schemeAgencyName">
<rng:data type="string"/>
</rng:attribute>
</rng:optional>
<rng:optional>
<rng:attribute name="schemeVersionID">
<rng:data type="token"/>
</rng:attribute>
</rng:optional>
<rng:optional>
<rng:attribute name="schemeDataURI">
<rng:data type="anyURI"/>
</rng:attribute>
</rng:optional>
<rng:attribute name="schemeURI">
<rng:value type="anyURI">%(scheme-uri)s</rng:value>
</rng:optional>
<rng:attribute name="schemeName">
<rng:value type="string">seda_description_level/None vocabulary</rng:value>
</rng:attribute>
<rng:optional>
<rng:attribute name="schemeAgencyName">
<rng:data type="string"/>
</rng:attribute>
<rng:value type="string">%(concept-uri)s</rng:value>
</rng:element>
</rng:optional>
</rng:optional>
<rng:optional>
<rng:attribute name="schemeVersionID">
<rng:data type="token"/>
</rng:attribute>
</rng:optional>
<rng:optional>
<rng:attribute name="schemeDataURI">
<rng:data type="anyURI"/>
</rng:attribute>
</rng:optional>
<rng:attribute name="schemeURI">
<rng:value type="anyURI">%(scheme-uri)s</rng:value>
</rng:attribute>
<rng:value type="string">%(concept-uri)s</rng:value>
</rng:element>
<rng:optional>
<rng:element name="KeywordType">
<rng:attribute name="listVersionID">
......
......@@ -170,7 +170,7 @@
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element fixed="%(concept-uri)s" minOccurs="0" name="KeywordReference">
<xsd:element fixed="%(concept-uri)s" name="KeywordReference">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="qdt:ArchivesIDType">
......
......@@ -235,37 +235,35 @@
</rng:optional>
<rng:value type="string">file</rng:value>
</rng:element>
<rng:optional>
<rng:element name="KeywordReference">
<rng:optional>
<rng:attribute name="schemeID">
<rng:data type="token"/>
</rng:attribute>
</rng:optional>
<rng:attribute name="schemeName">
<rng:value type="string">seda_description_level/None vocabulary</rng:value>
<rng:element name="KeywordReference">
<rng:optional>
<rng:attribute name="schemeID">
<rng:data type="token"/>
</rng:attribute>
<rng:optional>
<rng:attribute name="schemeAgencyName">
<rng:data type="string"/>
</rng:attribute>
</rng:optional>
<rng:optional>
<rng:attribute name="schemeVersionID">
<rng:data type="token"/>
</rng:attribute>
</rng:optional>
<rng:optional>
<rng:attribute name="schemeDataURI">
<rng:data type="anyURI"/>
</rng:attribute>
</rng:optional>
<rng:attribute name="schemeURI">
<rng:value type="anyURI">%(scheme-uri)s</rng:value>
</rng:optional>
<rng:attribute name="schemeName">
<rng:value type="string">seda_description_level/None vocabulary</rng:value>
</rng:attribute>
<rng:optional>
<rng:attribute name="schemeAgencyName">
<rng:data type="string"/>
</rng:attribute>
<rng:value type="string">%(concept-uri)s</rng:value>
</rng:element>
</rng:optional>
</rng:optional>
<rng:optional>
<rng:attribute name="schemeVersionID">
<rng:data type="token"/>
</rng:attribute>
</rng:optional>
<rng:optional>
<rng:attribute name="schemeDataURI">
<rng:data type="anyURI"/>
</rng:attribute>
</rng:optional>
<rng:attribute name="schemeURI">
<rng:value type="anyURI">%(scheme-uri)s</rng:value>
</rng:attribute>
<rng:value type="string">%(concept-uri)s</rng:value>
</rng:element>
<rng:optional>
<rng:element name="KeywordType">
<rng:attribute name="listVersionID">
......
......@@ -157,7 +157,7 @@
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element fixed="%(concept-uri)s" minOccurs="0" name="KeywordReference">
<xsd:element fixed="%(concept-uri)s" name="KeywordReference">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="qdt:ArchivesIDType">
......
......@@ -492,8 +492,7 @@ class SEDA2ExportTCMixIn(object):
[{'name': 'listVersionID', 'fixed': 'seda_keyword_type_to/None vocabulary'}])
kwr = self.get_element(profile, 'KeywordReference')
self.assertElementDefinition(kwr, {'name': 'KeywordReference',
'type': 'xsd:token',
'minOccurs': '0'})
'type': 'xsd:token'})
self.assertXSDAttributes(
kwr,
[{'name': 'schemeAgencyID', 'type': 'xsd:token', 'use': 'optional'},
......@@ -508,8 +507,7 @@ class SEDA2ExportTCMixIn(object):
profile = self.profile_etree(transfer)
kwr = self.get_element(profile, 'KeywordReference')
self.assertElementDefinition(kwr, {'name': 'KeywordReference',
'type': 'xsd:token',
'minOccurs': '0'})
'type': 'xsd:token'})
self.assertXSDAttributes(
kwr,
[{'name': 'schemeURI', 'fixed': scheme.absolute_url()}])
......@@ -519,8 +517,7 @@ class SEDA2ExportTCMixIn(object):
kwr = self.get_element(profile, 'KeywordReference')
self.assertElementDefinition(kwr, {'name': 'KeywordReference',
'type': 'xsd:token',
'fixed': 'theme',
'minOccurs': '0'})
'fixed': 'theme'})
self.assertXSDAttributes(
kwr,
[{'name': 'schemeURI', 'fixed': scheme.absolute_url()}])
......
......@@ -197,6 +197,7 @@ RTYPE_CARD = {
}
DEFAULT_USER_CARDINALITY = {
'SEDAStartDate': '1',
'SEDAKeywordReference': '1',
}
for rule_type in RULE_TYPES:
etype = 'SEDASeq{0}RuleRule'.format(rule_type.capitalize())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment