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

[code gen] Skip URI/filename on Attachment, reintroduce Filename on BinaryDataObject

The later has been skipped, while it makes sense sometime to specify it during
profile definition.

The former are skipped to make the UI for Attachment or URI on BinaryDataObject
much clearer.

Closes #13751394 and #13830622
parent d969675aaacf
......@@ -49,7 +49,7 @@ class SEDATransferRequestReplyIdentifier(AnyEntity):
class SEDABinaryDataObject(AnyEntity):
__regid__ = 'SEDABinaryDataObject'
fetch_attrs, cw_fetch_order = fetch_config(['id', 'user_cardinality', 'user_annotation'])
fetch_attrs, cw_fetch_order = fetch_config(['id', 'filename', 'user_cardinality', 'user_annotation'])
value_attr = 'id'
class SEDAPhysicalDataObject(AnyEntity):
......@@ -664,12 +664,7 @@ class SEDAAttachment(AnyEntity):
class SEDAUri(AnyEntity):
__regid__ = 'SEDAUri'
fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
value_attr = None
class SEDAfilename(AnyEntity):
__regid__ = 'SEDAfilename'
fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
fetch_attrs, cw_fetch_order = fetch_config([])
value_attr = None
class SEDAMimeTypeCodeListVersion(AnyEntity):
......
......@@ -140,11 +140,19 @@ class SEDA2XSDExport(EntityAdapter):
if not path:
assert not isinstance(occ.target, graph_nodes.XMLAttribute)
if occ.target.local_name in JUMPED_OPTIONAL_ELEMENTS:
# FileInfo is jumped but has optional cardinality, so search in all it's child
# element, and mark it as mandatory if one of them is mandatory, else keep it
# optional
# elements in JUMPED_OPTIONAL_ELEMENTS are jumped but have optional cardinality,
# so search in all it's child element, and mark it as mandatory if one of them
# is mandatory, else keep it optional
cardinality = '0..1'
for rtype, role, _ in XSDM_MAPPING.iter_rtype_role(occ.target.local_name):
for rtype, role, _path in XSDM_MAPPING.iter_rtype_role(occ.target.local_name):
if _path[0][2] in BASE_TYPES:
# special case of a mandatory attribute: parent element will be
# mandatory if some value is specified, else that's fine
if getattr(entity, rtype) is not None:
cardinality = '1'
break
else:
continue
targets = entity.related(rtype, role, entities=True)
if any(target.user_cardinality == '1' for target in targets):
cardinality = '1'
......@@ -487,7 +495,13 @@ def _complex_path_target_values(entity, path):
if target_etype in BASE_TYPES:
rtype_targets.append((entity, getattr(entity, rtype, None)))
else:
targets = entity.related(rtype, role, entities=True)
try:
targets = entity.related(rtype, role, entities=True)
except KeyError:
# the relation is not defined in the schema: element is not modelized but should
# be added in the XSD
rtype_targets.append((entity, None))
continue
if targets:
rtype_targets += [(entity, t) for t in targets]
# if relation is not composite, that means it's a "value" relation, hence we should
......
......@@ -7,10 +7,6 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#, python-format
msgid " (attributes: %s)"
msgstr ""
msgid " ALT_I18N "
msgstr ""
......@@ -497,9 +493,6 @@ msgstr ""
msgid "New SEDAWriter"
msgstr ""
msgid "New SEDAfilename"
msgstr ""
msgid "New SEDArestrictionEndDate"
msgstr ""
......@@ -1684,10 +1677,6 @@ msgctxt "inlined:SEDAAltBinaryDataObjectAttachment.seda_uri.object"
msgid "SEDAUri"
msgstr ""
msgctxt "inlined:SEDAAttachment.seda_uri.object"
msgid "SEDAUri"
msgstr ""
msgid "SEDAUri_plural"
msgstr ""
......@@ -1719,16 +1708,6 @@ msgstr ""
msgid "SEDAWriter_plural"
msgstr ""
msgid "SEDAfilename"
msgstr ""
msgctxt "inlined:SEDAAttachment.seda_filename.object"
msgid "SEDAfilename"
msgstr ""
msgid "SEDAfilename_plural"
msgstr ""
msgid "SEDArestrictionEndDate"
msgstr ""
......@@ -2597,12 +2576,6 @@ msgstr ""
msgid "This SEDAWriter:"
msgstr ""
msgid "This SEDAfilename"
msgstr ""
msgid "This SEDAfilename:"
msgstr ""
msgid "This SEDArestrictionEndDate"
msgstr ""
......@@ -3400,10 +3373,6 @@ msgctxt "inlined:SEDAAltBinaryDataObjectAttachment.seda_uri.object"
msgid "add a SEDAUri"
msgstr ""
msgctxt "inlined:SEDAAttachment.seda_uri.object"
msgid "add a SEDAUri"
msgstr ""
msgid "add a SEDAVersion"
msgstr ""
......@@ -3420,13 +3389,6 @@ msgstr ""
msgid "add a SEDAWriter"
msgstr ""
msgid "add a SEDAfilename"
msgstr ""
msgctxt "inlined:SEDAAttachment.seda_filename.object"
msgid "add a SEDAfilename"
msgstr ""
msgid "add a SEDArestrictionEndDate"
msgstr ""
......@@ -4036,10 +3998,6 @@ msgctxt "SEDAWriter"
msgid "container"
msgstr ""
msgctxt "SEDAfilename"
msgid "container"
msgstr ""
msgctxt "SEDArestrictionEndDate"
msgid "container"
msgstr ""
......@@ -4239,6 +4197,13 @@ msgctxt "SEDAFilePlanPosition"
msgid "file_plan_position"
msgstr ""
msgid "filename"
msgstr ""
msgctxt "SEDABinaryDataObject"
msgid "filename"
msgstr ""
#, python-brace-format
msgid "final action: {0}"
msgstr ""
......@@ -4319,9 +4284,6 @@ msgctxt "SEDANeedReassessingAuthorization"
msgid "need_reassessing_authorization"
msgstr ""
msgid "optional"
msgstr ""
msgid "originating_agency_archive_unit_identifier"
msgstr ""
......@@ -5640,20 +5602,6 @@ msgctxt "SEDAContent"
msgid "seda_file_plan_position_object"
msgstr ""
msgid "seda_filename"
msgstr ""
msgctxt "SEDAfilename"
msgid "seda_filename"
msgstr ""
msgid "seda_filename_object"
msgstr ""
msgctxt "SEDAAttachment"
msgid "seda_filename_object"
msgstr ""
msgid "seda_final_action"
msgstr ""
......@@ -7193,10 +7141,6 @@ msgctxt "SEDAAltBinaryDataObjectAttachment"
msgid "seda_uri_object"
msgstr ""
msgctxt "SEDAAttachment"
msgid "seda_uri_object"
msgstr ""
msgid "seda_version"
msgstr ""
......@@ -7839,10 +7783,6 @@ msgctxt "SEDAType"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDAUri"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDAVersion"
msgid "user_cardinality"
msgstr ""
......@@ -7859,10 +7799,6 @@ msgctxt "SEDAWriter"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDAfilename"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDArestrictionEndDate"
msgid "user_cardinality"
msgstr ""
......
......@@ -7,10 +7,6 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#, python-format
msgid " (attributes: %s)"
msgstr " (attributs : %s)"
msgid " ALT_I18N "
msgstr " OU "
......@@ -500,9 +496,6 @@ msgstr ""
msgid "New SEDAWriter"
msgstr "Nouveau rédacteur"
msgid "New SEDAfilename"
msgstr ""
msgid "New SEDArestrictionEndDate"
msgstr ""
......@@ -1687,10 +1680,6 @@ msgctxt "inlined:SEDAAltBinaryDataObjectAttachment.seda_uri.object"
msgid "SEDAUri"
msgstr ""
msgctxt "inlined:SEDAAttachment.seda_uri.object"
msgid "SEDAUri"
msgstr ""
msgid "SEDAUri_plural"
msgstr ""
......@@ -1722,16 +1711,6 @@ msgstr "Rédacteur"
msgid "SEDAWriter_plural"
msgstr "Rédacteurs"
msgid "SEDAfilename"
msgstr "nom du fichier"
msgctxt "inlined:SEDAAttachment.seda_filename.object"
msgid "SEDAfilename"
msgstr ""
msgid "SEDAfilename_plural"
msgstr ""
msgid "SEDArestrictionEndDate"
msgstr ""
......@@ -2600,12 +2579,6 @@ msgstr "Ce rédacteur"
msgid "This SEDAWriter:"
msgstr "Ce rédacteur :"
msgid "This SEDAfilename"
msgstr ""
msgid "This SEDAfilename:"
msgstr ""
msgid "This SEDArestrictionEndDate"
msgstr ""
......@@ -3403,10 +3376,6 @@ msgctxt "inlined:SEDAAltBinaryDataObjectAttachment.seda_uri.object"
msgid "add a SEDAUri"
msgstr ""
msgctxt "inlined:SEDAAttachment.seda_uri.object"
msgid "add a SEDAUri"
msgstr ""
msgid "add a SEDAVersion"
msgstr "ajouter une version"
......@@ -3423,13 +3392,6 @@ msgstr ""
msgid "add a SEDAWriter"
msgstr "ajouter un rédacteur"
msgid "add a SEDAfilename"
msgstr "ajouter un nom de fichier"
msgctxt "inlined:SEDAAttachment.seda_filename.object"
msgid "add a SEDAfilename"
msgstr ""
msgid "add a SEDArestrictionEndDate"
msgstr ""
......@@ -4039,10 +4001,6 @@ msgctxt "SEDAWriter"
msgid "container"
msgstr ""
msgctxt "SEDAfilename"
msgid "container"
msgstr ""
msgctxt "SEDArestrictionEndDate"
msgid "container"
msgstr ""
......@@ -4247,6 +4205,13 @@ msgctxt "SEDAFilePlanPosition"
msgid "file_plan_position"
msgstr ""
msgid "filename"
msgstr "nom du fichier"
msgctxt "SEDABinaryDataObject"
msgid "filename"
msgstr ""
#, python-brace-format
msgid "final action: {0}"
msgstr "action finale : {0}"
......@@ -4327,9 +4292,6 @@ msgctxt "SEDANeedReassessingAuthorization"
msgid "need_reassessing_authorization"
msgstr ""
msgid "optional"
msgstr "optionnel"
msgid "originating_agency_archive_unit_identifier"
msgstr "valeur"
......@@ -5648,20 +5610,6 @@ msgctxt "SEDAContent"
msgid "seda_file_plan_position_object"
msgstr ""
msgid "seda_filename"
msgstr ""
msgctxt "SEDAfilename"
msgid "seda_filename"
msgstr ""
msgid "seda_filename_object"
msgstr ""
msgctxt "SEDAAttachment"
msgid "seda_filename_object"
msgstr ""
msgid "seda_final_action"
msgstr "action à mettre en œuvre au terme de la durée de gestion"
......@@ -7201,10 +7149,6 @@ msgctxt "SEDAAltBinaryDataObjectAttachment"
msgid "seda_uri_object"
msgstr ""
msgctxt "SEDAAttachment"
msgid "seda_uri_object"
msgstr ""
msgid "seda_version"
msgstr ""
......@@ -7847,10 +7791,6 @@ msgctxt "SEDAType"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDAUri"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDAVersion"
msgid "user_cardinality"
msgstr ""
......@@ -7867,10 +7807,6 @@ msgctxt "SEDAWriter"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDAfilename"
msgid "user_cardinality"
msgstr ""
msgctxt "SEDArestrictionEndDate"
msgid "user_cardinality"
msgstr ""
......
......@@ -4,7 +4,6 @@
# XXX unsupported merge because of incompatible cardinality SEDAArchiveUnitRefId seda_archive_unit_ref_id_to SEDAArchiveUnit ? <SEDAArchiveUnitRefId seda_archive_unit_ref_id_to set(['SEDAArchiveUnit'])> ?*
# XXX unsupported merge because of incompatible cardinality SEDAArchiveUnitRefId seda_archive_unit_ref_id_to SEDAArchiveUnit ? <SEDAArchiveUnitRefId seda_archive_unit_ref_id_to set(['SEDAArchiveUnit'])> ?*
# XXX unsupported merge because of incompatible cardinality SEDADataObjectVersion seda_data_object_version_to Concept ? <SEDADataObjectVersion seda_data_object_version_to set(['Concept'])> ?*
# XXX extending cards for <SEDAUri> set(['0..1'])
# copyright 2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
......@@ -133,6 +132,7 @@ class archive_transfer_transferring_agency(RelationDefinition):
annotable=True)
class SEDABinaryDataObject(EntityType):
u""""""
filename = String()
id = String(required=True, description=_('Default identifier that will be used to handle references. This is not necessarily the identifier that will appear in the final sheet.'), constraints=[RQLConstraint('NOT EXISTS(S id I, X id I, S container C, X container C, NOT S identity X)', msg=_('identifier must be unique within a profile'))])
......@@ -2493,7 +2493,7 @@ class alt_binary_data_object_attachment_attachment(RelationDefinition):
inlined = True
constraints = []
@seda_profile_element(cardinalities=['0..1', '1'], default_cardinality='0..1',
@seda_profile_element(cardinalities=['1'], default_cardinality='1',
annotable=False)
class SEDAUri(EntityType):
u""""""
......@@ -2502,22 +2502,7 @@ class SEDAUri(EntityType):
class alt_binary_data_object_attachment_uri(RelationDefinition):
name = 'seda_uri'
subject = 'SEDAUri'
object = ('SEDAAltBinaryDataObjectAttachment', 'SEDAAttachment')
cardinality = '1?'
composite = fulltext_container = 'object'
inlined = True
constraints = []
@seda_profile_element(cardinalities=['0..1', '1'], default_cardinality='0..1',
annotable=False)
class SEDAfilename(EntityType):
u""""""
class attachment_filename(RelationDefinition):
name = 'seda_filename'
subject = 'SEDAfilename'
object = 'SEDAAttachment'
object = 'SEDAAltBinaryDataObjectAttachment'
cardinality = '1?'
composite = fulltext_container = 'object'
inlined = True
......
......@@ -154,19 +154,30 @@ class SEDAXSDExportTC(XmlTestMixin, CubicWebTC):
with self.admin_access.client_cnx() as cnx:
transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
bdo = cnx.create_entity('SEDABinaryDataObject', id=u"bdo1",
filename=u'fixed.txt',
seda_binary_data_object=transfer)
bdo_alt = cnx.create_entity('SEDAAltBinaryDataObjectAttachment',
reverse_seda_alt_binary_data_object_attachment=bdo)
attachement = cnx.create_entity('SEDAAttachment', seda_attachment=bdo_alt)
cnx.create_entity('SEDAfilename', seda_filename=attachement)
cnx.create_entity('SEDAAttachment', seda_attachment=bdo_alt)
profile = self.profile_etree(transfer)
fnames = self.xpath(profile,
'//xs:element[@name="FileInfo"]/xs:complexType/'
'xs:sequence/xs:element[@name="Filename"]')
self.assertEqual(len(fnames), 1)
self.assertEqual(fnames[0].attrib['fixed'], 'fixed.txt')
self.assertXSDExtensionType(fnames[0], 'xsd:string')
self.assertXSDAttributes(fnames[0], [])
self.assertXSDElements(fnames[0], [])
attachments = self.xpath(profile,
'//xs:element[@name="Attachment"]')
self.assertEqual(len(attachments), 1)
self.assertXSDExtensionType(attachments[0], 'xsd:base64Binary')
self.assertXSDAttributes(attachments[0],
[{'name': 'filename', 'use': 'optional',
'type': 'xsd:string'},
{'name': 'uri', 'use': 'optional',
'type': 'xsd:anyURI'}])
self.assertXSDElements(attachments[0], [])
def test_fileinfo_card(self):
with self.admin_access.client_cnx() as cnx:
......@@ -175,15 +186,23 @@ class SEDAXSDExportTC(XmlTestMixin, CubicWebTC):
seda_binary_data_object=transfer)
appname = cnx.create_entity('SEDACreatingApplicationName',
seda_creating_application_name=bdo)
profile = self.profile_etree(transfer)
fnames = self.xpath(profile, '//xs:element[@name="FileInfo"]')
self.assertEqual(len(fnames), 1)
self.assertEqual(fnames[0].attrib, {'name': 'FileInfo', 'minOccurs': '0'})
appname.cw_set(user_cardinality=u'1')
profile = self.profile_etree(transfer)
fnames = self.xpath(profile, '//xs:element[@name="FileInfo"]')
self.assertEqual(fnames[0].attrib, {'name': 'FileInfo'})
appname.cw_set(user_cardinality=u'0..1')
bdo.cw_set(filename=u'fixed.txt')
profile = self.profile_etree(transfer)
fnames = self.xpath(profile, '//xs:element[@name="FileInfo"]')
self.assertEqual(fnames[0].attrib, {'name': 'FileInfo'})
def test_transfer_annotation(self):
with self.admin_access.client_cnx() as cnx:
profile = self.profile_etree(cnx.create_entity('SEDAArchiveTransfer',
......
......@@ -65,7 +65,7 @@ class XSYMappingTC(unittest.TestCase):
mapping = xsy_mapping('BinaryDataObject')
self.assertIn('SEDABinaryDataObject', mapping.etypes)
emapping = mapping.etypes['SEDABinaryDataObject']
self.assertEMappingEqual(emapping, {'id': 'String'})
self.assertEMappingEqual(emapping, {'id': 'String', 'filename': 'String'})
emapping = mapping.etypes['SEDACompressed']
self.assertEMappingEqual(emapping, {'compressed': 'Boolean'})
......
......@@ -270,24 +270,6 @@ class ObjectReferencepArchiveUnitEntityView(view.EntityView):
self._cw.view('listitem', rset=archive_unit.as_rset(), w=self.w)
class AttachmentBusinessValueEntityView(viewlib.BusinessValueEntityView):
__select__ = is_instance('SEDAAttachment')
def entity_call(self, entity):
super(AttachmentBusinessValueEntityView, self).entity_call(entity)
attributes = []
for rtype in ('reverse_seda_uri', 'reverse_seda_filename'):
values = getattr(entity, rtype)
if values:
value = values[0]
display = value.dc_type()
if value.user_cardinality == '0..1':
display += ' <i>%s</i>' % self._cw._('optional')
attributes.append(display)
if attributes:
self.w(self._cw._(' (attributes: %s)') % ', '.join(attributes))
class UnitBusinessValueEntityView(viewlib.BusinessValueEntityView):
__select__ = is_instance('SEDAWidth', 'SEDAHeight', 'SEDADepth', 'SEDAShape',
'SEDADiameter', 'SEDALength', 'SEDAThickness', 'SEDAWeight')
......
......@@ -106,7 +106,6 @@ ives['SEDALength'] = 'subobject'
ives['SEDAComment'] = 'subobject'
ives['SEDADescriptionLanguage'] = 'subobject'
ives['SEDAAccessRule'] = 'subobject'
ives['SEDAfilename'] = 'subobject'
ives['SEDACompressionAlgorithmCodeListVersion'] = 'subobject'
ives['SEDATemporal'] = 'subobject'
ives['SEDAPhysicalDataObject'] = 'subobject'
......@@ -479,8 +478,6 @@ abaa.tag_subject_of(('*', 'seda_attachment', '*'), False)
abaa.tag_object_of(('*', 'seda_attachment', '*'), False)
abaa.tag_subject_of(('*', 'seda_uri', '*'), False)
abaa.tag_object_of(('*', 'seda_uri', '*'), False)
abaa.tag_subject_of(('*', 'seda_filename', '*'), False)
abaa.tag_object_of(('*', 'seda_filename', '*'), False)
abaa.tag_object_of(('*', 'seda_reply_code_list_version', '*'), False)
abaa.tag_subject_of(('*', 'seda_reply_code_list_version', '*'), False)
abaa.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), False)
......@@ -536,6 +533,7 @@ abaa.tag_subject_of(('*', 'seda_relationship_code_list_version_to', '*'), False)
affk = uicfg.autoform_field_kwargs
affk.tag_subject_of(('*', 'comment', '*'), {'widget': fw.TextInput({'size': 80})})
affk.tag_subject_of(('*', 'archival_agreement', '*'), {'widget': fw.TextInput({'size': 80})})
affk.tag_subject_of(('*', 'filename', '*'), {'widget': fw.TextInput({'size': 80})})
affk.tag_subject_of(('*', 'id', '*'), {'widget': fw.TextInput({'size': 80})})
affk.tag_subject_of(('*', 'service_level', '*'), {'widget': fw.TextInput({'size': 80})})
affk.tag_subject_of(('*', 'classification_owner', '*'), {'widget': fw.TextInput({'size': 80})})
......@@ -895,8 +893,6 @@ afs.tag_subject_of(('*', 'seda_attachment', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_attachment', '*'), 'main', 'inlined')
afs.tag_subject_of(('*', 'seda_uri', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_uri', '*'), 'main', 'inlined')
afs.tag_subject_of(('*', 'seda_filename', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_filename', '*'), 'main', 'inlined')
afs.tag_object_of(('*', 'seda_reply_code_list_version', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_reply_code_list_version', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), 'main', 'hidden')
......@@ -1095,6 +1091,7 @@ rec.tag_object_of(('*', 'seda_archival_agreement', '*'), {'novalue_label': _('<u
rec.tag_object_of(('*', 'seda_transfer_request_reply_identifier', '*'), {'novalue_label': _('<unauthorized>')})
rec.tag_subject_of(('*', 'seda_archival_agency', '*'), {'novalue_label': _('<no value specified>')})
rec.tag_subject_of(('*', 'seda_transferring_agency', '*'), {'novalue_label': _('<no value specified>')})
rec.tag_subject_of(('*', 'filename', '*'), {'novalue_label': _('<no value specified>')})
rec.tag_subject_of(('*', 'id', '*'), {'novalue_label': _('<no value specified>')})
rec.tag_subject_of(('*', 'service_level', '*'), {'novalue_label': _('<no value specified>')})
rec.tag_object_of(('*', 'seda_service_level', '*'), {'novalue_label': _('<unauthorized>')})
......@@ -1248,7 +1245,6 @@ rec.tag_subject_of(('*', 'seda_encoding_to', '*'), {'novalue_label': _('<no valu
rec.tag_subject_of(('*', 'seda_algorithm', '*'), {'novalue_label': _('<no value specified>')})
rec.tag_object_of(('*', 'seda_attachment', '*'), {'novalue_label': _('<unauthorized>')})
rec.tag_object_of(('*', 'seda_uri', '*'), {'novalue_label': _('<unauthorized>')})
rec.tag_object_of(('*', 'seda_filename', '*'), {'novalue_label': _('<unauthorized>')})
rec.tag_subject_of(('*', 'seda_reply_code_list_version', '*'), {'novalue_label': _('<no value specified>')})
rec.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), {'novalue_label': _('<no value specified>')})
rec.tag_object_of(('*', 'seda_mime_type_code_list_version_from', '*'), {'novalue_label': _('<unauthorized>')})
......@@ -1281,8 +1277,8 @@ affk.set_fields_order('SEDAComment', ['user_cardinality', 'comment'])
pvds.set_fields_order('SEDAComment', ['user_cardinality', 'comment'])
affk.set_fields_order('SEDAArchivalAgreement', ['user_cardinality', 'archival_agreement'])
pvds.set_fields_order('SEDAArchivalAgreement', ['user_cardinality', 'archival_agreement'])
affk.set_fields_order('SEDABinaryDataObject', ['id', 'user_cardinality', 'user_annotation'])
pvds.set_fields_order('SEDABinaryDataObject', ['id', 'user_cardinality', 'user_annotation'])
affk.set_fields_order('SEDABinaryDataObject', ['id', 'filename', 'user_cardinality', 'user_annotation'])
pvds.set_fields_order('SEDABinaryDataObject', ['id', 'filename', 'user_cardinality', 'user_annotation'])
affk.set_fields_order('SEDAPhysicalDataObject', ['id', 'user_cardinality', 'user_annotation'])
pvds.set_fields_order('SEDAPhysicalDataObject', ['id', 'user_cardinality', 'user_annotation'])
affk.set_fields_order('SEDAServiceLevel', ['user_cardinality', 'service_level'])
......
......@@ -369,7 +369,7 @@ class XSDMMapping(object):
"""
subelement_defs = self[self.element_by_name(xsd_element)][1]
for occ, path in subelement_defs:
if occ.target.local_name in ('id', 'Filename'):
if occ.target.local_name == 'id':
continue
rtype, role, _, _ = path[0]
yield rtype, role, path
......
......@@ -28,7 +28,7 @@ from xsd import XSDMMapping, un_camel_case
EXT_ETYPES = set(['Agent', 'ConceptScheme', 'Concept'])
# elements in the intermediary model but not in the yams model
SKIP_ETYPES = set(['SEDAid', 'SEDAhref'])
SKIP_ETYPES = set(['SEDAid', 'SEDAhref', 'SEDAfilename'])
SKIP_ATTRS = set([
'acquired_date',
'classification_reassessing_date',
......@@ -42,7 +42,6 @@ SKIP_ATTRS = set([
'event_date_time',
'event_detail',
'event_identifier',
'filename',
'gps_altitude',
'gps_altitude_ref',
'gps_date_stamp',
......@@ -274,6 +273,10 @@ class XSYMapping(object):
if rtype not in SKIP_ATTRS:
current_emapping.attributes[rtype] = target_etype
continue
# we want seda_uri for SEDAAltBinaryDataObjectAttachment but not for Attachment
# (it should be systematically added in XSD for the later)
if rtype == 'seda_uri' and emapping.etype == 'SEDAAttachment':