Class: Archimate::FileFormats::ModelExchangeFileReader30

Inherits:
ModelExchangeFileReader show all
Defined in:
lib/archimate/file_formats/model_exchange_file_reader_30.rb

Instance Method Summary collapse

Methods inherited from ModelExchangeFileReader

#identifier_to_id, #parse, #parse_bendpoints, #parse_bounds, #parse_color, #parse_connections, #parse_diagrams, #parse_documentation, #parse_elements, #parse_font, #parse_model, #parse_nodes, #parse_organizations, #parse_properties, #parse_property, #parse_property_defs, #parse_relationships, #parse_style

Instance Method Details

#connection_relationship_refObject



52
53
54
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 52

def connection_relationship_ref
  "relationshipRef"
end

#diagrams_pathObject



40
41
42
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 40

def diagrams_path
  ">views>diagrams>view"
end

#identifier_ref_nameObject



36
37
38
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 36

def identifier_ref_name
  "identifierRef"
end

#organizations_root_selectorObject



16
17
18
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 16

def organizations_root_selector
  ">organizations"
end

#parse_archimate_version(root) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 7

def parse_archimate_version(root)
  case root.namespace.href
  when "http://www.opengroup.org/xsd/archimate/3.0/"
    :archimate_3_0
  else
    raise "Unexpected namespace version: #{root.namespace.href}"
  end
end

#parse_element_name(el) ⇒ Object



32
33
34
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 32

def parse_element_name(el)
  ModelExchangeFile::XmlLangString.parse(el.at_css(">name"))
end

#parse_viewpoints(model) ⇒ Object

<xs:complexType name=“ViewpointType”>

<xs:complexContent>
    <xs:extension base="NamedReferenceableType">
        <xs:sequence>
            <xs:group ref="PropertiesGroup" />
            <xs:element name="concern" type="ConcernType" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="viewpointPurpose" type="ViewpointPurposeType" minOccurs="0" maxOccurs="1" />
            <xs:element name="viewpointContent" type="ViewpointContentType" minOccurs="0" maxOccurs="1" />
            <xs:element name="allowedElementType" type="AllowedElementTypeType" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="allowedRelationshipType" type="AllowedRelationshipTypeType" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="modelingNote" type="ModelingNoteType" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:extension>
</xs:complexContent>

</xs:complexType>



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 110

def parse_viewpoints(model)
  []
  # model.css("views > viewpoints").map do |i|
    # attribute :concern, ConcernList
    # attribute :viewpointPurpose, ViewpointPurpose.optional
    # attribute :viewpointContent, ViewpointContent.optional
    # attribute :allowedElementTypes, AllowedElementTypes
    # attribute :allowedRelationshipTypes, AllowedRelationshipTypes
    # attribute :modelingNotes, Strict::Array.member(ModelingNote).default([])
    # DataModel::Viewpoint.new(
      #     id: identifier_to_id(i["identifier"]),
      #     name: parse_element_name(i),
      #     documentation: parse_documentation(i),
      #     properties: parse_properties(i),
      #     nodes: nodes,
      #     connections: connections,
      #     connection_router_type: i["connectionRouterType"],
      #     type: i.attr("xsi:type"),
      #     background: i.attr("background")
    # )
  # end
end

#property_def_attr_nameObject



24
25
26
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 24

def property_def_attr_name
  "propertyDefinitionRef"
end

#property_def_name(node) ⇒ Object



28
29
30
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 28

def property_def_name(node)
  ModelExchangeFile::XmlLangString.parse(node.at_css("name"))
end

#property_defs_selectorObject



20
21
22
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 20

def property_defs_selector
    ">propertyDefinitions>propertyDefinition"
end

#style_to_int(str) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 56

def style_to_int(str)
  case str
  when nil
    0
  when "italic"
    1
  when "bold"
    2
  when "bold italic"
    3
  else
    raise "Broken for value: #{str}"
  end
end

#view_node_element_refObject



44
45
46
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 44

def view_node_element_ref
  "elementRef"
end

#view_node_type_attrObject



48
49
50
# File 'lib/archimate/file_formats/model_exchange_file_reader_30.rb', line 48

def view_node_type_attr
  "xsi:type"
end