Class: Lutaml::Qea::Factory::OperationTransformer

Inherits:
BaseTransformer show all
Defined in:
lib/lutaml/qea/factory/operation_transformer.rb

Overview

Transforms EA operations to UML operations

Instance Attribute Summary

Attributes inherited from BaseTransformer

#database

Instance Method Summary collapse

Methods inherited from BaseTransformer

#initialize, #transform_collection

Constructor Details

This class inherits a constructor from Lutaml::Qea::Factory::BaseTransformer

Instance Method Details

#transform(ea_operation) ⇒ Lutaml::Uml::Operation

Transform EA operation to UML operation

Parameters:

  • ea_operation (EaOperation)

    EA operation model

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/lutaml/qea/factory/operation_transformer.rb', line 14

def transform(ea_operation) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
  return nil if ea_operation.nil?

  Lutaml::Uml::Operation.new.tap do |op|
    op.name = ea_operation.name
    op.return_type = ea_operation.type
    op.visibility = map_visibility(ea_operation.scope)
    op.xmi_id = ea_operation.ea_guid

    # Build parameter type string from operation parameters
    op.parameter_type = build_parameter_type(ea_operation)

    # Map definition/notes
    op.definition = ea_operation.notes unless
      ea_operation.notes.nil? || ea_operation.notes.empty?

    # Map stereotype if present
    if ea_operation.stereotype && !ea_operation.stereotype.empty?
      op.stereotype = [ea_operation.stereotype]
    end
  end
end