Module: Archimate::FileFormats::Serializer::ModelExchangeFile::V30::Model

Included in:
ModelExchangeFileWriter30
Defined in:
lib/archimate/file_formats/serializer/model_exchange_file/v30/model.rb

Instance Method Summary collapse

Instance Method Details

#model_attrs(model) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/archimate/file_formats/serializer/model_exchange_file/v30/model.rb', line 27

def model_attrs(model)
  model.namespaces.merge(
    "xsi:schemaLocation" => model.schema_locations.join(" "),
    "identifier" => identifier(model.id),
    "version" => model.version
  ).compact
end

#serialize_model(xml, model) ⇒ Object



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

def serialize_model(xml, model)
  xml.model(model_attrs(model)) do
    XmlLangString.new(model.name, :name).serialize(xml)
    XmlLangString.new(model.documentation, :documentation).serialize(xml)
    XmlMetadata.new(model.).serialize(xml)
    NamedCollection.new("properties", model.properties).serialize(xml) { |xml_p, props|  serialize(xml_p, props) }
    NamedCollection.new("elements", model.elements).serialize(xml) { |xml_e, elements|  serialize(xml_e, elements) }
    NamedCollection.new("relationships", model.relationships).serialize(xml) { |xml_r, relationships|  serialize(xml_r, relationships) }
    NamedCollection.new("organizations", model.organizations).serialize(xml) { |xml_o, orgs|  serialize(xml_o, orgs) }
    PropertyDefinitions.new(model.property_definitions).serialize(xml)
    NamedCollection.new("views", model.diagrams).serialize(xml) do |xml_v, _orgs|
      NamedCollection.new("diagrams", model.diagrams).serialize(xml_v) do |xml_d, diagrams|
        serialize(xml_d, diagrams)
      end
    end
  end
end