Class: Lutaml::Qea::Factory::ConstraintTransformer
- Inherits:
-
BaseTransformer
- Object
- BaseTransformer
- Lutaml::Qea::Factory::ConstraintTransformer
- Defined in:
- lib/lutaml/qea/factory/constraint_transformer.rb
Overview
Transforms EA ObjectConstraint to UML Constraint
This transformer converts Enterprise Architect constraint definitions (typically OCL constraints) to standard UML Constraint objects.
Instance Attribute Summary
Attributes inherited from BaseTransformer
Instance Method Summary collapse
-
#transform(ea_constraint) ⇒ Lutaml::Uml::Constraint?
Transform EA constraint to UML Constraint.
Methods inherited from BaseTransformer
#initialize, #transform_collection
Constructor Details
This class inherits a constructor from Lutaml::Qea::Factory::BaseTransformer
Instance Method Details
#transform(ea_constraint) ⇒ Lutaml::Uml::Constraint?
Transform EA constraint to UML Constraint
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/lutaml/qea/factory/constraint_transformer.rb', line 27 def transform(ea_constraint) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength return nil unless ea_constraint Lutaml::Uml::Constraint.new.tap do |constraint| # Generate unique ID for the constraint constraint.xmi_id = "constraint_#{ea_constraint.constraint_id}" if ea_constraint.constraint_id # Generate descriptive name from constraint body or use ID constraint.name = constraint_name(ea_constraint) # Map constraint properties constraint.body = ea_constraint.constraint constraint.type = ea_constraint.constraint_type constraint.weight = ea_constraint.weight&.to_s constraint.status = ea_constraint.status end end |