Class: Lutaml::Qea::Models::EaDocument

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

Overview

Represents a document from the t_document table in EA database Stores documentation style templates and artifacts

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#primary_key

Class Method Details

.from_db_row(row) ⇒ EaDocument?

Create from database row

Parameters:

  • row (Hash)

    Database row with string keys

Returns:

  • (EaDocument, nil)

    New instance or nil if row is nil



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

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

  new(
    doc_id: row["DocID"],
    doc_name: row["DocName"],
    doc_type: row["DocType"],
    str_content: row["StrContent"],
    bin_content: row["BinContent"],
    element_id: row["ElementID"],
  )
end

.primary_key_columnObject



18
19
20
# File 'lib/lutaml/qea/models/ea_document.rb', line 18

def self.primary_key_column
  :doc_id
end

.table_nameObject



22
23
24
# File 'lib/lutaml/qea/models/ea_document.rb', line 22

def self.table_name
  "t_document"
end

Instance Method Details

#has_binary_content?Boolean

Check if document has binary content

Returns:

  • (Boolean)


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

def has_binary_content?
  !bin_content.nil? && !bin_content.empty?
end

#has_content?Boolean

Check if document has string content

Returns:

  • (Boolean)


56
57
58
# File 'lib/lutaml/qea/models/ea_document.rb', line 56

def has_content?
  !str_content.nil? && !str_content.empty?
end

#style_document?Boolean

Check if this is a style document

Returns:

  • (Boolean)


50
51
52
# File 'lib/lutaml/qea/models/ea_document.rb', line 50

def style_document?
  doc_type == "SSDOCSTYLE"
end