ea 0.6.155 → 0.6.157
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/.rubocop_todo.yml +423 -0
- data/config/qea_schema.yml +2 -0
- data/lib/ea/ocl/parser.rb +2 -2
- data/lib/ea/qea/benchmark.rb +4 -4
- data/lib/ea/qea/factory/association_builder.rb +1 -1
- data/lib/ea/qea/factory/association_transformer.rb +2 -2
- data/lib/ea/qea/factory/attribute_transformer.rb +1 -1
- data/lib/ea/qea/factory/base_transformer.rb +2 -20
- data/lib/ea/qea/factory/constraint_transformer.rb +1 -1
- data/lib/ea/qea/factory/data_type_transformer.rb +1 -1
- data/lib/ea/qea/factory/diagram_transformer.rb +3 -3
- data/lib/ea/qea/factory/document_builder.rb +3 -3
- data/lib/ea/qea/factory/ea_to_uml_factory.rb +2 -2
- data/lib/ea/qea/factory/enum_transformer.rb +3 -2
- data/lib/ea/qea/factory/generalization_builder.rb +6 -4
- data/lib/ea/qea/factory/generalization_transformer.rb +1 -1
- data/lib/ea/qea/factory/instance_transformer.rb +1 -1
- data/lib/ea/qea/factory/operation_transformer.rb +1 -1
- data/lib/ea/qea/factory/package_transformer.rb +1 -1
- data/lib/ea/qea/file_detector.rb +2 -2
- data/lib/ea/qea/infrastructure/table_reader.rb +2 -2
- data/lib/ea/qea/models/ea_xref.rb +1 -1
- data/lib/ea/qea/repositories/base_repository.rb +1 -1
- data/lib/ea/qea/rules/cardinality.rb +78 -0
- data/lib/ea/qea/rules/enum_literal.rb +22 -0
- data/lib/ea/qea/rules/generalization.rb +39 -0
- data/lib/ea/qea/rules/visibility.rb +35 -0
- data/lib/ea/qea/rules.rb +22 -0
- data/lib/ea/qea/services/configuration.rb +16 -2
- data/lib/ea/qea/services/database_loader.rb +2 -2
- data/lib/ea/qea/validation/association_validator.rb +2 -2
- data/lib/ea/qea/validation/attribute_validator.rb +2 -2
- data/lib/ea/qea/validation/base_validator.rb +3 -3
- data/lib/ea/qea/validation/class_validator.rb +3 -3
- data/lib/ea/qea/validation/database/circular_reference_validator.rb +3 -3
- data/lib/ea/qea/validation/database/orphan_validator.rb +4 -4
- data/lib/ea/qea/validation/database/referential_integrity_validator.rb +3 -3
- data/lib/ea/qea/validation/diagram_validator.rb +3 -3
- data/lib/ea/qea/validation/formatters/json_formatter.rb +2 -2
- data/lib/ea/qea/validation/formatters/text_formatter.rb +4 -4
- data/lib/ea/qea/validation/operation_validator.rb +2 -2
- data/lib/ea/qea/validation/package_validator.rb +3 -3
- data/lib/ea/qea/validation/validation_engine.rb +5 -5
- data/lib/ea/qea/validation/validation_message.rb +1 -1
- data/lib/ea/qea/verification/comparison_result.rb +4 -4
- data/lib/ea/qea/verification/document_normalizer.rb +3 -3
- data/lib/ea/qea/verification/document_verifier.rb +3 -3
- data/lib/ea/qea/verification/element_comparator.rb +5 -5
- data/lib/ea/qea/verification/structure_matcher.rb +4 -4
- data/lib/ea/qea.rb +2 -1
- data/lib/ea/rtf.rb +2 -2
- data/lib/ea/sources/qea/classifier_builder.rb +4 -8
- data/lib/ea/sources/qea/operation_builder.rb +1 -6
- data/lib/ea/sources/qea/property_builder.rb +1 -7
- data/lib/ea/svg/ea_emitter/text_renderer.rb +1 -1
- data/lib/ea/theme/loader.rb +0 -2
- data/lib/ea/transformers/qea_to_xmi/cardinality.rb +7 -35
- data/lib/ea/transformers/qea_to_xmi/extension_serializer.rb +2 -2
- data/lib/ea/version.rb +1 -1
- data/lib/ea/xmi/parser.rb +25 -25
- metadata +8 -2
|
@@ -12,7 +12,7 @@ module Ea
|
|
|
12
12
|
|
|
13
13
|
private
|
|
14
14
|
|
|
15
|
-
def validate_parent_object_references
|
|
15
|
+
def validate_parent_object_references
|
|
16
16
|
operations.each do |op|
|
|
17
17
|
next if reference_exists?("t_object", "ea_object_id",
|
|
18
18
|
op.ea_object_id)
|
|
@@ -29,7 +29,7 @@ module Ea
|
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
def validate_return_types
|
|
32
|
+
def validate_return_types
|
|
33
33
|
operations.each do |op|
|
|
34
34
|
next unless op.classifier && !op.classifier.empty?
|
|
35
35
|
|
|
@@ -13,7 +13,7 @@ module Ea
|
|
|
13
13
|
|
|
14
14
|
private
|
|
15
15
|
|
|
16
|
-
def validate_parent_references
|
|
16
|
+
def validate_parent_references
|
|
17
17
|
packages.each do |package|
|
|
18
18
|
next if package.root?
|
|
19
19
|
|
|
@@ -33,7 +33,7 @@ module Ea
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
def validate_duplicate_names
|
|
36
|
+
def validate_duplicate_names
|
|
37
37
|
packages_by_parent = packages.group_by(&:parent_id)
|
|
38
38
|
|
|
39
39
|
packages_by_parent.each do |parent_id, sibling_packages|
|
|
@@ -64,7 +64,7 @@ module Ea
|
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
def validate_circular_hierarchy
|
|
67
|
+
def validate_circular_hierarchy
|
|
68
68
|
packages.each do |package|
|
|
69
69
|
next if package.root?
|
|
70
70
|
|
|
@@ -74,7 +74,7 @@ module Ea
|
|
|
74
74
|
# @param context [Hash] Validation context
|
|
75
75
|
# @param validators [Array<Symbol>, nil] Optional validator filter
|
|
76
76
|
# @return [ValidationResult]
|
|
77
|
-
def validate_qea_database(context, validators = nil)
|
|
77
|
+
def validate_qea_database(context, validators = nil)
|
|
78
78
|
result = ValidationResult.new
|
|
79
79
|
db_context = context.merge(result: result)
|
|
80
80
|
|
|
@@ -106,7 +106,7 @@ module Ea
|
|
|
106
106
|
# @param context [Hash] Validation context
|
|
107
107
|
# @param validators [Array<Symbol>, nil] Optional validator filter
|
|
108
108
|
# @return [ValidationResult]
|
|
109
|
-
def validate_uml_tree(context, validators = nil)
|
|
109
|
+
def validate_uml_tree(context, validators = nil)
|
|
110
110
|
result = ValidationResult.new
|
|
111
111
|
uml_context = context.merge(result: result)
|
|
112
112
|
|
|
@@ -172,7 +172,7 @@ module Ea
|
|
|
172
172
|
|
|
173
173
|
private
|
|
174
174
|
|
|
175
|
-
def build_context_internal
|
|
175
|
+
def build_context_internal
|
|
176
176
|
context = {
|
|
177
177
|
document: @document,
|
|
178
178
|
database: @database,
|
|
@@ -206,7 +206,7 @@ module Ea
|
|
|
206
206
|
|
|
207
207
|
#
|
|
208
208
|
# @return [void]
|
|
209
|
-
def setup_default_validators
|
|
209
|
+
def setup_default_validators
|
|
210
210
|
# Phase 1: QEA Database Integrity Validators
|
|
211
211
|
@registry.register(:referential_integrity,
|
|
212
212
|
ReferentialIntegrityValidator)
|
|
@@ -338,7 +338,7 @@ module Ea
|
|
|
338
338
|
#
|
|
339
339
|
# @param result [ValidationResult]
|
|
340
340
|
# @return [void]
|
|
341
|
-
def display_text_result(result)
|
|
341
|
+
def display_text_result(result)
|
|
342
342
|
puts "=" * 80
|
|
343
343
|
puts "VALIDATION REPORT"
|
|
344
344
|
puts "=" * 80
|
|
@@ -102,7 +102,7 @@ module Ea
|
|
|
102
102
|
# Returns a formatted string representation of the message
|
|
103
103
|
#
|
|
104
104
|
# @return [String]
|
|
105
|
-
def to_s
|
|
105
|
+
def to_s
|
|
106
106
|
parts = []
|
|
107
107
|
parts << "#{entity_type.to_s.capitalize} '#{entity_name}'"
|
|
108
108
|
parts << "{#{entity_id}}"
|
|
@@ -8,7 +8,7 @@ module Ea
|
|
|
8
8
|
attr_reader :matches, :differences, :xmi_only, :qea_only,
|
|
9
9
|
:property_differences
|
|
10
10
|
|
|
11
|
-
def initialize
|
|
11
|
+
def initialize
|
|
12
12
|
@matches = {
|
|
13
13
|
packages: 0,
|
|
14
14
|
classes: 0,
|
|
@@ -100,7 +100,7 @@ module Ea
|
|
|
100
100
|
# Generate human-readable summary
|
|
101
101
|
#
|
|
102
102
|
# @return [String] Summary text
|
|
103
|
-
def summary
|
|
103
|
+
def summary
|
|
104
104
|
lines = []
|
|
105
105
|
lines << "=== Verification Summary ==="
|
|
106
106
|
lines << ""
|
|
@@ -205,7 +205,7 @@ module Ea
|
|
|
205
205
|
# Get critical issues (information loss)
|
|
206
206
|
#
|
|
207
207
|
# @return [Array<String>] List of critical issues
|
|
208
|
-
def critical_issues
|
|
208
|
+
def critical_issues
|
|
209
209
|
issues = []
|
|
210
210
|
|
|
211
211
|
# Missing packages
|
|
@@ -229,7 +229,7 @@ module Ea
|
|
|
229
229
|
# Get acceptable differences (QEA has more)
|
|
230
230
|
#
|
|
231
231
|
# @return [Array<String>] List of acceptable differences
|
|
232
|
-
def acceptable_differences
|
|
232
|
+
def acceptable_differences
|
|
233
233
|
acceptable = []
|
|
234
234
|
|
|
235
235
|
# QEA-only elements
|
|
@@ -42,7 +42,7 @@ module Ea
|
|
|
42
42
|
#
|
|
43
43
|
# @param document [Lutaml::Uml::Document] The document to process
|
|
44
44
|
# @return [void]
|
|
45
|
-
def sort_collections(document)
|
|
45
|
+
def sort_collections(document)
|
|
46
46
|
# Sort top-level collections by name
|
|
47
47
|
document.packages&.sort_by! { |p| p.name || "" }
|
|
48
48
|
document.classes&.sort_by! { |c| c.name || "" }
|
|
@@ -82,7 +82,7 @@ module Ea
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
# Process classes to remove XMI IDs
|
|
85
|
-
def process_classes(classes)
|
|
85
|
+
def process_classes(classes)
|
|
86
86
|
classes.each do |klass|
|
|
87
87
|
klass.xmi_id = nil
|
|
88
88
|
|
|
@@ -128,7 +128,7 @@ module Ea
|
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
# Sort collections within packages
|
|
131
|
-
def sort_package_collections(packages)
|
|
131
|
+
def sort_package_collections(packages)
|
|
132
132
|
packages.each do |package|
|
|
133
133
|
package.classes&.sort_by! { |c| c.name || "" }
|
|
134
134
|
package.enums&.sort_by! { |e| e.name || "" }
|
|
@@ -69,7 +69,7 @@ module Ea
|
|
|
69
69
|
# @param xmi_doc [Lutaml::Uml::Document] XMI document
|
|
70
70
|
# @param qea_doc [Lutaml::Uml::Document] QEA document
|
|
71
71
|
# @return [void]
|
|
72
|
-
def verify_structure(xmi_doc, qea_doc)
|
|
72
|
+
def verify_structure(xmi_doc, qea_doc)
|
|
73
73
|
# Compare package counts (cache for reuse in verify_properties)
|
|
74
74
|
@cached_package_matches = matcher.match_packages(xmi_doc, qea_doc)
|
|
75
75
|
result.add_matches(:packages, @cached_package_matches[:matches].size)
|
|
@@ -230,11 +230,11 @@ module Ea
|
|
|
230
230
|
end
|
|
231
231
|
|
|
232
232
|
# Verify class properties
|
|
233
|
-
def verify_class_properties(matches)
|
|
233
|
+
def verify_class_properties(matches)
|
|
234
234
|
attr_count = 0
|
|
235
235
|
op_count = 0
|
|
236
236
|
|
|
237
|
-
matches.each do |qualified_name, pair|
|
|
237
|
+
matches.each do |qualified_name, pair|
|
|
238
238
|
xmi_class = pair[:xmi]
|
|
239
239
|
qea_class = pair[:qea]
|
|
240
240
|
|
|
@@ -10,7 +10,7 @@ module Ea
|
|
|
10
10
|
# @param xmi_pkg [Lutaml::Uml::Package] XMI package
|
|
11
11
|
# @param qea_pkg [Lutaml::Uml::Package] QEA package
|
|
12
12
|
# @return [Hash] Comparison result with :equal and :differences
|
|
13
|
-
def compare_packages(xmi_pkg, qea_pkg)
|
|
13
|
+
def compare_packages(xmi_pkg, qea_pkg)
|
|
14
14
|
differences = []
|
|
15
15
|
|
|
16
16
|
# Compare basic properties
|
|
@@ -41,7 +41,7 @@ module Ea
|
|
|
41
41
|
# @param xmi_class [Lutaml::Uml::UmlClass] XMI class
|
|
42
42
|
# @param qea_class [Lutaml::Uml::UmlClass] QEA class
|
|
43
43
|
# @return [Hash] Comparison result with :equal and :differences
|
|
44
|
-
def compare_classes(xmi_class, qea_class)
|
|
44
|
+
def compare_classes(xmi_class, qea_class)
|
|
45
45
|
differences = []
|
|
46
46
|
|
|
47
47
|
# Compare name
|
|
@@ -88,7 +88,7 @@ module Ea
|
|
|
88
88
|
# @param xmi_attr [Lutaml::Uml::TopElementAttribute] XMI attribute
|
|
89
89
|
# @param qea_attr [Lutaml::Uml::TopElementAttribute] QEA attribute
|
|
90
90
|
# @return [Hash] Comparison result with :equal and :differences
|
|
91
|
-
def compare_attributes(xmi_attr, qea_attr)
|
|
91
|
+
def compare_attributes(xmi_attr, qea_attr)
|
|
92
92
|
differences = []
|
|
93
93
|
|
|
94
94
|
# Compare name
|
|
@@ -135,7 +135,7 @@ module Ea
|
|
|
135
135
|
# @param xmi_op [Lutaml::Uml::Operation] XMI operation
|
|
136
136
|
# @param qea_op [Lutaml::Uml::Operation] QEA operation
|
|
137
137
|
# @return [Hash] Comparison result with :equal and :differences
|
|
138
|
-
def compare_operations(xmi_op, qea_op)
|
|
138
|
+
def compare_operations(xmi_op, qea_op)
|
|
139
139
|
differences = []
|
|
140
140
|
|
|
141
141
|
# Compare name
|
|
@@ -171,7 +171,7 @@ module Ea
|
|
|
171
171
|
# @param xmi_assoc [Lutaml::Uml::Association] XMI association
|
|
172
172
|
# @param qea_assoc [Lutaml::Uml::Association] QEA association
|
|
173
173
|
# @return [Hash] Comparison result with :equal and :differences
|
|
174
|
-
def compare_associations(xmi_assoc, qea_assoc)
|
|
174
|
+
def compare_associations(xmi_assoc, qea_assoc)
|
|
175
175
|
differences = []
|
|
176
176
|
|
|
177
177
|
# Compare owner end
|
|
@@ -109,7 +109,7 @@ module Ea
|
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
# Recursively index classes in packages
|
|
112
|
-
def index_classes_in_packages(packages, parent_path, index)
|
|
112
|
+
def index_classes_in_packages(packages, parent_path, index)
|
|
113
113
|
return unless packages
|
|
114
114
|
|
|
115
115
|
packages.each do |package|
|
|
@@ -150,7 +150,7 @@ module Ea
|
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
# Recursively index enums in packages
|
|
153
|
-
def index_enums_in_packages(packages, parent_path, index)
|
|
153
|
+
def index_enums_in_packages(packages, parent_path, index)
|
|
154
154
|
return unless packages
|
|
155
155
|
|
|
156
156
|
packages.each do |package|
|
|
@@ -191,7 +191,7 @@ module Ea
|
|
|
191
191
|
end
|
|
192
192
|
|
|
193
193
|
# Recursively index data types in packages
|
|
194
|
-
def index_data_types_in_packages(packages, parent_path, index)
|
|
194
|
+
def index_data_types_in_packages(packages, parent_path, index)
|
|
195
195
|
return unless packages
|
|
196
196
|
|
|
197
197
|
packages.each do |package|
|
|
@@ -253,7 +253,7 @@ module Ea
|
|
|
253
253
|
end
|
|
254
254
|
|
|
255
255
|
# Match elements between two indexes
|
|
256
|
-
def match_elements(xmi_index, qea_index)
|
|
256
|
+
def match_elements(xmi_index, qea_index)
|
|
257
257
|
matches = {}
|
|
258
258
|
xmi_only = []
|
|
259
259
|
qea_only = []
|
data/lib/ea/qea.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module Ea
|
|
4
4
|
module Qea
|
|
5
5
|
autoload :Infrastructure, "ea/qea/infrastructure"
|
|
6
|
+
autoload :Rules, "ea/qea/rules"
|
|
6
7
|
autoload :Services, "ea/qea/services"
|
|
7
8
|
autoload :Models, "ea/qea/models"
|
|
8
9
|
autoload :Factory, "ea/qea/factory"
|
|
@@ -125,7 +126,7 @@ module Ea
|
|
|
125
126
|
# @return [Lutaml::Uml::Document, Hash] Document, or hash with
|
|
126
127
|
# :document and :validation_result
|
|
127
128
|
# @raise [Ea::Error] if lutaml-uml is not available
|
|
128
|
-
def parse(qea_path, options = {})
|
|
129
|
+
def parse(qea_path, options = {})
|
|
129
130
|
require_uml!
|
|
130
131
|
config = options.delete(:config)
|
|
131
132
|
validate = options.delete(:validate)
|
data/lib/ea/rtf.rb
CHANGED
|
@@ -32,7 +32,7 @@ module Ea
|
|
|
32
32
|
|
|
33
33
|
# Parse the group starting at text[start] (positioned at "{").
|
|
34
34
|
# @return [Integer] index just past the group's closing brace
|
|
35
|
-
def parse_group(text, start, out, skipping:)
|
|
35
|
+
def parse_group(text, start, out, skipping:)
|
|
36
36
|
skipping ||= destination_group?(text, start)
|
|
37
37
|
idx = start + 1
|
|
38
38
|
while idx < text.length
|
|
@@ -57,7 +57,7 @@ module Ea
|
|
|
57
57
|
|
|
58
58
|
# Handle a backslash escape or control word.
|
|
59
59
|
# @return [Integer] index just past the control sequence
|
|
60
|
-
def parse_control(text, idx, out, skipping)
|
|
60
|
+
def parse_control(text, idx, out, skipping)
|
|
61
61
|
case text[idx + 1]
|
|
62
62
|
when "\\", "{", "}"
|
|
63
63
|
out << text[idx + 1] unless skipping
|
|
@@ -45,8 +45,9 @@ module Ea
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def enumeration_stereotype?(object)
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
Ea::Qea::Rules::EnumLiteral.enumeration?(
|
|
49
|
+
object.object_type, object.stereotype
|
|
50
|
+
)
|
|
50
51
|
end
|
|
51
52
|
|
|
52
53
|
# Resolves the classifier's full attribute list. Combines:
|
|
@@ -302,12 +303,7 @@ module Ea
|
|
|
302
303
|
end
|
|
303
304
|
|
|
304
305
|
def visibility_from_scope(scope)
|
|
305
|
-
|
|
306
|
-
when "Public" then "public"
|
|
307
|
-
when "Protected" then "protected"
|
|
308
|
-
when "Private" then "private"
|
|
309
|
-
else "public"
|
|
310
|
-
end
|
|
306
|
+
Ea::Qea::Rules::Visibility.canonical(scope)
|
|
311
307
|
end
|
|
312
308
|
|
|
313
309
|
def stereotype_refs_for(object)
|
|
@@ -60,12 +60,7 @@ module Ea
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def visibility_from_scope(scope)
|
|
63
|
-
|
|
64
|
-
when "Public" then "public"
|
|
65
|
-
when "Protected" then "protected"
|
|
66
|
-
when "Private" then "private"
|
|
67
|
-
else "public"
|
|
68
|
-
end
|
|
63
|
+
Ea::Qea::Rules::Visibility.canonical(scope)
|
|
69
64
|
end
|
|
70
65
|
|
|
71
66
|
def boolean(value)
|
|
@@ -108,13 +108,7 @@ module Ea
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
def visibility_from_scope(scope)
|
|
111
|
-
|
|
112
|
-
when "Public" then "public"
|
|
113
|
-
when "Protected" then "protected"
|
|
114
|
-
when "Private" then "private"
|
|
115
|
-
when "Package" then "package"
|
|
116
|
-
else "public"
|
|
117
|
-
end
|
|
111
|
+
Ea::Qea::Rules::Visibility.canonical(scope)
|
|
118
112
|
end
|
|
119
113
|
|
|
120
114
|
def stereotype_refs(row)
|
|
@@ -172,7 +172,7 @@ module Ea
|
|
|
172
172
|
WIDTH_CACHE = {}
|
|
173
173
|
|
|
174
174
|
class << self
|
|
175
|
-
def estimate_width(text, size, _width_factor = nil, family: nil,
|
|
175
|
+
def estimate_width(text, size, _width_factor = nil, family: nil,
|
|
176
176
|
weight: nil, style: nil, logical_height: nil,
|
|
177
177
|
legend_title: false)
|
|
178
178
|
opts = { family: family, weight: weight, style: style,
|
data/lib/ea/theme/loader.rb
CHANGED
|
@@ -21,7 +21,6 @@ module Ea
|
|
|
21
21
|
|
|
22
22
|
private
|
|
23
23
|
|
|
24
|
-
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
25
24
|
def from_document(doc)
|
|
26
25
|
font = doc.font || Definition::FontSpec.new
|
|
27
26
|
label_font = doc.label_font || Definition::FontSpec.new
|
|
@@ -146,7 +145,6 @@ module Ea
|
|
|
146
145
|
line_height: note_cfg.line_height || 12
|
|
147
146
|
)
|
|
148
147
|
end
|
|
149
|
-
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
|
150
148
|
end
|
|
151
149
|
end
|
|
152
150
|
end
|
|
@@ -19,13 +19,13 @@ module Ea
|
|
|
19
19
|
# association end bare when its card field is blank.
|
|
20
20
|
module Cardinality
|
|
21
21
|
# Tokens EA uses for "unbounded". Matched case-insensitively.
|
|
22
|
-
UNLIMITED_TOKENS =
|
|
22
|
+
UNLIMITED_TOKENS = Ea::Qea::Rules::Cardinality::UNLIMITED_TOKENS
|
|
23
23
|
|
|
24
24
|
# UML defaults when EA carries no explicit bound. EA's wire
|
|
25
25
|
# form for unlimited is "*" (never "-1" — the reference
|
|
26
26
|
# exports contain no value="-1" at all).
|
|
27
|
-
DEFAULT_LOWER =
|
|
28
|
-
DEFAULT_UPPER =
|
|
27
|
+
DEFAULT_LOWER = Ea::Qea::Rules::Cardinality::DEFAULT_MIN
|
|
28
|
+
DEFAULT_UPPER = Ea::Qea::Rules::Cardinality::DEFAULT_MAX
|
|
29
29
|
|
|
30
30
|
# EA writes an explicit 1..1 for a Property whose t_attribute
|
|
31
31
|
# bound columns are BOTH blank, rather than falling back to the
|
|
@@ -53,16 +53,8 @@ module Ea
|
|
|
53
53
|
# @return [Hash{Symbol=>String}] `{ lower:, upper: }` always
|
|
54
54
|
# populated; never nil. Empty/nil input returns the UML default.
|
|
55
55
|
def parse(raw)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
stripped = raw.to_s.strip
|
|
59
|
-
return parse_range(stripped) if stripped.include?("..")
|
|
60
|
-
|
|
61
|
-
# Bare unlimited token (e.g. "*") means "many" — lower bound
|
|
62
|
-
# is unspecified, which renders as 0..*.
|
|
63
|
-
return defaults if UNLIMITED_TOKENS.include?(stripped.downcase)
|
|
64
|
-
|
|
65
|
-
{ lower: stripped, upper: stripped }
|
|
56
|
+
parsed = Ea::Qea::Rules::Cardinality.parse(raw)
|
|
57
|
+
{ lower: parsed[:min], upper: parsed[:max] }
|
|
66
58
|
end
|
|
67
59
|
|
|
68
60
|
# Normalise an upper-bound token: `*` / `unbounded` → `*`
|
|
@@ -70,12 +62,7 @@ module Ea
|
|
|
70
62
|
# @param raw [String, Integer, nil]
|
|
71
63
|
# @return [String]
|
|
72
64
|
def normalize_upper(raw)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
stripped = raw.to_s.strip
|
|
76
|
-
return DEFAULT_UPPER if stripped.empty?
|
|
77
|
-
|
|
78
|
-
UNLIMITED_TOKENS.include?(stripped.downcase) ? "*" : stripped
|
|
65
|
+
Ea::Qea::Rules::Cardinality.normalize_max(raw)
|
|
79
66
|
end
|
|
80
67
|
|
|
81
68
|
# Normalise a lower-bound token: empty/nil → "0" (UML default).
|
|
@@ -84,24 +71,9 @@ module Ea
|
|
|
84
71
|
# @param raw [String, Integer, nil]
|
|
85
72
|
# @return [String]
|
|
86
73
|
def normalize_lower(raw)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
stripped = raw.to_s.strip
|
|
90
|
-
return DEFAULT_LOWER if stripped.empty?
|
|
91
|
-
|
|
92
|
-
UNLIMITED_TOKENS.include?(stripped.downcase) ? DEFAULT_LOWER : stripped
|
|
74
|
+
Ea::Qea::Rules::Cardinality.normalize_min(raw)
|
|
93
75
|
end
|
|
94
76
|
|
|
95
|
-
# ---- Internal helpers ----
|
|
96
|
-
|
|
97
|
-
def defaults
|
|
98
|
-
{ lower: DEFAULT_LOWER, upper: DEFAULT_UPPER }
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
def parse_range(stripped)
|
|
102
|
-
lower, upper = stripped.split("..", 2)
|
|
103
|
-
{ lower: normalize_lower(lower), upper: normalize_upper(upper) }
|
|
104
|
-
end
|
|
105
77
|
end
|
|
106
78
|
end
|
|
107
79
|
end
|
|
@@ -273,7 +273,7 @@ module Ea
|
|
|
273
273
|
end
|
|
274
274
|
|
|
275
275
|
def attribute_scope(attr)
|
|
276
|
-
(attr.scope
|
|
276
|
+
Ea::Qea::Rules::Visibility.extension_scope(attr.scope)
|
|
277
277
|
end
|
|
278
278
|
|
|
279
279
|
def attribute_properties(attr)
|
|
@@ -335,7 +335,7 @@ module Ea
|
|
|
335
335
|
end
|
|
336
336
|
|
|
337
337
|
def operation_scope(op)
|
|
338
|
-
(op.scope
|
|
338
|
+
Ea::Qea::Rules::Visibility.extension_scope(op.scope)
|
|
339
339
|
end
|
|
340
340
|
|
|
341
341
|
def operation_type(op)
|
data/lib/ea/version.rb
CHANGED