ea 0.6.153 → 0.6.155
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ea/cli/app.rb +8 -2
- data/lib/ea/cli/command/base.rb +1 -3
- data/lib/ea/cli/command/convert.rb +2 -2
- data/lib/ea/cli/command/diagrams.rb +4 -4
- data/lib/ea/cli/command/export.rb +1 -1
- data/lib/ea/cli/command/info.rb +1 -1
- data/lib/ea/cli/command/list.rb +2 -2
- data/lib/ea/cli/command/render.rb +1 -2
- data/lib/ea/cli/command/svg.rb +1 -1
- data/lib/ea/cli/command/validate.rb +1 -3
- data/lib/ea/cli/error.rb +1 -1
- data/lib/ea/cli/output.rb +1 -1
- data/lib/ea/diagram/display_config.rb +1 -1
- data/lib/ea/export/json/generator.rb +5 -5
- data/lib/ea/export/json_schema/generator.rb +2 -2
- data/lib/ea/export/plantuml/generator.rb +2 -2
- data/lib/ea/fonts/metrics.rb +3 -4
- data/lib/ea/lint/rules/cyclic_generalization.rb +1 -1
- data/lib/ea/lint/rules/duplicate_name.rb +1 -1
- data/lib/ea/lint/rules/missing_stereotype.rb +4 -3
- data/lib/ea/lint/rules/naming_convention.rb +11 -11
- data/lib/ea/lint/rules/orphan_element.rb +6 -6
- data/lib/ea/mdg/document.rb +0 -1
- data/lib/ea/mdg/loader.rb +0 -1
- data/lib/ea/mdg/xml/technology.rb +1 -1
- data/lib/ea/mdg/xml.rb +0 -1
- data/lib/ea/mdg.rb +0 -1
- data/lib/ea/model/document.rb +2 -2
- data/lib/ea/model/ghost_label.rb +0 -1
- data/lib/ea/model/legend.rb +1 -1
- data/lib/ea/model/property.rb +1 -1
- data/lib/ea/qea/benchmark.rb +9 -13
- data/lib/ea/qea/database.rb +26 -28
- data/lib/ea/qea/factory/association_builder.rb +5 -5
- data/lib/ea/qea/factory/association_transformer.rb +3 -6
- data/lib/ea/qea/factory/attribute_transformer.rb +3 -3
- data/lib/ea/qea/factory/base_transformer.rb +4 -4
- data/lib/ea/qea/factory/class_transformer.rb +5 -5
- data/lib/ea/qea/factory/constraint_transformer.rb +2 -2
- data/lib/ea/qea/factory/data_type_transformer.rb +5 -7
- data/lib/ea/qea/factory/diagram_transformer.rb +3 -7
- data/lib/ea/qea/factory/document_builder.rb +33 -37
- data/lib/ea/qea/factory/ea_to_uml_factory.rb +12 -18
- data/lib/ea/qea/factory/enum_transformer.rb +1 -2
- data/lib/ea/qea/factory/generalization_builder.rb +9 -9
- data/lib/ea/qea/factory/generalization_transformer.rb +3 -5
- data/lib/ea/qea/factory/instance_transformer.rb +3 -8
- data/lib/ea/qea/factory/operation_transformer.rb +2 -4
- data/lib/ea/qea/factory/package_transformer.rb +3 -3
- data/lib/ea/qea/factory/reference_resolver.rb +1 -1
- data/lib/ea/qea/factory/stereotype_loader.rb +1 -5
- data/lib/ea/qea/file_detector.rb +6 -12
- data/lib/ea/qea/infrastructure/database_connection.rb +1 -3
- data/lib/ea/qea/infrastructure/schema_reader.rb +4 -4
- data/lib/ea/qea/infrastructure/table_reader.rb +1 -1
- data/lib/ea/qea/models/ea_attribute.rb +1 -2
- data/lib/ea/qea/models/ea_attribute_tag.rb +1 -2
- data/lib/ea/qea/models/ea_author.rb +1 -1
- data/lib/ea/qea/models/ea_diagram_link.rb +4 -8
- data/lib/ea/qea/models/ea_diagram_object.rb +3 -4
- data/lib/ea/qea/models/ea_document.rb +4 -5
- data/lib/ea/qea/models/ea_glossary.rb +1 -1
- data/lib/ea/qea/models/ea_list.rb +1 -1
- data/lib/ea/qea/models/ea_object.rb +2 -2
- data/lib/ea/qea/models/ea_object_constraint.rb +1 -2
- data/lib/ea/qea/models/ea_object_property.rb +1 -2
- data/lib/ea/qea/models/ea_operation.rb +1 -2
- data/lib/ea/qea/models/ea_phase.rb +1 -1
- data/lib/ea/qea/models/ea_script.rb +5 -6
- data/lib/ea/qea/models/ea_tagged_value.rb +2 -3
- data/lib/ea/qea/models/ea_version.rb +1 -1
- data/lib/ea/qea/models/ea_xref.rb +6 -7
- data/lib/ea/qea/repositories/base_repository.rb +1 -1
- data/lib/ea/qea/services/database_loader.rb +2 -4
- data/lib/ea/qea/validation/association_validator.rb +12 -12
- data/lib/ea/qea/validation/attribute_validator.rb +25 -26
- data/lib/ea/qea/validation/base_validator.rb +5 -5
- data/lib/ea/qea/validation/class_validator.rb +34 -34
- data/lib/ea/qea/validation/database/circular_reference_validator.rb +7 -7
- data/lib/ea/qea/validation/database/ocl_constraint_validator.rb +3 -3
- data/lib/ea/qea/validation/database/orphan_validator.rb +5 -7
- data/lib/ea/qea/validation/database/referential_integrity_validator.rb +39 -39
- data/lib/ea/qea/validation/diagram_validator.rb +39 -39
- data/lib/ea/qea/validation/formatters/json_formatter.rb +16 -16
- data/lib/ea/qea/validation/formatters/text_formatter.rb +10 -10
- data/lib/ea/qea/validation/operation_validator.rb +13 -14
- data/lib/ea/qea/validation/package_validator.rb +18 -18
- data/lib/ea/qea/validation/validation_engine.rb +5 -5
- data/lib/ea/qea/validation/validation_message.rb +56 -73
- data/lib/ea/qea/validation/validation_result.rb +6 -6
- data/lib/ea/qea/verification/comparison_result.rb +13 -21
- data/lib/ea/qea/verification/document_normalizer.rb +6 -12
- data/lib/ea/qea/verification/document_verifier.rb +39 -39
- data/lib/ea/qea/verification/element_comparator.rb +27 -31
- data/lib/ea/qea/verification/structure_matcher.rb +10 -10
- data/lib/ea/qea.rb +5 -7
- data/lib/ea/query/builder.rb +3 -3
- data/lib/ea/render/image_converter.rb +5 -3
- data/lib/ea/shapescript/parser.rb +4 -4
- data/lib/ea/sources/qea/classifier_builder.rb +7 -3
- data/lib/ea/sources/qea/context_diagram_support.rb +2 -2
- data/lib/ea/sources/qea/diagram_builder/routing.rb +4 -4
- data/lib/ea/sources/qea/diagram_builder.rb +80 -51
- data/lib/ea/sources/qea/id_normalizer.rb +0 -1
- data/lib/ea/sources/qea/instance_builder.rb +2 -2
- data/lib/ea/sources/qea/legend_builder.rb +1 -1
- data/lib/ea/sources/qea/note_builder.rb +4 -4
- data/lib/ea/sources/xmi/diagram_builder/stereotype_profiles.rb +1 -1
- data/lib/ea/sources/xmi/extension_style_parser.rb +2 -2
- data/lib/ea/sources/xmi/property_builder.rb +10 -2
- data/lib/ea/sources/xmi/relationship_builder.rb +10 -2
- data/lib/ea/sources/xmi/relationship_type_map.rb +1 -1
- data/lib/ea/sources/xmi/tag_builder.rb +1 -1
- data/lib/ea/sources/xmi/type_classifier_map.rb +1 -1
- data/lib/ea/spa/configuration.rb +2 -4
- data/lib/ea/spa/generator.rb +3 -3
- data/lib/ea/spa/output/strategy.rb +7 -5
- data/lib/ea/spa/projector.rb +21 -17
- data/lib/ea/svg/connector_router.rb +5 -3
- data/lib/ea/svg/ea_emitter/background.rb +0 -1
- data/lib/ea/svg/ea_emitter/bounds_calculator.rb +8 -10
- data/lib/ea/svg/ea_emitter/canvas.rb +1 -1
- data/lib/ea/svg/ea_emitter/color_resolver.rb +1 -1
- data/lib/ea/svg/ea_emitter/compartment/note_body.rb +1 -1
- data/lib/ea/svg/ea_emitter/connector_redock.rb +6 -3
- data/lib/ea/svg/ea_emitter/diagram_frame.rb +2 -2
- data/lib/ea/svg/ea_emitter/document.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/attribute_renderer.rb +2 -4
- data/lib/ea/svg/ea_emitter/element/compartment_geometry.rb +18 -14
- data/lib/ea/svg/ea_emitter/element/header_line_pipeline.rb +6 -5
- data/lib/ea/svg/ea_emitter/element/header_line_provider/name.rb +1 -3
- data/lib/ea/svg/ea_emitter/element/header_line_provider/stereotype_label.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/icon_renderer.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/legend_renderer.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/note_shape_renderer.rb +5 -5
- data/lib/ea/svg/ea_emitter/element/operation_renderer.rb +2 -3
- data/lib/ea/svg/ea_emitter/element/package_shape_renderer.rb +3 -4
- data/lib/ea/svg/ea_emitter/element/stereotype_icon_renderer.rb +1 -1
- data/lib/ea/svg/ea_emitter/elements.rb +64 -63
- data/lib/ea/svg/ea_emitter/ghost_labels.rb +0 -1
- data/lib/ea/svg/ea_emitter/label/end_label.rb +7 -7
- data/lib/ea/svg/ea_emitter/labels.rb +1 -1
- data/lib/ea/svg/ea_emitter/layer_sequencer.rb +5 -5
- data/lib/ea/svg/ea_emitter/marker/arrow_path.rb +4 -2
- data/lib/ea/svg/ea_emitter/marker/open_triangle.rb +4 -4
- data/lib/ea/svg/ea_emitter/markers.rb +3 -1
- data/lib/ea/svg/ea_emitter/render_context.rb +1 -1
- data/lib/ea/svg/ea_emitter/text_renderer.rb +15 -4
- data/lib/ea/theme/definition.rb +17 -17
- data/lib/ea/transformers/qea_to_xmi/context.rb +1 -1
- data/lib/ea/transformers/qea_to_xmi/run_state.rb +1 -1
- data/lib/ea/transformers/qea_to_xmi/transformer.rb +44 -44
- data/lib/ea/transformers/qea_to_xmi/visibility.rb +3 -3
- data/lib/ea/version.rb +1 -1
- data/lib/ea/xmi/liquid_drops/connector_drop.rb +2 -2
- data/lib/ea/xmi/liquid_drops/enum_drop.rb +4 -4
- data/lib/ea/xmi/liquid_drops/generalization_attribute_drop.rb +2 -8
- data/lib/ea/xmi/liquid_drops/generalization_drop.rb +3 -3
- data/lib/ea/xmi/liquid_drops/package_drop.rb +9 -9
- data/lib/ea/xmi/liquid_drops/root_drop.rb +1 -1
- data/lib/ea/xmi/loader.rb +5 -11
- data/lib/ea/xmi/lookup_service.rb +3 -3
- data/lib/ea/xmi/parser.rb +75 -81
- data/lib/ea/xmi/slicer.rb +16 -12
- data/lib/ea/xref_format/legend_definition.rb +31 -0
- data/lib/ea/xref_format/parser.rb +146 -0
- data/lib/ea/xref_format/property_definition.rb +25 -0
- data/lib/ea/xref_format/record.rb +37 -0
- data/lib/ea/xref_format/stereotype_application.rb +33 -0
- data/lib/ea/xref_format.rb +36 -0
- data/lib/ea.rb +1 -0
- metadata +26 -25
- data/lib/ea/sources/qea/xref/legend_definition.rb +0 -35
- data/lib/ea/sources/qea/xref/parser.rb +0 -150
- data/lib/ea/sources/qea/xref/property_definition.rb +0 -29
- data/lib/ea/sources/qea/xref/record.rb +0 -41
- data/lib/ea/sources/qea/xref/stereotype_application.rb +0 -37
data/lib/ea/qea/database.rb
CHANGED
|
@@ -33,9 +33,7 @@ module Ea
|
|
|
33
33
|
#
|
|
34
34
|
# @param connection [SQLite3::Database] Database connection
|
|
35
35
|
# @return [void]
|
|
36
|
-
|
|
37
|
-
@connection = connection
|
|
38
|
-
end
|
|
36
|
+
attr_writer :connection
|
|
39
37
|
|
|
40
38
|
# Close the database connection if open
|
|
41
39
|
# @return [void]
|
|
@@ -70,30 +68,30 @@ module Ea
|
|
|
70
68
|
# each maintain their own case/when dispatch. Adding a new
|
|
71
69
|
# table = adding one hash entry.
|
|
72
70
|
TABLE_TO_COLLECTION = {
|
|
73
|
-
"t_package"
|
|
74
|
-
"t_object"
|
|
75
|
-
"t_attribute"
|
|
76
|
-
"t_operation"
|
|
77
|
-
"t_operationparams"
|
|
78
|
-
"t_connector"
|
|
79
|
-
"t_diagram"
|
|
80
|
-
"t_diagramobjects"
|
|
81
|
-
"t_diagramlinks"
|
|
82
|
-
"t_objectconstraint"
|
|
83
|
-
"t_objectproperties"
|
|
84
|
-
"t_taggedvalue"
|
|
85
|
-
"t_attributetag"
|
|
86
|
-
"t_xref"
|
|
87
|
-
"t_stereotypes"
|
|
88
|
-
"t_datatypes"
|
|
89
|
-
"t_constrainttypes"
|
|
90
|
-
"t_connectortypes"
|
|
91
|
-
"t_diagramtypes"
|
|
92
|
-
"t_objecttypes"
|
|
93
|
-
"t_statustypes"
|
|
94
|
-
"t_complexitytypes"
|
|
95
|
-
"t_documents"
|
|
96
|
-
"t_scripts"
|
|
71
|
+
"t_package" => :packages,
|
|
72
|
+
"t_object" => :objects,
|
|
73
|
+
"t_attribute" => :attributes,
|
|
74
|
+
"t_operation" => :operations,
|
|
75
|
+
"t_operationparams" => :operation_params,
|
|
76
|
+
"t_connector" => :connectors,
|
|
77
|
+
"t_diagram" => :diagrams,
|
|
78
|
+
"t_diagramobjects" => :diagram_objects,
|
|
79
|
+
"t_diagramlinks" => :diagram_links,
|
|
80
|
+
"t_objectconstraint" => :object_constraints,
|
|
81
|
+
"t_objectproperties" => :object_properties,
|
|
82
|
+
"t_taggedvalue" => :tagged_values,
|
|
83
|
+
"t_attributetag" => :attribute_tags,
|
|
84
|
+
"t_xref" => :xrefs,
|
|
85
|
+
"t_stereotypes" => :stereotypes,
|
|
86
|
+
"t_datatypes" => :datatypes,
|
|
87
|
+
"t_constrainttypes" => :constraint_types,
|
|
88
|
+
"t_connectortypes" => :connector_types,
|
|
89
|
+
"t_diagramtypes" => :diagram_types,
|
|
90
|
+
"t_objecttypes" => :object_types,
|
|
91
|
+
"t_statustypes" => :status_types,
|
|
92
|
+
"t_complexitytypes" => :complexity_types,
|
|
93
|
+
"t_documents" => :documents,
|
|
94
|
+
"t_scripts" => :scripts
|
|
97
95
|
}.freeze
|
|
98
96
|
|
|
99
97
|
# @param table_name [String] EA SQL table name (e.g., "t_object")
|
|
@@ -123,7 +121,7 @@ module Ea
|
|
|
123
121
|
return @objects if defined?(@objects)
|
|
124
122
|
|
|
125
123
|
@objects = Repositories::ObjectRepository.new(
|
|
126
|
-
@collections[:objects] || []
|
|
124
|
+
@collections[:objects] || []
|
|
127
125
|
)
|
|
128
126
|
end
|
|
129
127
|
|
|
@@ -4,7 +4,7 @@ module Ea
|
|
|
4
4
|
module Qea
|
|
5
5
|
module Factory
|
|
6
6
|
class AssociationBuilder < BaseTransformer
|
|
7
|
-
ASSOC_TYPES = [
|
|
7
|
+
ASSOC_TYPES = %w[Association Aggregation Composition].freeze
|
|
8
8
|
|
|
9
9
|
def load_class_associations(object_id, object_guid)
|
|
10
10
|
return [] if object_id.nil?
|
|
@@ -13,7 +13,7 @@ module Ea
|
|
|
13
13
|
"EAID")
|
|
14
14
|
|
|
15
15
|
assoc_connectors = database.connectors_for_object(object_id)
|
|
16
|
-
|
|
16
|
+
.select { |c| ASSOC_TYPES.include?(c.connector_type) }
|
|
17
17
|
|
|
18
18
|
assoc_connectors.filter_map do |ea_connector|
|
|
19
19
|
build_association(ea_connector, object_id, normalized_owner_xmi_id)
|
|
@@ -24,7 +24,7 @@ module Ea
|
|
|
24
24
|
return [] if object_id.nil?
|
|
25
25
|
|
|
26
26
|
assoc_connectors = database.connectors_for_object(object_id)
|
|
27
|
-
|
|
27
|
+
.select { |c| ASSOC_TYPES.include?(c.connector_type) }
|
|
28
28
|
obj = find_object_by_id(object_id)
|
|
29
29
|
obj_pkg_name = find_package_name(obj&.package_id)
|
|
30
30
|
|
|
@@ -35,7 +35,7 @@ module Ea
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def build_connector_attribute(ea_connector, object_id, obj,
|
|
38
|
-
obj_pkg_name)
|
|
38
|
+
obj_pkg_name)
|
|
39
39
|
if ea_connector.start_object_id == object_id
|
|
40
40
|
build_end_attribute(ea_connector, obj, obj_pkg_name)
|
|
41
41
|
elsif ea_connector.end_object_id == object_id
|
|
@@ -176,7 +176,7 @@ obj_pkg_name)
|
|
|
176
176
|
gen_name: obj.name,
|
|
177
177
|
name_ns: obj_pkg_name,
|
|
178
178
|
type_ns: find_package_name(peer_obj.package_id),
|
|
179
|
-
is_src: is_src
|
|
179
|
+
is_src: is_src
|
|
180
180
|
)
|
|
181
181
|
end
|
|
182
182
|
|
|
@@ -28,7 +28,7 @@ module Ea
|
|
|
28
28
|
)
|
|
29
29
|
assoc.owner_end_attribute_name = ea_connector.sourcerole
|
|
30
30
|
assoc.owner_end_cardinality = build_cardinality_from_string(
|
|
31
|
-
ea_connector.sourcecard
|
|
31
|
+
ea_connector.sourcecard
|
|
32
32
|
)
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -41,7 +41,7 @@ module Ea
|
|
|
41
41
|
)
|
|
42
42
|
assoc.member_end_attribute_name = ea_connector.destrole
|
|
43
43
|
assoc.member_end_cardinality = build_cardinality_from_string(
|
|
44
|
-
ea_connector.destcard
|
|
44
|
+
ea_connector.destcard
|
|
45
45
|
)
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -50,9 +50,7 @@ module Ea
|
|
|
50
50
|
ea_connector.notes.nil? || ea_connector.notes.empty?
|
|
51
51
|
|
|
52
52
|
# Map stereotype
|
|
53
|
-
if ea_connector.stereotype && !ea_connector.stereotype.empty?
|
|
54
|
-
assoc.stereotype = [ea_connector.stereotype]
|
|
55
|
-
end
|
|
53
|
+
assoc.stereotype = [ea_connector.stereotype] if ea_connector.stereotype && !ea_connector.stereotype.empty?
|
|
56
54
|
|
|
57
55
|
# Load and transform tagged values
|
|
58
56
|
assoc.tagged_values = load_tagged_values(ea_connector.ea_guid)
|
|
@@ -84,7 +82,6 @@ module Ea
|
|
|
84
82
|
card.max = parsed[:max]
|
|
85
83
|
end
|
|
86
84
|
end
|
|
87
|
-
|
|
88
85
|
end
|
|
89
86
|
end
|
|
90
87
|
end
|
|
@@ -8,7 +8,7 @@ module Ea
|
|
|
8
8
|
# Transform EA attribute to UML attribute
|
|
9
9
|
# @param ea_attribute [EaAttribute] EA attribute model
|
|
10
10
|
# @return [Lutaml::Uml::TopElementAttribute] UML attribute
|
|
11
|
-
def transform(ea_attribute) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
|
11
|
+
def transform(ea_attribute) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
|
12
12
|
return nil if ea_attribute.nil?
|
|
13
13
|
|
|
14
14
|
Lutaml::Uml::TopElementAttribute.new.tap do |attr|
|
|
@@ -30,7 +30,7 @@ module Ea
|
|
|
30
30
|
if ea_attribute.lowerbound || ea_attribute.upperbound
|
|
31
31
|
attr.cardinality = build_cardinality(
|
|
32
32
|
ea_attribute.lowerbound,
|
|
33
|
-
ea_attribute.upperbound
|
|
33
|
+
ea_attribute.upperbound
|
|
34
34
|
)
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -48,7 +48,7 @@ module Ea
|
|
|
48
48
|
# Look up the type object's XMI ID from classifier
|
|
49
49
|
# @param classifier_id [Integer] Classifier ID
|
|
50
50
|
# @return [String, nil] Type's XMI ID
|
|
51
|
-
def lookup_type_xmi_id(classifier_id)
|
|
51
|
+
def lookup_type_xmi_id(classifier_id)
|
|
52
52
|
return nil if classifier_id.nil? || classifier_id.to_i.zero?
|
|
53
53
|
|
|
54
54
|
obj = database.find_object(classifier_id.to_i)
|
|
@@ -35,7 +35,7 @@ module Ea
|
|
|
35
35
|
# Map EA visibility to UML visibility
|
|
36
36
|
# @param ea_visibility [String] EA visibility value
|
|
37
37
|
# @return [String] UML visibility value
|
|
38
|
-
def map_visibility(ea_visibility)
|
|
38
|
+
def map_visibility(ea_visibility)
|
|
39
39
|
return "public" if ea_visibility.nil? || ea_visibility.empty?
|
|
40
40
|
|
|
41
41
|
case ea_visibility.downcase
|
|
@@ -52,7 +52,7 @@ module Ea
|
|
|
52
52
|
# @return [Hash] Hash with :min and :max keys
|
|
53
53
|
def parse_cardinality(cardinality_str)
|
|
54
54
|
return { min: nil, max: nil } if cardinality_str.nil? ||
|
|
55
|
-
|
|
55
|
+
cardinality_str.empty?
|
|
56
56
|
|
|
57
57
|
parts = cardinality_str.split("..")
|
|
58
58
|
if parts.size == 2
|
|
@@ -145,7 +145,7 @@ module Ea
|
|
|
145
145
|
return [] if object_id.nil?
|
|
146
146
|
|
|
147
147
|
ea_attributes = database.attributes_for_object(object_id)
|
|
148
|
-
|
|
148
|
+
.sort_by { |a| a.pos || 0 }
|
|
149
149
|
AttributeTransformer.new(database).transform_collection(ea_attributes)
|
|
150
150
|
end
|
|
151
151
|
|
|
@@ -156,7 +156,7 @@ module Ea
|
|
|
156
156
|
return [] if object_id.nil?
|
|
157
157
|
|
|
158
158
|
ea_operations = database.operations_for_object(object_id)
|
|
159
|
-
|
|
159
|
+
.sort_by { |op| op.pos || 0 }
|
|
160
160
|
OperationTransformer.new(database).transform_collection(ea_operations)
|
|
161
161
|
end
|
|
162
162
|
|
|
@@ -52,7 +52,7 @@ module Ea
|
|
|
52
52
|
klass.constraints = load_constraints(ea_object.ea_object_id)
|
|
53
53
|
klass.tagged_values = load_tagged_values(ea_object.ea_guid)
|
|
54
54
|
klass.tagged_values.concat(
|
|
55
|
-
load_object_properties(ea_object.ea_object_id)
|
|
55
|
+
load_object_properties(ea_object.ea_object_id)
|
|
56
56
|
)
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -61,10 +61,10 @@ module Ea
|
|
|
61
61
|
assoc_builder = AssociationBuilder.new(database)
|
|
62
62
|
|
|
63
63
|
klass.generalization = gen_builder.load_generalization(
|
|
64
|
-
ea_object.ea_object_id
|
|
64
|
+
ea_object.ea_object_id
|
|
65
65
|
)
|
|
66
66
|
klass.association_generalization = gen_builder
|
|
67
|
-
|
|
67
|
+
.load_association_generalizations(ea_object.ea_object_id)
|
|
68
68
|
|
|
69
69
|
klass.associations = assoc_builder.load_class_associations(
|
|
70
70
|
ea_object.ea_object_id, ea_object.ea_guid
|
|
@@ -77,7 +77,7 @@ module Ea
|
|
|
77
77
|
|
|
78
78
|
attrs = load_attributes(ea_object.ea_object_id)
|
|
79
79
|
assoc_attrs = gen_builder.convert_to_top_element_attributes(
|
|
80
|
-
assoc_builder.load_association_attributes(ea_object.ea_object_id)
|
|
80
|
+
assoc_builder.load_association_attributes(ea_object.ea_object_id)
|
|
81
81
|
)
|
|
82
82
|
attrs + assoc_attrs
|
|
83
83
|
end
|
|
@@ -99,7 +99,7 @@ module Ea
|
|
|
99
99
|
|
|
100
100
|
def add_xref_stereotype(stereotypes, ea_object)
|
|
101
101
|
xref_stereotype = StereotypeLoader.new(database)
|
|
102
|
-
|
|
102
|
+
.load_from_xref(ea_object.ea_guid)
|
|
103
103
|
return unless xref_stereotype && !stereotypes.include?(xref_stereotype)
|
|
104
104
|
|
|
105
105
|
stereotypes << xref_stereotype
|
|
@@ -24,7 +24,7 @@ module Ea
|
|
|
24
24
|
#
|
|
25
25
|
# @param ea_constraint [Models::EaObjectConstraint] EA constraint model
|
|
26
26
|
# @return [Lutaml::Uml::Constraint, nil] UML constraint or nil
|
|
27
|
-
def transform(ea_constraint) # rubocop:disable Metrics/AbcSize
|
|
27
|
+
def transform(ea_constraint) # rubocop:disable Metrics/AbcSize
|
|
28
28
|
return nil unless ea_constraint
|
|
29
29
|
|
|
30
30
|
Lutaml::Uml::Constraint.new.tap do |constraint|
|
|
@@ -53,7 +53,7 @@ module Ea
|
|
|
53
53
|
#
|
|
54
54
|
# @param ea_constraint [Models::EaObjectConstraint] EA constraint
|
|
55
55
|
# @return [String] Constraint name
|
|
56
|
-
def constraint_name(ea_constraint)
|
|
56
|
+
def constraint_name(ea_constraint)
|
|
57
57
|
return "constraint_#{ea_constraint.constraint_id}" unless
|
|
58
58
|
ea_constraint.constraint
|
|
59
59
|
|
|
@@ -8,11 +8,11 @@ module Ea
|
|
|
8
8
|
# Transform EA object to UML data type
|
|
9
9
|
# @param ea_object [EaObject] EA object model
|
|
10
10
|
# @return [Lutaml::Uml::DataType] UML data type
|
|
11
|
-
def transform(ea_object) # rubocop:disable Metrics/AbcSize,Metrics/
|
|
11
|
+
def transform(ea_object) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
12
12
|
return nil if ea_object.nil?
|
|
13
13
|
return nil unless ea_object.data_type?
|
|
14
14
|
|
|
15
|
-
Lutaml::Uml::DataType.new.tap do |data_type|
|
|
15
|
+
Lutaml::Uml::DataType.new.tap do |data_type|
|
|
16
16
|
# Map basic properties
|
|
17
17
|
data_type.name = ea_object.name
|
|
18
18
|
data_type.xmi_id = normalize_guid_to_xmi_format(ea_object.ea_guid,
|
|
@@ -22,9 +22,7 @@ module Ea
|
|
|
22
22
|
data_type.visibility = map_visibility(ea_object.visibility)
|
|
23
23
|
|
|
24
24
|
# Map stereotype
|
|
25
|
-
if ea_object.stereotype && !ea_object.stereotype.empty?
|
|
26
|
-
data_type.stereotype = [ea_object.stereotype]
|
|
27
|
-
end
|
|
25
|
+
data_type.stereotype = [ea_object.stereotype] if ea_object.stereotype && !ea_object.stereotype.empty?
|
|
28
26
|
|
|
29
27
|
# Map definition/notes
|
|
30
28
|
data_type.definition = normalize_note(ea_object.note) unless
|
|
@@ -54,11 +52,11 @@ module Ea
|
|
|
54
52
|
# @param object_id [Integer] Object ID
|
|
55
53
|
# @param object_guid [String] Object GUID
|
|
56
54
|
# @return [Array<Lutaml::Uml::Association>] UML associations
|
|
57
|
-
def load_associations(object_id, object_guid)
|
|
55
|
+
def load_associations(object_id, object_guid)
|
|
58
56
|
return [] if object_id.nil?
|
|
59
57
|
|
|
60
58
|
assoc_connectors = database.connectors_for_object(object_id)
|
|
61
|
-
|
|
59
|
+
.select { |c| c.connector_type == "Association" }
|
|
62
60
|
|
|
63
61
|
assoc_transformer = AssociationTransformer.new(database)
|
|
64
62
|
normalized_xmi_id = normalize_guid_to_xmi_format(object_guid, "EAID")
|
|
@@ -15,7 +15,7 @@ module Ea
|
|
|
15
15
|
def transform(ea_diagram) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength
|
|
16
16
|
return nil if ea_diagram.nil?
|
|
17
17
|
|
|
18
|
-
Lutaml::Uml::Diagram.new.tap do |diagram|
|
|
18
|
+
Lutaml::Uml::Diagram.new.tap do |diagram|
|
|
19
19
|
# Map basic properties
|
|
20
20
|
diagram.name = ea_diagram.name
|
|
21
21
|
diagram.xmi_id = normalize_guid_to_xmi_format(ea_diagram.ea_guid,
|
|
@@ -37,15 +37,11 @@ module Ea
|
|
|
37
37
|
ea_diagram.notes.nil? || ea_diagram.notes.empty?
|
|
38
38
|
|
|
39
39
|
# Map stereotype
|
|
40
|
-
if ea_diagram.stereotype && !ea_diagram.stereotype.empty?
|
|
41
|
-
diagram.stereotype = [ea_diagram.stereotype]
|
|
42
|
-
end
|
|
40
|
+
diagram.stereotype = [ea_diagram.stereotype] if ea_diagram.stereotype && !ea_diagram.stereotype.empty?
|
|
43
41
|
|
|
44
42
|
# Load and transform diagram objects (visual placement)
|
|
45
43
|
diagram_objects = load_diagram_objects(ea_diagram.diagram_id)
|
|
46
|
-
if diagram_objects.any?
|
|
47
|
-
diagram.diagram_objects.concat(diagram_objects)
|
|
48
|
-
end
|
|
44
|
+
diagram.diagram_objects.concat(diagram_objects) if diagram_objects.any?
|
|
49
45
|
|
|
50
46
|
# Load and transform diagram links (visual routing)
|
|
51
47
|
diagram_links = load_diagram_links(ea_diagram.diagram_id)
|
|
@@ -108,7 +108,7 @@ module Ea
|
|
|
108
108
|
# Validate document integrity
|
|
109
109
|
# @return [Boolean] True if valid
|
|
110
110
|
# @raise [ValidationError] If validation fails
|
|
111
|
-
def validate!
|
|
111
|
+
def validate!
|
|
112
112
|
errors = []
|
|
113
113
|
warnings = []
|
|
114
114
|
|
|
@@ -138,7 +138,7 @@ module Ea
|
|
|
138
138
|
enums: @document.enums.size,
|
|
139
139
|
data_types: @document.data_types.size,
|
|
140
140
|
instances: @document.instances.size,
|
|
141
|
-
associations: @document.associations.size
|
|
141
|
+
associations: @document.associations.size
|
|
142
142
|
}
|
|
143
143
|
end
|
|
144
144
|
|
|
@@ -149,17 +149,17 @@ module Ea
|
|
|
149
149
|
def check_duplicate_xmi_ids(errors)
|
|
150
150
|
xmi_ids = collect_all_xmi_ids
|
|
151
151
|
duplicates = xmi_ids.group_by { |id| id }
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
.select { |_, v| v.size > 1 }
|
|
153
|
+
.keys
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
return if duplicates.empty?
|
|
156
|
+
|
|
157
|
+
errors << "Duplicate xmi_ids found: #{duplicates.join(", ")}"
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
# Collect all xmi_ids from document
|
|
161
161
|
# @return [Array<String>] All xmi_ids
|
|
162
|
-
def collect_all_xmi_ids # rubocop:disable Metrics/AbcSize
|
|
162
|
+
def collect_all_xmi_ids # rubocop:disable Metrics/AbcSize
|
|
163
163
|
ids = []
|
|
164
164
|
|
|
165
165
|
# Collect from top-level elements
|
|
@@ -180,18 +180,14 @@ module Ea
|
|
|
180
180
|
# Recursively collect all xmi_ids from a package and its descendants
|
|
181
181
|
# @param package [Lutaml::Uml::Package] Package to collect from
|
|
182
182
|
# @return [Array<String>] All xmi_ids in package hierarchy
|
|
183
|
-
def collect_package_xmi_ids(package) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/
|
|
183
|
+
def collect_package_xmi_ids(package) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
|
184
184
|
ids = []
|
|
185
185
|
|
|
186
186
|
# Collect from package's elements
|
|
187
187
|
ids.concat(package.classes.filter_map(&:xmi_id)) if package.classes
|
|
188
188
|
ids.concat(package.enums.filter_map(&:xmi_id)) if package.enums
|
|
189
|
-
if package.data_types
|
|
190
|
-
|
|
191
|
-
end
|
|
192
|
-
if package.instances
|
|
193
|
-
ids.concat(package.instances.filter_map(&:xmi_id))
|
|
194
|
-
end
|
|
189
|
+
ids.concat(package.data_types.filter_map(&:xmi_id)) if package.data_types
|
|
190
|
+
ids.concat(package.instances.filter_map(&:xmi_id)) if package.instances
|
|
195
191
|
|
|
196
192
|
# Recursively collect from child packages
|
|
197
193
|
package.packages&.each do |child_package|
|
|
@@ -217,27 +213,27 @@ module Ea
|
|
|
217
213
|
assoc, :owner_end_xmi_id, all_xmi_ids
|
|
218
214
|
)
|
|
219
215
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
216
|
+
next unless has_invalid_member || has_invalid_owner
|
|
217
|
+
|
|
218
|
+
invalid_associations << assoc
|
|
219
|
+
if has_invalid_member
|
|
220
|
+
add_invalid_end_warning(assoc, :member_end_xmi_id, all_xmi_ids,
|
|
221
|
+
warnings)
|
|
222
|
+
end
|
|
223
|
+
if has_invalid_owner
|
|
224
|
+
add_invalid_end_warning(assoc, :owner_end_xmi_id, all_xmi_ids,
|
|
225
|
+
warnings)
|
|
230
226
|
end
|
|
231
227
|
end
|
|
232
228
|
|
|
233
229
|
# Remove invalid associations from document
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
warnings << "Removed #{invalid_associations.size} association(s) " \
|
|
239
|
-
"with invalid references"
|
|
230
|
+
return if invalid_associations.empty?
|
|
231
|
+
|
|
232
|
+
@document.associations.reject! do |a|
|
|
233
|
+
invalid_associations.include?(a)
|
|
240
234
|
end
|
|
235
|
+
warnings << "Removed #{invalid_associations.size} association(s) " \
|
|
236
|
+
"with invalid references"
|
|
241
237
|
end
|
|
242
238
|
|
|
243
239
|
# Check if association end reference is valid
|
|
@@ -257,16 +253,16 @@ module Ea
|
|
|
257
253
|
# @param attr [Symbol] Attribute to check (should be xmi_id attribute)
|
|
258
254
|
# @param valid_ids [Set<String>] Set of valid xmi_ids
|
|
259
255
|
# @param warnings [Array<String>] Warning accumulator
|
|
260
|
-
def add_invalid_end_warning(assoc, attr, valid_ids, warnings)
|
|
256
|
+
def add_invalid_end_warning(assoc, attr, valid_ids, warnings)
|
|
261
257
|
value = association_end_xmi_id(assoc, attr)
|
|
262
258
|
return if value.nil?
|
|
263
259
|
|
|
264
|
-
|
|
265
|
-
name_value = association_end_name(assoc, attr)
|
|
260
|
+
return if valid_ids.include?(value)
|
|
266
261
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
262
|
+
name_value = association_end_name(assoc, attr)
|
|
263
|
+
|
|
264
|
+
warnings << "Association #{assoc.xmi_id} references " \
|
|
265
|
+
"invalid #{attr}: #{name_value}"
|
|
270
266
|
end
|
|
271
267
|
|
|
272
268
|
# Explicit dispatch for association end xmi_id attributes.
|
|
@@ -26,7 +26,7 @@ module Ea
|
|
|
26
26
|
# @return [Lutaml::Uml::Document] Complete UML document
|
|
27
27
|
def create_document # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
28
28
|
builder = DocumentBuilder.new(
|
|
29
|
-
name: options[:document_name] || "EA Model"
|
|
29
|
+
name: options[:document_name] || "EA Model"
|
|
30
30
|
)
|
|
31
31
|
|
|
32
32
|
# Transform packages with hierarchy (includes all classes)
|
|
@@ -49,14 +49,12 @@ module Ea
|
|
|
49
49
|
# Build document with both connector-level and
|
|
50
50
|
# class-level associations
|
|
51
51
|
builder.add_packages(packages)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
.add_classes(orphan_classes)
|
|
53
|
+
.add_associations(associations)
|
|
54
|
+
.add_associations(class_associations)
|
|
55
55
|
|
|
56
56
|
# Add diagrams if requested
|
|
57
|
-
if options[:include_diagrams]
|
|
58
|
-
builder.add_diagrams(transform_diagrams)
|
|
59
|
-
end
|
|
57
|
+
builder.add_diagrams(transform_diagrams) if options[:include_diagrams]
|
|
60
58
|
|
|
61
59
|
builder.build(validate: options[:validate])
|
|
62
60
|
end
|
|
@@ -72,7 +70,7 @@ module Ea
|
|
|
72
70
|
root_packages.filter_map do |ea_package|
|
|
73
71
|
uml_package = package_transformer.transform_with_hierarchy(
|
|
74
72
|
ea_package,
|
|
75
|
-
include_children: true
|
|
73
|
+
include_children: true
|
|
76
74
|
)
|
|
77
75
|
|
|
78
76
|
register_package_hierarchy(uml_package)
|
|
@@ -120,13 +118,13 @@ module Ea
|
|
|
120
118
|
|
|
121
119
|
# Transform all associations
|
|
122
120
|
# @return [Array<Lutaml::Uml::Association>] All UML associations
|
|
123
|
-
def transform_associations
|
|
121
|
+
def transform_associations
|
|
124
122
|
association_transformer = get_transformer(:association)
|
|
125
123
|
|
|
126
124
|
ea_associations = database.connectors.select(&:association?)
|
|
127
125
|
|
|
128
126
|
uml_associations = association_transformer.transform_collection(
|
|
129
|
-
ea_associations
|
|
127
|
+
ea_associations
|
|
130
128
|
)
|
|
131
129
|
|
|
132
130
|
uml_associations.each do |uml_assoc|
|
|
@@ -157,7 +155,7 @@ module Ea
|
|
|
157
155
|
{
|
|
158
156
|
include_diagrams: true,
|
|
159
157
|
validate: true,
|
|
160
|
-
document_name: "EA Model"
|
|
158
|
+
document_name: "EA Model"
|
|
161
159
|
}
|
|
162
160
|
end
|
|
163
161
|
|
|
@@ -168,9 +166,7 @@ module Ea
|
|
|
168
166
|
return @transformers[type] if @transformers.key?(type)
|
|
169
167
|
|
|
170
168
|
transformer_class = TransformerRegistry.transformer_for(type)
|
|
171
|
-
unless transformer_class
|
|
172
|
-
raise ArgumentError, "Unknown transformer type: #{type}"
|
|
173
|
-
end
|
|
169
|
+
raise ArgumentError, "Unknown transformer type: #{type}" unless transformer_class
|
|
174
170
|
|
|
175
171
|
@transformers[type] = transformer_class.new(database)
|
|
176
172
|
end
|
|
@@ -212,11 +208,9 @@ module Ea
|
|
|
212
208
|
associations
|
|
213
209
|
end
|
|
214
210
|
|
|
215
|
-
def collect_package_associations(package, associations)
|
|
211
|
+
def collect_package_associations(package, associations)
|
|
216
212
|
package.classes&.each do |klass|
|
|
217
|
-
if klass.associations && !klass.associations.empty?
|
|
218
|
-
associations.concat(klass.associations)
|
|
219
|
-
end
|
|
213
|
+
associations.concat(klass.associations) if klass.associations && !klass.associations.empty?
|
|
220
214
|
end
|
|
221
215
|
|
|
222
216
|
package.packages&.each do |child_package|
|
|
@@ -54,7 +54,7 @@ module Ea
|
|
|
54
54
|
return [] if object_id.nil?
|
|
55
55
|
|
|
56
56
|
ea_attrs = database.attributes_for_object(object_id)
|
|
57
|
-
|
|
57
|
+
.sort_by { |a| a.pos || 0 }
|
|
58
58
|
|
|
59
59
|
ea_attrs.filter_map { |ea_attr| build_enum_value(ea_attr) }
|
|
60
60
|
end
|
|
@@ -74,7 +74,6 @@ module Ea
|
|
|
74
74
|
|
|
75
75
|
text
|
|
76
76
|
end
|
|
77
|
-
|
|
78
77
|
end
|
|
79
78
|
end
|
|
80
79
|
end
|
|
@@ -37,7 +37,7 @@ module Ea
|
|
|
37
37
|
return [] if object_id.nil?
|
|
38
38
|
|
|
39
39
|
gen_connectors = database.connectors_for_object(object_id)
|
|
40
|
-
|
|
40
|
+
.select { |c| c.generalization? && c.start_object_id == object_id }
|
|
41
41
|
|
|
42
42
|
gen_connectors.filter_map do |ea_connector|
|
|
43
43
|
build_assoc_generalization(ea_connector)
|
|
@@ -76,7 +76,7 @@ module Ea
|
|
|
76
76
|
cardinality: attr.cardinality,
|
|
77
77
|
definition: attr.definition&.strip,
|
|
78
78
|
association: attr.association,
|
|
79
|
-
type_ns: attr.type_ns
|
|
79
|
+
type_ns: attr.type_ns
|
|
80
80
|
}
|
|
81
81
|
end
|
|
82
82
|
|
|
@@ -141,7 +141,7 @@ module Ea
|
|
|
141
141
|
|
|
142
142
|
def ea_connector_for(object_id)
|
|
143
143
|
database.connectors_for_object(object_id)
|
|
144
|
-
|
|
144
|
+
.find { |c| c.generalization? && c.start_object_id == object_id }
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
def populate_generalization_attrs(generalization, object_id)
|
|
@@ -149,22 +149,22 @@ module Ea
|
|
|
149
149
|
apply_namespace_to_attrs(general_attrs, generalization)
|
|
150
150
|
|
|
151
151
|
generalization.general_attributes = general_attrs
|
|
152
|
-
|
|
152
|
+
.sort_by { |a| [a.name.to_s, a.id] }
|
|
153
153
|
|
|
154
154
|
generalization.attributes = transform_general_attributes(
|
|
155
|
-
generalization
|
|
155
|
+
generalization
|
|
156
156
|
)
|
|
157
157
|
|
|
158
158
|
generalization.owned_props = generalization.attributes
|
|
159
|
-
|
|
159
|
+
.reject(&:has_association)
|
|
160
160
|
generalization.assoc_props = generalization.attributes
|
|
161
|
-
|
|
161
|
+
.select(&:has_association)
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
def build_general_attrs(object_id)
|
|
165
165
|
current_attrs = load_attributes(object_id)
|
|
166
166
|
current_assoc_attrs = AssociationBuilder.new(database)
|
|
167
|
-
|
|
167
|
+
.load_association_attributes(object_id)
|
|
168
168
|
convert_to_general_attributes(current_attrs + current_assoc_attrs)
|
|
169
169
|
end
|
|
170
170
|
|
|
@@ -177,7 +177,7 @@ module Ea
|
|
|
177
177
|
end
|
|
178
178
|
|
|
179
179
|
def populate_parent_generalization(generalization, ea_connector,
|
|
180
|
-
visited)
|
|
180
|
+
visited)
|
|
181
181
|
parent_object_id = ea_connector&.end_object_id
|
|
182
182
|
return unless parent_object_id
|
|
183
183
|
|
|
@@ -15,11 +15,9 @@ module Ea
|
|
|
15
15
|
return nil if current_object.nil?
|
|
16
16
|
|
|
17
17
|
# ea_connector can be nil for terminal nodes (classes with no parent)
|
|
18
|
-
if ea_connector && !ea_connector.generalization?
|
|
19
|
-
return nil
|
|
20
|
-
end
|
|
18
|
+
return nil if ea_connector && !ea_connector.generalization?
|
|
21
19
|
|
|
22
|
-
Lutaml::Uml::Generalization.new.tap do |gen|
|
|
20
|
+
Lutaml::Uml::Generalization.new.tap do |gen|
|
|
23
21
|
# Map properties from CURRENT object (not parent)
|
|
24
22
|
# This matches XMI's self-referential pattern
|
|
25
23
|
gen.general_id = normalize_guid_to_xmi_format(
|
|
@@ -55,7 +53,7 @@ module Ea
|
|
|
55
53
|
false
|
|
56
54
|
end
|
|
57
55
|
|
|
58
|
-
#
|
|
56
|
+
# NOTE: general_attributes, attributes, owned_props, assoc_props,
|
|
59
57
|
# general, inherited_props, inherited_assoc_props
|
|
60
58
|
# will be populated in ClassTransformer.load_generalization
|
|
61
59
|
end
|