class Twb::DbField

Attributes

dbname[R]
dbtable[R]
name[R]
node[R]
properties[R]
uiname[R]

Public Class Methods

new(dataSource, node, nodeType, table=nil) click to toggle source
# File lib/twb/dbfield.rb, line 29
def initialize dataSource, node, nodeType, table=nil
  @node     = node
  @nodeType = nodeType
  case @nodeType
    when :map
      @uiname  = @node.attribute('key').text.gsub(/^\[|\]$/,'')
      @name    = @uiname
      fldRef   = @node.attribute('value').text.gsub(/^\[|\]$/,'')
      parts    = fldRef.split('].[')
      @dbtable = parts[0]
      @dbname  = parts[1]
    when :tableColumn
      @uiname  = @node.attribute('name').text
      @name    = @uiname
      @dbtable = table
    else
      raise ArgumentError.new("ERROR in DbField creation: invalid Node type, is #{nodeType} \n ")
  end      
  @id      = "#{dataSource}::#{dbname}::#{dbtable}::#{uiname}"
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/twb/dbfield.rb, line 68
def <=>(other)
  @id <=> other.id
end
id() click to toggle source
# File lib/twb/dbfield.rb, line 50
def id
    @id ||= @id = @name.hash
end
loadProperties() click to toggle source
# File lib/twb/dbfield.rb, line 58
def loadProperties
  @properties = {:name=>@name,:uiname=>@uiname, :dbtable=>@dbtable}
  @properties[:dbname] = @dbname if :map == @nodeType
  return @properties
end
to_s() click to toggle source
# File lib/twb/dbfield.rb, line 64
def to_s
  @id
end