Module: Archimate::FileFormats::Serializer::ModelExchangeFile::V21::Model

Included in:
ModelExchangeFileWriter21
Defined in:
lib/archimate/file_formats/serializer/model_exchange_file/v21/model.rb

Instance Method Summary collapse

Instance Method Details

#model_attrsObject



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/archimate/file_formats/serializer/model_exchange_file/v21/model.rb', line 25

def model_attrs
  model.namespaces.merge(
    "xmlns" => "http://www.opengroup.org/xsd/archimate",
    "xmlns:dc" => "http://purl.org/dc/elements/1.1/",
    "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
    "xsi:schemaLocation" => %w[http://www.opengroup.org/xsd/archimate
                               http://www.opengroup.org/xsd/archimate/archimate_v2p1.xsd
                               http://purl.org/dc/elements/1.1/
                               http://dublincore.org/schemas/xmls/qdc/2008/02/11/dc.xsd].join(" "),
    # "xsi:schemaLocation" => model.schema_locations.join(" "),
    "identifier" => identifier(model.id)
  )
end

#serialize_model(xml, model) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/archimate/file_formats/serializer/model_exchange_file/v21/model.rb', line 9

def serialize_model(xml, model)
  xml.model(model_attrs) do
    Serializer::XmlMetadata.new(model.).serialize(xml)
    Serializer::XmlLangString.new(model.name, :name).serialize(xml)
    Serializer::XmlLangString.new(model.documentation, :documentation).serialize(xml)
    serialize_properties(xml, model)
    Serializer::NamedCollection.new("elements", model.elements).serialize(xml) { |xml_e, elements| serialize(xml_e, elements) }
    Serializer::NamedCollection.new("relationships", model.relationships).serialize(xml) { |xml_r, relationships| serialize(xml_r, relationships) }
    NamedCollection.new("organization", model.organizations).serialize(xml) { |xml_o, orgs| serialize(xml_o, orgs) }
    Serializer::XmlPropertyDefs.new(model.property_definitions).serialize(xml)
    NamedCollection.new("views", model.diagrams).serialize(xml) do |xml_v, diagrams|
      serialize(xml_v, diagrams)
    end
  end
end