Class: Ea::Sources::Qea::AnnotationBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/sources/qea/annotation_builder.rb

Overview

Builds Ea::Model::Annotation instances from EA Note text and t_document rows. EA stores most documentation as a Note field directly on the element (t_object.Note, t_package.notes, t_connector.notes, t_attribute.notes, etc.); we lift each non-empty note into a typed Annotation.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner_guid) ⇒ AnnotationBuilder

Returns a new instance of AnnotationBuilder.



14
15
16
# File 'lib/ea/sources/qea/annotation_builder.rb', line 14

def initialize(owner_guid)
  @owner_guid = owner_guid
end

Instance Attribute Details

#owner_guidObject (readonly)

Returns the value of attribute owner_guid.



12
13
14
# File 'lib/ea/sources/qea/annotation_builder.rb', line 12

def owner_guid
  @owner_guid
end

Class Method Details

.from_note(note_text, owner_guid, kind: "documentation") ⇒ Object



18
19
20
21
22
# File 'lib/ea/sources/qea/annotation_builder.rb', line 18

def self.from_note(note_text, owner_guid, kind: "documentation")
  return [] if note_text.nil? || note_text.empty?

  [new(owner_guid).build(kind, note_text)]
end

Instance Method Details

#build(kind, body, author: nil, modified_date: nil) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/ea/sources/qea/annotation_builder.rb', line 24

def build(kind, body, author: nil, modified_date: nil)
  Ea::Model::Annotation.new(
    id: IdNormalizer.synthetic("annotation", owner_guid, kind),
    kind: kind,
    body: body,
    author: author,
    modified_date: modified_date
  )
end