Class: Ea::Qea::Models::EaXref

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/ea/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

Constant Summary collapse

COLUMN_MAP =
{
  "XrefID" => :xref_id,
  "Type" => :xref_type,
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

from_db_row, #primary_key, #sort_position

Class Method Details

.column_mapObject



34
35
36
# File 'lib/ea/qea/models/ea_xref.rb', line 34

def self.column_map
  COLUMN_MAP
end

.primary_key_columnObject



20
21
22
# File 'lib/ea/qea/models/ea_xref.rb', line 20

def self.primary_key_column
  :xref_id
end

.table_nameObject



24
25
26
# File 'lib/ea/qea/models/ea_xref.rb', line 24

def self.table_name
  "t_xref"
end

Instance Method Details

#attribute_property?Boolean

Check if this xref is for attribute properties

Returns:

  • (Boolean)


93
94
95
# File 'lib/ea/qea/models/ea_xref.rb', line 93

def attribute_property?
  xref_type == "attribute property"
end

#connector_property?Boolean

Check if this xref is for connector properties

Returns:

  • (Boolean)


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

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)


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

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

#diagram_property?Boolean

Check if this xref is for diagram properties

Returns:

  • (Boolean)


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

def diagram_property?
  xref_type == "diagram properties"
end

#element_property?Boolean

Check if this xref is for element properties

Returns:

  • (Boolean)


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

def element_property?
  xref_type == "element property"
end

#parsed_descriptionHash

Parse the Description field into structured data (legacy hash form). Kept for backward compatibility. New code should use #parsed_record which returns a typed Xref::Record.

Returns:

  • (Hash)

    Parsed description data



47
48
49
50
51
# File 'lib/ea/qea/models/ea_xref.rb', line 47

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

  @parsed_description = parse_description_field(description)
end

#parsed_recordEa::Sources::Qea::Xref::Record

Parse Description into a typed Record with named accessors.



55
56
57
58
59
# File 'lib/ea/qea/models/ea_xref.rb', line 55

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

  @parsed_record = Sources::Qea::Xref::Parser.parse(description)
end

#stereotype?Boolean

Check if this xref is for stereotypes

Returns:

  • (Boolean)


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

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