Class: Cocina::Models::Mapping::ToMods::ModsWriter
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::ToMods::ModsWriter
- Defined in:
- lib/cocina/models/mapping/to_mods/mods_writer.rb
Overview
Maps description resource from cocina to MODS XML
Class Method Summary collapse
Class Method Details
.write(xml:, description:, druid:, id_generator: IdGenerator.new, identification: nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cocina/models/mapping/to_mods/mods_writer.rb', line 13 def self.write(xml:, description:, druid:, id_generator: IdGenerator.new, identification: nil) # ID Generator makes sure that different writers create unique altRepGroups and nameTitleGroups. if description.title catalog_links = identification&.catalogLinks.present? ? identification.catalogLinks.select { |link| link.catalog == 'folio' } : [] Title.write(xml: xml, titles: description.title, contributors: description.contributor, id_generator: id_generator, catalog_links: catalog_links) end Contributor.write(xml: xml, contributors: description.contributor, titles: description.title, id_generator: id_generator) Form.write(xml: xml, forms: description.form, id_generator: id_generator) Language.write(xml: xml, languages: description.language) Note.write(xml: xml, notes: description.note, id_generator: id_generator) Subject.write(xml: xml, subjects: description.subject, forms: description.form, id_generator: id_generator) Event.write(xml: xml, events: description.event, id_generator: id_generator) Identifier.write(xml: xml, identifiers: description.identifier, id_generator: id_generator) Access.write(xml: xml, access: description.access, purl: description.respond_to?(:purl) ? description.purl : nil) AdminMetadata.write(xml: xml, admin_metadata: description.adminMetadata) .write(xml: xml, related_resources: description., druid: druid, id_generator: id_generator) Geographic.write(xml: xml, geos: description.geographic, druid: druid) if description.respond_to?(:geographic) end |