Module: GoodData::CloudConnect::Core

Includes:
GoodData::CloudConnect
Defined in:
lib/cloud_connect/dsl/cc.rb

Class Method Summary collapse

Class Method Details

.build_node2(builder, node) ⇒ Object



7
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
# File 'lib/cloud_connect/dsl/cc.rb', line 7

def self.build_node2(builder, node)
  if node[:type] == Nodes::EDGE
    builder.tag!("Edge", node)
  elsif node[:type] == Nodes::SF_CONNECTION
    builder.tag!("Connection", node)
  elsif node[:type] == Nodes::FILE_LIST
    builder.tag!("Node", node.remove(:output_mapping)) do |xml|
      xml.attr({:name => "outputMapping"}) do |attr|
        transformation = node[:output_mapping]
        attr.cdata! transformation
      end
    end
  elsif node[:type] == Nodes::REFORMAT || node[:type] == Nodes::EXT_HASH_JOIN
    builder.tag!("Node", node.remove(:transformation)) do |xml|
      xml.attr({:name => "transform"}) do |attr|
        transformation = node[:transformation]
        attr.cdata! transformation
      end
    end
  elsif node[:type] == Nodes::DATA_GENERATOR
    builder.tag!("Node", node.remove(:transformation)) do |xml|
      xml.attr({:name => "generate"}) do |attr|
        transformation = node[:generate]
        attr.cdata! transformation
      end
    end
  elsif node[:type] == Nodes::PERSISTENT_LOOKUP || node[:type] == Nodes::GD_LOOKUP
    builder.tag!("LookupTable", node)
  else
    builder.tag!("Node", node)
  end
end