Class: Archimate::FileFormats::Sax::ModelExchangeFile::Diagram
Constant Summary
collapse
- VIEWPOINT_MAP =
{
"Business Process Co-operation" => DataModel::Viewpoints::Business_process_cooperation,
"Application Co-operation" => DataModel::Viewpoints::Application_cooperation
}.freeze
Instance Attribute Summary
Attributes inherited from Handler
#attrs, #element_type, #name, #parent_handler
Instance Method Summary
collapse
#on_property, #properties
#documentation, #on_preserved_lang_string
Methods inherited from Handler
#characters, #event, #method_missing, #process_text, #property_definitions, #respond_to_missing?
Constructor Details
#initialize(name, attrs, parent_handler) ⇒ Diagram
Returns a new instance of Diagram.
11
12
13
14
15
16
17
|
# File 'lib/archimate/file_formats/sax/model_exchange_file/diagram.rb', line 11
def initialize(name, attrs, parent_handler)
super
@view_nodes = []
@connections = []
@diagram_name = nil
@diagram = nil
end
|
Instance Method Details
#complete ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/archimate/file_formats/sax/model_exchange_file/diagram.rb', line 19
def complete
diagram.name = @diagram_name
diagram.documentation = documentation
diagram.properties = properties
diagram.nodes = @view_nodes
diagram.connections = @connections
[
event(:on_diagram, diagram),
event(:on_referenceable, diagram)
]
end
|
#diagram ⇒ Object
31
32
33
34
35
36
37
38
39
|
# File 'lib/archimate/file_formats/sax/model_exchange_file/diagram.rb', line 31
def diagram
@diagram ||= DataModel::Diagram.new(
id: @attrs["identifier"],
viewpoint: viewpoint,
connection_router_type: @attrs["connectionRouterType"],
type: @attrs["xsi:type"],
background: @attrs["background"]
)
end
|
#on_connection(connection, _source) ⇒ Object
51
52
53
54
|
# File 'lib/archimate/file_formats/sax/model_exchange_file/diagram.rb', line 51
def on_connection(connection, _source)
@connections << connection
false
end
|
#on_lang_string(name, _source) ⇒ Object
41
42
43
44
|
# File 'lib/archimate/file_formats/sax/model_exchange_file/diagram.rb', line 41
def on_lang_string(name, _source)
@diagram_name = name
false
end
|
#on_view_node(view_node, source) ⇒ Object
46
47
48
49
|
# File 'lib/archimate/file_formats/sax/model_exchange_file/diagram.rb', line 46
def on_view_node(view_node, source)
@view_nodes << view_node if source.parent_handler == self
false
end
|
#viewpoint ⇒ Object
61
62
63
64
65
66
|
# File 'lib/archimate/file_formats/sax/model_exchange_file/diagram.rb', line 61
def viewpoint
viewpoint_attr = @attrs["viewpoint"]&.strip || ""
return nil if viewpoint_attr.empty?
return VIEWPOINT_MAP[viewpoint_attr] if VIEWPOINT_MAP.include?(viewpoint_attr)
DataModel::Viewpoints.with_name(viewpoint_attr)
end
|