Class: Ea::Sources::Qea::MetadataBuilder

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

Overview

Builds an Ea::Model::Metadata from the QEA database. Pulls project-level info (model name, version, tool, source path) from the root package and the QEA file path.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database, qea_path) ⇒ MetadataBuilder

Returns a new instance of MetadataBuilder.



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

def initialize(database, qea_path)
  @database = database
  @qea_path = qea_path
end

Instance Attribute Details

#databaseObject (readonly)

Returns the value of attribute database.



10
11
12
# File 'lib/ea/sources/qea/metadata_builder.rb', line 10

def database
  @database
end

#qea_pathObject (readonly)

Returns the value of attribute qea_path.



10
11
12
# File 'lib/ea/sources/qea/metadata_builder.rb', line 10

def qea_path
  @qea_path
end

Instance Method Details

#buildObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ea/sources/qea/metadata_builder.rb', line 17

def build
  root_pkg = root_package
  Ea::Model::Metadata.new(
    id: "metadata",
    title: root_pkg&.name,
    version: root_pkg&.version,
    created_date: root_pkg&.createddate,
    modified_date: root_pkg&.modifieddate,
    author: root_pkg&.pkgowner,
    source_format: "qea",
    source_tool: "Sparx Enterprise Architect",
    source_path: qea_path
  )
end