Class: Lutaml::Qea::Models::EaAttributeTag

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/lutaml/qea/models/ea_attribute_tag.rb

Overview

EA Attribute Tag model

Represents attribute-level tags (custom key-value metadata) in the t_attributetag table. These are metadata properties specific to GML/XML Schema encoding for attributes.

Examples:

Create from database row

row = {
  "PropertyID" => 1,
  "ElementID" => 367,
  "Property" => "isMetadata",
  "VALUE" => "false",
  "NOTES" => nil,
  "ea_guid" => "{GUID}"
}
tag = EaAttributeTag.from_db_row(row)

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#primary_key

Class Method Details

.from_db_row(row) ⇒ EaAttributeTag?

Create from database row

Parameters:

  • row (Hash)

    Database row with string keys

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/lutaml/qea/models/ea_attribute_tag.rb', line 46

def self.from_db_row(row)
  return nil if row.nil?

  new(
    property_id: row["PropertyID"],
    element_id: row["ElementID"],
    property: row["Property"],
    value: row["VALUE"],
    notes: row["NOTES"],
    ea_guid: row["ea_guid"],
  )
end

.primary_key_columnSymbol

Returns Primary key column name.

Returns:

  • (Symbol)

    Primary key column name



33
34
35
# File 'lib/lutaml/qea/models/ea_attribute_tag.rb', line 33

def self.primary_key_column
  :property_id
end

.table_nameString

Returns Database table name.

Returns:

  • (String)

    Database table name



38
39
40
# File 'lib/lutaml/qea/models/ea_attribute_tag.rb', line 38

def self.table_name
  "t_attributetag"
end

Instance Method Details

#boolean?Boolean

Check if property is boolean type

Returns:

  • (Boolean)

    true if value is boolean



90
91
92
# File 'lib/lutaml/qea/models/ea_attribute_tag.rb', line 90

def boolean?
  !boolean_value.nil?
end

#boolean_valueBoolean?

Parse boolean value

Returns:

  • (Boolean, nil)

    Boolean value if parseable, nil otherwise



76
77
78
79
80
81
82
83
84
85
# File 'lib/lutaml/qea/models/ea_attribute_tag.rb', line 76

def boolean_value
  return nil if value.nil?

  case value.downcase
  when "true", "1", "yes"
    true
  when "false", "0", "no"
    false
  end
end

#integer_valueInteger?

Parse integer value

Returns:

  • (Integer, nil)

    Integer value if parseable, nil otherwise



97
98
99
100
101
102
103
104
105
# File 'lib/lutaml/qea/models/ea_attribute_tag.rb', line 97

def integer_value
  return nil if value.nil?

  begin
    Integer(value)
  rescue StandardError
    nil
  end
end

#nameString?

Get property name

Returns:

  • (String, nil)

    Property name



62
63
64
# File 'lib/lutaml/qea/models/ea_attribute_tag.rb', line 62

def name
  property
end

#property_valueString?

Get property value as string

Returns:

  • (String, nil)

    Property value



69
70
71
# File 'lib/lutaml/qea/models/ea_attribute_tag.rb', line 69

def property_value
  value
end