archimate 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +47 -0
- data/TODOs.org +219 -0
- data/archimate.gemspec +2 -1
- data/exe/archidiff +7 -0
- data/exe/archidiff-summary +7 -0
- data/exe/archimerge +7 -0
- data/exe/fmtxml +7 -0
- data/lib/archimate.rb +10 -21
- data/lib/archimate/cli/archi.rb +2 -1
- data/lib/archimate/cli/cleanup.rb +8 -9
- data/lib/archimate/cli/convert.rb +3 -1
- data/lib/archimate/cli/mapper.rb +1 -1
- data/lib/archimate/cli/stats.rb +1 -1
- data/lib/archimate/config.rb +4 -1
- data/lib/archimate/data_model.rb +11 -24
- data/lib/archimate/data_model/any_attribute.rb +18 -5
- data/lib/archimate/data_model/any_element.rb +30 -7
- data/lib/archimate/data_model/bounds.rb +34 -7
- data/lib/archimate/data_model/color.rb +32 -7
- data/lib/archimate/data_model/comparison.rb +87 -0
- data/lib/archimate/data_model/concern.rb +20 -7
- data/lib/archimate/data_model/connection.rb +71 -51
- data/lib/archimate/data_model/connector_type.rb +23 -0
- data/lib/archimate/data_model/diagram.rb +72 -10
- data/lib/archimate/data_model/diagram_type.rb +17 -0
- data/lib/archimate/data_model/differentiable.rb +142 -0
- data/lib/archimate/data_model/element.rb +39 -45
- data/lib/archimate/data_model/element_type.rb +89 -0
- data/lib/archimate/data_model/font.rb +30 -12
- data/lib/archimate/data_model/lang_string.rb +89 -16
- data/lib/archimate/data_model/layer.rb +55 -0
- data/lib/archimate/data_model/layers.rb +62 -0
- data/lib/archimate/data_model/location.rb +27 -11
- data/lib/archimate/data_model/metadata.rb +10 -3
- data/lib/archimate/data_model/model.rb +188 -121
- data/lib/archimate/data_model/modeling_note.rb +14 -3
- data/lib/archimate/data_model/organization.rb +44 -13
- data/lib/archimate/data_model/{documentation.rb → preserved_lang_string.rb} +1 -5
- data/lib/archimate/data_model/property.rb +17 -11
- data/lib/archimate/data_model/property_definition.rb +34 -4
- data/lib/archimate/data_model/referenceable.rb +0 -9
- data/lib/archimate/data_model/referenceable_collection.rb +201 -0
- data/lib/archimate/data_model/relationship.rb +52 -33
- data/lib/archimate/data_model/relationship_type.rb +43 -0
- data/lib/archimate/data_model/schema_info.rb +17 -6
- data/lib/archimate/data_model/style.rb +41 -11
- data/lib/archimate/data_model/view_node.rb +153 -59
- data/lib/archimate/data_model/viewpoint.rb +56 -80
- data/lib/archimate/data_model/viewpoint_type.rb +429 -0
- data/lib/archimate/export/csv_export.rb +2 -2
- data/lib/archimate/export/cypher.rb +2 -2
- data/lib/archimate/export/graph_ml.rb +7 -5
- data/lib/archimate/export/jsonl.rb +166 -0
- data/lib/archimate/export/n_quads.rb +8 -5
- data/lib/archimate/file_format.rb +4 -5
- data/lib/archimate/file_formats/archi_file_reader.rb +7 -240
- data/lib/archimate/file_formats/archi_file_writer.rb +16 -188
- data/lib/archimate/file_formats/model_exchange_file_reader.rb +7 -225
- data/lib/archimate/file_formats/model_exchange_file_writer_21.rb +22 -114
- data/lib/archimate/file_formats/model_exchange_file_writer_30.rb +22 -122
- data/lib/archimate/file_formats/sax.rb +55 -0
- data/lib/archimate/file_formats/sax/any_element.rb +64 -0
- data/lib/archimate/file_formats/sax/archi/archi_handler_factory.rb +48 -0
- data/lib/archimate/file_formats/sax/archi/bounds.rb +25 -0
- data/lib/archimate/file_formats/sax/archi/connection.rb +47 -0
- data/lib/archimate/file_formats/sax/archi/content.rb +28 -0
- data/lib/archimate/file_formats/sax/archi/diagram.rb +66 -0
- data/lib/archimate/file_formats/sax/archi/element.rb +36 -0
- data/lib/archimate/file_formats/sax/archi/location.rb +25 -0
- data/lib/archimate/file_formats/sax/archi/model.rb +109 -0
- data/lib/archimate/file_formats/sax/archi/organization.rb +60 -0
- data/lib/archimate/file_formats/sax/archi/property.rb +54 -0
- data/lib/archimate/file_formats/sax/archi/relationship.rb +50 -0
- data/lib/archimate/file_formats/sax/archi/style.rb +35 -0
- data/lib/archimate/file_formats/sax/archi/view_node.rb +76 -0
- data/lib/archimate/file_formats/sax/capture_content.rb +20 -0
- data/lib/archimate/file_formats/sax/capture_documentation.rb +19 -0
- data/lib/archimate/file_formats/sax/capture_properties.rb +20 -0
- data/lib/archimate/file_formats/sax/content_element.rb +19 -0
- data/lib/archimate/file_formats/sax/document.rb +80 -0
- data/lib/archimate/file_formats/sax/handler.rb +54 -0
- data/lib/archimate/file_formats/sax/lang_string.rb +28 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/color.rb +36 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/connection.rb +67 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/diagram.rb +60 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/element.rb +43 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/font.rb +44 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/item.rb +64 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/location.rb +23 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/metadata.rb +66 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/model.rb +124 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/model_exchange_handler_factory.rb +53 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/property.rb +32 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/property_definition.rb +36 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/relationship.rb +49 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/schema_info.rb +47 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/style.rb +66 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/view_node.rb +86 -0
- data/lib/archimate/file_formats/sax/no_op.rb +17 -0
- data/lib/archimate/file_formats/sax/preserved_lang_string.rb +28 -0
- data/lib/archimate/file_formats/serializer.rb +57 -0
- data/lib/archimate/file_formats/serializer/archi/bounds.rb +23 -0
- data/lib/archimate/file_formats/serializer/archi/connection.rb +33 -0
- data/lib/archimate/file_formats/serializer/archi/diagram.rb +28 -0
- data/lib/archimate/file_formats/serializer/archi/documentation.rb +16 -0
- data/lib/archimate/file_formats/serializer/archi/element.rb +24 -0
- data/lib/archimate/file_formats/serializer/archi/location.rb +26 -0
- data/lib/archimate/file_formats/serializer/archi/model.rb +25 -0
- data/lib/archimate/file_formats/serializer/archi/organization.rb +21 -0
- data/lib/archimate/file_formats/serializer/archi/property.rb +15 -0
- data/lib/archimate/file_formats/serializer/archi/relationship.rb +36 -0
- data/lib/archimate/file_formats/serializer/archi/view_node.rb +52 -0
- data/lib/archimate/file_formats/serializer/archi/viewpoint_type.rb +45 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/element.rb +25 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/location.rb +15 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/model_exchange_file_writer.rb +32 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/organization.rb +23 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/properties.rb +15 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/relationship.rb +19 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/style.rb +48 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/connection.rb +25 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/diagram.rb +27 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/item.rb +17 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/label.rb +17 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/model.rb +36 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/organization_body.rb +25 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/property.rb +19 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/view_node.rb +44 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/connection.rb +26 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/diagram.rb +27 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/item.rb +17 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/label.rb +17 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/model.rb +41 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/organization_body.rb +25 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/property.rb +19 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/property_definitions.rb +34 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/view_node.rb +45 -0
- data/lib/archimate/file_formats/serializer/named_collection.rb +21 -0
- data/lib/archimate/file_formats/serializer/writer.rb +56 -0
- data/lib/archimate/file_formats/serializer/xml_lang_string.rb +30 -0
- data/lib/archimate/file_formats/serializer/xml_metadata.rb +64 -0
- data/lib/archimate/file_formats/{model_exchange_file → serializer}/xml_property_defs.rb +2 -2
- data/lib/archimate/lint/duplicate_entities.rb +3 -3
- data/lib/archimate/lint/linter.rb +24 -29
- data/lib/archimate/svg/connection.rb +13 -103
- data/lib/archimate/svg/diagram.rb +1 -1
- data/lib/archimate/svg/entity/base_entity.rb +12 -8
- data/lib/archimate/svg/entity/data_entity.rb +2 -2
- data/lib/archimate/svg/entity/diagram_model_reference.rb +1 -1
- data/lib/archimate/svg/entity/event_entity.rb +2 -2
- data/lib/archimate/svg/entity/gap.rb +1 -1
- data/lib/archimate/svg/entity/group.rb +1 -1
- data/lib/archimate/svg/entity/motivation_entity.rb +1 -1
- data/lib/archimate/svg/entity/node.rb +1 -1
- data/lib/archimate/svg/entity/rect_entity.rb +1 -1
- data/lib/archimate/svg/entity/rounded_rect_entity.rb +1 -1
- data/lib/archimate/svg/entity/service_entity.rb +2 -2
- data/lib/archimate/svg/entity/value.rb +2 -2
- data/lib/archimate/svg/path.rb +153 -0
- data/lib/archimate/svg/point.rb +8 -1
- data/lib/archimate/version.rb +1 -1
- metadata +118 -36
- data/lib/archimate/data_model/archimate_node.rb +0 -181
- data/lib/archimate/data_model/concept.rb +0 -14
- data/lib/archimate/data_model/constants.rb +0 -82
- data/lib/archimate/data_model/container.rb +0 -17
- data/lib/archimate/data_model/diffable_array.rb +0 -213
- data/lib/archimate/data_model/diffable_primitive.rb +0 -83
- data/lib/archimate/data_model/label.rb +0 -19
- data/lib/archimate/data_model/named_referenceable.rb +0 -14
- data/lib/archimate/data_model/view.rb +0 -12
- data/lib/archimate/data_model/view_concept.rb +0 -18
- data/lib/archimate/file_formats/archi_file_format.rb +0 -151
- data/lib/archimate/file_formats/archimate_v2.rb +0 -461
- data/lib/archimate/file_formats/model_exchange_file/xml_lang_string.rb +0 -35
- data/lib/archimate/file_formats/model_exchange_file/xml_metadata.rb +0 -115
- data/lib/archimate/file_formats/model_exchange_file/xml_property_definitions.rb +0 -28
- data/lib/archimate/file_formats/model_exchange_file_reader_21.rb +0 -73
- data/lib/archimate/file_formats/model_exchange_file_reader_30.rb +0 -134
- data/lib/archimate/file_formats/model_exchange_file_writer.rb +0 -157
- data/lib/archimate/file_formats/writer.rb +0 -56
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module Properties
|
8
|
+
def serialize_properties(xml, element)
|
9
|
+
NamedCollection.new("properties", element.properties).serialize(xml) { |xml_p, props| serialize(xml_p, props) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module Relationship
|
8
|
+
def serialize_relationship(xml, relationship)
|
9
|
+
xml.relationship(
|
10
|
+
relationship_attributes(relationship)
|
11
|
+
) do
|
12
|
+
elementbase(xml, relationship)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module Style
|
8
|
+
def serialize_style(xml, style)
|
9
|
+
return unless style
|
10
|
+
xml.style(
|
11
|
+
remove_nil_values(
|
12
|
+
lineWidth: style.line_width
|
13
|
+
)
|
14
|
+
) do
|
15
|
+
serialize_color(xml, style.fill_color, :fillColor)
|
16
|
+
serialize_color(xml, style.line_color, :lineColor)
|
17
|
+
serialize_font(xml, style)
|
18
|
+
# TODO: complete this
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def serialize_font(xml, style)
|
23
|
+
return unless style && (style.font || style.font_color)
|
24
|
+
xml.font(
|
25
|
+
remove_nil_values(
|
26
|
+
name: style.font&.name,
|
27
|
+
size: style.font&.size&.round,
|
28
|
+
style: font_style_string(style.font)
|
29
|
+
)
|
30
|
+
) { serialize_color(xml, style&.font_color, :color) }
|
31
|
+
end
|
32
|
+
|
33
|
+
def serialize_color(xml, color, sym)
|
34
|
+
return if color.nil?
|
35
|
+
h = {
|
36
|
+
r: color.r,
|
37
|
+
g: color.g,
|
38
|
+
b: color.b,
|
39
|
+
a: color.a
|
40
|
+
}
|
41
|
+
h.delete(:a) if color.a.nil? || color.a == 100
|
42
|
+
xml.send(sym, h)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V21
|
8
|
+
module Connection
|
9
|
+
def serialize_connection(xml, sc)
|
10
|
+
xml.connection(
|
11
|
+
identifier: identifier(sc.id),
|
12
|
+
relationshipref: identifier(sc.relationship&.id),
|
13
|
+
source: identifier(sc.source&.id),
|
14
|
+
target: identifier(sc.target&.id)
|
15
|
+
) do
|
16
|
+
serialize(xml, sc.bendpoints)
|
17
|
+
serialize(xml, sc.style)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V21
|
8
|
+
module Diagram
|
9
|
+
def serialize_diagram(xml, diagram)
|
10
|
+
xml.view(
|
11
|
+
remove_nil_values(
|
12
|
+
identifier: identifier(diagram.id),
|
13
|
+
viewpoint: diagram.viewpoint_type,
|
14
|
+
"xsi:type": diagram.type
|
15
|
+
)
|
16
|
+
) do
|
17
|
+
elementbase(xml, diagram)
|
18
|
+
serialize(xml, diagram.nodes)
|
19
|
+
serialize(xml, diagram.connections)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V21
|
8
|
+
module Item
|
9
|
+
def serialize_item(xml, item)
|
10
|
+
xml.item(identifierref: identifier(item.id))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V21
|
8
|
+
module Label
|
9
|
+
def serialize_label(xml, str)
|
10
|
+
XmlLangString.new(str, :label).serialize(xml)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V21
|
8
|
+
module Model
|
9
|
+
def serialize_model(xml, model)
|
10
|
+
xml.model(model_attrs) do
|
11
|
+
Serializer::XmlMetadata.new(model.metadata).serialize(xml)
|
12
|
+
Serializer::XmlLangString.new(model.name, :name).serialize(xml)
|
13
|
+
Serializer::XmlLangString.new(model.documentation, :documentation).serialize(xml)
|
14
|
+
serialize_properties(xml, model)
|
15
|
+
Serializer::NamedCollection.new("elements", model.elements).serialize(xml) { |xml_e, elements| serialize(xml_e, elements) }
|
16
|
+
Serializer::NamedCollection.new("relationships", model.relationships).serialize(xml) { |xml_r, relationships| serialize(xml_r, relationships) }
|
17
|
+
NamedCollection.new("organization", model.organizations).serialize(xml) { |xml_o, orgs| serialize(xml_o, orgs) }
|
18
|
+
Serializer::XmlPropertyDefs.new(model.property_definitions).serialize(xml)
|
19
|
+
NamedCollection.new("views", model.diagrams).serialize(xml) do |xml_v, diagrams|
|
20
|
+
serialize(xml_v, diagrams)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def model_attrs
|
26
|
+
model.namespaces.merge(
|
27
|
+
"xsi:schemaLocation" => model.schema_locations.join(" "),
|
28
|
+
"identifier" => identifier(model.id)
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V21
|
8
|
+
module OrganizationBody
|
9
|
+
def serialize_organization_body(xml, organization)
|
10
|
+
if organization.items.empty? &&
|
11
|
+
(!organization.documentation || organization.documentation.empty?) &&
|
12
|
+
organization.organizations.empty?
|
13
|
+
return
|
14
|
+
end
|
15
|
+
serialize_label(xml, organization.name)
|
16
|
+
serialize(xml, organization.documentation)
|
17
|
+
serialize(xml, organization.organizations)
|
18
|
+
organization.items.each { |i| serialize_item(xml, i) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V21
|
8
|
+
module Property
|
9
|
+
def serialize_property(xml, property)
|
10
|
+
xml.property(identifierref: property.property_definition.id) do
|
11
|
+
Serializer::XmlLangString.new(property.value, :value).serialize(xml)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V21
|
8
|
+
module ViewNode
|
9
|
+
def serialize_view_node(xml, view_node, x_offset = 0, y_offset = 0)
|
10
|
+
attrs = view_node_attrs(view_node, x_offset, y_offset)
|
11
|
+
xml.node(attrs) do
|
12
|
+
serialize_label(xml, view_node.name) if attrs[:type] == "group"
|
13
|
+
serialize(xml, view_node.style) if view_node.style
|
14
|
+
view_node.nodes.each do |c|
|
15
|
+
serialize_view_node(xml, c) # , attrs[:x].to_f, attrs[:y].to_f)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def view_node_attrs(view_node, x_offset = 0, y_offset = 0)
|
21
|
+
attrs = {
|
22
|
+
identifier: identifier(view_node.id),
|
23
|
+
elementref: nil,
|
24
|
+
x: view_node.bounds ? (view_node.bounds&.x + x_offset).round : nil,
|
25
|
+
y: view_node.bounds ? (view_node.bounds&.y + y_offset).round : nil,
|
26
|
+
w: view_node.bounds&.width&.round,
|
27
|
+
h: view_node.bounds&.height&.round,
|
28
|
+
type: view_node.child_type
|
29
|
+
}
|
30
|
+
if view_node.element
|
31
|
+
attrs[:elementref] = identifier(view_node.element.id)
|
32
|
+
elsif view_node.view_refs
|
33
|
+
# Since it doesn't seem to be forbidden, we just assume we can use
|
34
|
+
# the elementref for views in views
|
35
|
+
attrs[:elementref] = view_node.view_refs
|
36
|
+
end
|
37
|
+
remove_nil_values(attrs)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V30
|
8
|
+
module Connection
|
9
|
+
def serialize_connection(xml, sc)
|
10
|
+
xml.connection(
|
11
|
+
identifier: identifier(sc.id),
|
12
|
+
relationshipRef: identifier(sc.relationship&.id),
|
13
|
+
"xsi:type": sc.type,
|
14
|
+
source: identifier(sc.source&.id),
|
15
|
+
target: identifier(sc.target&.id)
|
16
|
+
) do
|
17
|
+
serialize(xml, sc.style)
|
18
|
+
serialize(xml, sc.bendpoints)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V30
|
8
|
+
module Diagram
|
9
|
+
def serialize_diagram(xml, diagram)
|
10
|
+
xml.view(
|
11
|
+
remove_nil_values(
|
12
|
+
identifier: identifier(diagram.id),
|
13
|
+
"xsi:type": diagram.type,
|
14
|
+
viewpoint: diagram.viewpoint_type
|
15
|
+
)
|
16
|
+
) do
|
17
|
+
elementbase(xml, diagram)
|
18
|
+
serialize(xml, diagram.nodes)
|
19
|
+
serialize(xml, diagram.connections)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V30
|
8
|
+
module Item
|
9
|
+
def serialize_item(xml, item)
|
10
|
+
xml.item(identifierRef: identifier(item.id))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V30
|
8
|
+
module Label
|
9
|
+
def serialize_label(xml, str, tag = :name)
|
10
|
+
XmlLangString.new(str, tag).serialize(xml)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module FileFormats
|
5
|
+
module Serializer
|
6
|
+
module ModelExchangeFile
|
7
|
+
module V30
|
8
|
+
module Model
|
9
|
+
def serialize_model(xml, model)
|
10
|
+
xml.model(model_attrs(model)) do
|
11
|
+
XmlLangString.new(model.name, :name).serialize(xml)
|
12
|
+
XmlLangString.new(model.documentation, :documentation).serialize(xml)
|
13
|
+
XmlMetadata.new(model.metadata).serialize(xml)
|
14
|
+
NamedCollection.new("properties", model.properties).serialize(xml) { |xml_p, props| serialize(xml_p, props) }
|
15
|
+
NamedCollection.new("elements", model.elements).serialize(xml) { |xml_e, elements| serialize(xml_e, elements) }
|
16
|
+
NamedCollection.new("relationships", model.relationships).serialize(xml) { |xml_r, relationships| serialize(xml_r, relationships) }
|
17
|
+
NamedCollection.new("organizations", model.organizations).serialize(xml) { |xml_o, orgs| serialize(xml_o, orgs) }
|
18
|
+
PropertyDefinitions.new(model.property_definitions).serialize(xml)
|
19
|
+
NamedCollection.new("views", model.diagrams).serialize(xml) do |xml_v, _orgs|
|
20
|
+
NamedCollection.new("diagrams", model.diagrams).serialize(xml_v) do |xml_d, diagrams|
|
21
|
+
serialize(xml_d, diagrams)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def model_attrs(model)
|
28
|
+
remove_nil_values(
|
29
|
+
model.namespaces.merge(
|
30
|
+
"xsi:schemaLocation" => model.schema_locations.join(" "),
|
31
|
+
"identifier" => identifier(model.id),
|
32
|
+
"version" => model.version
|
33
|
+
)
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|