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



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

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



17
18
19
# File 'lib/lutaml/qea/models/ea_xref.rb', line 17

def self.primary_key_column
  :xref_id
end

.table_nameObject



21
22
23
# File 'lib/lutaml/qea/models/ea_xref.rb', line 21

def self.table_name
  "t_xref"
end

Instance Method Details

#attribute_property?Boolean

Check if this xref is for attribute properties

Returns:

  • (Boolean)


87
88
89
# File 'lib/lutaml/qea/models/ea_xref.rb', line 87

def attribute_property?
  xref_type == "attribute property"
end

#connector_property?Boolean

Check if this xref is for connector properties

Returns:

  • (Boolean)


75
76
77
# File 'lib/lutaml/qea/models/ea_xref.rb', line 75

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)


63
64
65
# File 'lib/lutaml/qea/models/ea_xref.rb', line 63

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

#diagram_property?Boolean

Check if this xref is for diagram properties

Returns:

  • (Boolean)


81
82
83
# File 'lib/lutaml/qea/models/ea_xref.rb', line 81

def diagram_property?
  xref_type == "diagram properties"
end

#element_property?Boolean

Check if this xref is for element properties

Returns:

  • (Boolean)


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

def element_property?
  xref_type == "element property"
end

#parsed_descriptionHash

Parse the Description field into structured data

Returns:

  • (Hash)

    Parsed description data



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

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)


57
58
59
# File 'lib/lutaml/qea/models/ea_xref.rb', line 57

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