Class: Lutaml::Qea::Factory::EnumTransformer
- Inherits:
-
BaseTransformer
- Object
- BaseTransformer
- Lutaml::Qea::Factory::EnumTransformer
- Defined in:
- lib/lutaml/qea/factory/enum_transformer.rb
Overview
Transforms EA objects (Enumeration type) to UML enums
Instance Attribute Summary
Attributes inherited from BaseTransformer
Instance Method Summary collapse
-
#transform(ea_object) ⇒ Lutaml::Uml::Enum
Transform EA object to UML enum.
Methods inherited from BaseTransformer
#initialize, #transform_collection
Constructor Details
This class inherits a constructor from Lutaml::Qea::Factory::BaseTransformer
Instance Method Details
#transform(ea_object) ⇒ Lutaml::Uml::Enum
Transform EA object to UML enum
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/lutaml/qea/factory/enum_transformer.rb', line 16 def transform(ea_object) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength return nil if ea_object.nil? return nil unless ea_object.enumeration? Lutaml::Uml::Enum.new.tap do |enum| # Map basic properties enum.name = ea_object.name enum.xmi_id = normalize_guid_to_xmi_format(ea_object.ea_guid, "EAID") enum.visibility = map_visibility(ea_object.visibility) # Set package path enum.package_path = calculate_package_path(ea_object.package_id) # Map stereotype if ea_object.stereotype && !ea_object.stereotype.empty? enum.stereotype = ea_object.stereotype end # Map definition/notes enum.definition = ea_object.note unless ea_object.note.nil? || ea_object.note.empty? # Load enum values (stored as attributes in EA) enum.values = load_enum_values(ea_object.ea_object_id) # Load and transform tagged values enum.tagged_values = load_tagged_values(ea_object.ea_guid) end end |