Class: Archimate::FileFormats::Sax::Archi::ArchiHandlerFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/archimate/file_formats/sax/archi/archi_handler_factory.rb

Instance Method Summary collapse

Instance Method Details

#handler_for(name, attrs) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/archimate/file_formats/sax/archi/archi_handler_factory.rb', line 8

def handler_for(name, attrs)
  case name
  when "model", "archimate:model"
    Model
  when "documentation", "purpose"
    Sax::PreservedLangString
  when "element"
    element_type = Hash[attrs]["xsi:type"].sub(/archimate:/, '')
    case element_type
    when DataModel::Elements, "Junction"
      Element
    when DataModel::DiagramType
      Diagram
    when DataModel::Relationships
      Relationship
    else
      raise "Unexpected element_type #{element_type}"
    end
  when "property"
    Property
  when "folder"
    Organization
  when "child"
    ViewNode
  when "bounds"
    Bounds
  when "sourceConnection"
    Connection
  when "bendpoint"
    Location
  when "content"
    Content
  else
    raise "Unhandled element name #{name}"
  end
end