Class: Lutaml::Qea::Models::EaXref

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

Overview

Represents a cross-reference from the t_xref table in EA database Stores cross-references for stereotypes, properties, and relationships between UML elements

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#primary_key

Class Method Details

.from_db_row(row) ⇒ EaXref?

Create from database row

Parameters:

  • row (Hash)

    Database row with string keys

Returns:

  • (EaXref, nil)

    New instance or nil if row is nil



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/lutaml/qea/models/ea_xref.rb', line 31

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

  new(
    xref_id: row["XrefID"],
    name: row["Name"],
    xref_type: row["Type"],
    client: row["Client"],
    supplier: row["Supplier"],
    description: row["Description"],
  )
end

.primary_key_columnObject



19
20
21
# File 'lib/lutaml/qea/models/ea_xref.rb', line 19

def self.primary_key_column
  :xref_id
end

.table_nameObject



23
24
25
# File 'lib/lutaml/qea/models/ea_xref.rb', line 23

def self.table_name
  "t_xref"
end

Instance Method Details

#attribute_property?Boolean

Check if this xref is for attribute properties

Returns:

  • (Boolean)


89
90
91
# File 'lib/lutaml/qea/models/ea_xref.rb', line 89

def attribute_property?
  xref_type == "attribute property"
end

#connector_property?Boolean

Check if this xref is for connector properties

Returns:

  • (Boolean)


77
78
79
# File 'lib/lutaml/qea/models/ea_xref.rb', line 77

def connector_property?
  xref_type&.include?("connector") && xref_type.include?("property")
end

#custom_property?Boolean

Check if this xref is for custom properties

Returns:

  • (Boolean)


65
66
67
# File 'lib/lutaml/qea/models/ea_xref.rb', line 65

def custom_property?
  !description&.include?("@STEREO") && !description&.include?("@TAG")
end

#diagram_property?Boolean

Check if this xref is for diagram properties

Returns:

  • (Boolean)


83
84
85
# File 'lib/lutaml/qea/models/ea_xref.rb', line 83

def diagram_property?
  xref_type == "diagram properties"
end

#element_property?Boolean

Check if this xref is for element properties

Returns:

  • (Boolean)


71
72
73
# File 'lib/lutaml/qea/models/ea_xref.rb', line 71

def element_property?
  xref_type == "element property"
end

#parsed_descriptionHash

Parse the Description field into structured data

Returns:

  • (Hash)

    Parsed description data



51
52
53
54
55
# File 'lib/lutaml/qea/models/ea_xref.rb', line 51

def parsed_description
  return @parsed_description if defined?(@parsed_description)

  @parsed_description = parse_description_field(description)
end

#stereotype?Boolean

Check if this xref is for stereotypes

Returns:

  • (Boolean)


59
60
61
# File 'lib/lutaml/qea/models/ea_xref.rb', line 59

def stereotype?
  name == "Stereotypes" || description&.include?("@STEREO")
end