ea 0.6.185 → 0.6.186
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/qea/factory/base_transformer.rb +2 -2
- data/lib/ea/qea/lazy_drops.rb +1 -1
- data/lib/ea/rules/attribute_order.rb +17 -0
- data/lib/ea/rules/note_text.rb +20 -0
- data/lib/ea/rules/tree_order.rb +19 -0
- data/lib/ea/rules.rb +3 -0
- data/lib/ea/transformers/qea_to_xmi/context.rb +1 -1
- data/lib/ea/transformers/qea_to_xmi/extension_serializer.rb +26 -0
- data/lib/ea/transformers/qea_to_xmi/transformer.rb +3 -2
- data/lib/ea/version.rb +1 -1
- data/lib/ea/xmi/parser.rb +9 -5
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cacf919413ae91ba202828c165a512115d3f91f53875b75a5f3849cd07904137
|
|
4
|
+
data.tar.gz: 5f92d12219fed38a957586d1fb9301913a5b8830ae83b979ef26a9e7be293180
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81b7c69fdfd57a6986e0ed07ae1b0c6cad2a6700b7cb78610e9a1c1ab861ed5c641a2a124309e8664c26bae373edf6ab861125d67921c6699aa93d44d82e55cb
|
|
7
|
+
data.tar.gz: 73291ab9c5e0601f8c64a26533a01798bf3378fe0b6776378b2a21b74e0b5f28bdb35adad31dc1faefd8dd1c082e95a78e20bd0ffdba5cbb5647fb54fc28712c
|
|
@@ -100,7 +100,7 @@ module Ea
|
|
|
100
100
|
# @param text [String, nil] RTF or plain note text
|
|
101
101
|
# @return [String, nil] plain text with Unix line endings
|
|
102
102
|
def normalize_note(text)
|
|
103
|
-
|
|
103
|
+
Ea::Rules::NoteText.normalize(text)
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
# Find object by ID
|
|
@@ -130,7 +130,7 @@ module Ea
|
|
|
130
130
|
return [] if object_id.nil?
|
|
131
131
|
|
|
132
132
|
ea_attributes = database.attributes_for_object(object_id)
|
|
133
|
-
.sort_by { |a|
|
|
133
|
+
.sort_by { |a| Ea::Rules::AttributeOrder.key(a) }
|
|
134
134
|
AttributeTransformer.new(database).transform_collection(ea_attributes)
|
|
135
135
|
end
|
|
136
136
|
|
data/lib/ea/qea/lazy_drops.rb
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Rules
|
|
5
|
+
# EA lists an element's attributes by position and, where two share one,
|
|
6
|
+
# by name; its XMI export writes them in that order.
|
|
7
|
+
module AttributeOrder
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
# @param attribute [Ea::Qea::Models::EaAttribute] an attribute row
|
|
11
|
+
# @return [Array(Integer, String)] the attribute's sort key
|
|
12
|
+
def key(attribute)
|
|
13
|
+
[attribute.pos || 0, attribute.name.to_s.downcase]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Rules
|
|
5
|
+
# Plain text from an EA note field (RTF when styled, plain otherwise),
|
|
6
|
+
# with Unix line endings and no surrounding whitespace, which is how a
|
|
7
|
+
# definition reaches a table whichever route read the model.
|
|
8
|
+
module NoteText
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
# @param text [String, nil] an EA note or a documentation value
|
|
12
|
+
# @return [String, nil] plain text
|
|
13
|
+
def normalize(text)
|
|
14
|
+
return nil if text.nil?
|
|
15
|
+
|
|
16
|
+
Ea::Rtf.to_text(text).gsub("\r\n", "\n").strip
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Rules
|
|
5
|
+
# EA's project-tree order: positioned elements by tree position, the
|
|
6
|
+
# unpositioned ones first and alphabetically by name. The XMI export
|
|
7
|
+
# follows it, so it decides which of two same-named elements a lookup
|
|
8
|
+
# offers first.
|
|
9
|
+
module TreeOrder
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
# @param element [Models::EaObject, Models::EaPackage] a tree-placed row
|
|
13
|
+
# @return [Array(Integer, String)] the element's sort key
|
|
14
|
+
def key(element)
|
|
15
|
+
[element.sort_position, element.name.to_s.downcase]
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/ea/rules.rb
CHANGED
|
@@ -4,7 +4,10 @@ module Ea
|
|
|
4
4
|
# EA-domain semantic rules shared across input formats (QEA rows and
|
|
5
5
|
# Sparx XMI). Format-specific traversal lives in Qea::Rules.
|
|
6
6
|
module Rules
|
|
7
|
+
autoload :AttributeOrder, "ea/rules/attribute_order"
|
|
7
8
|
autoload :GeneralAttributeMapping, "ea/rules/general_attribute_mapping"
|
|
8
9
|
autoload :Namespacing, "ea/rules/namespacing"
|
|
10
|
+
autoload :NoteText, "ea/rules/note_text"
|
|
11
|
+
autoload :TreeOrder, "ea/rules/tree_order"
|
|
9
12
|
end
|
|
10
13
|
end
|
|
@@ -115,7 +115,7 @@ module Ea
|
|
|
115
115
|
# @param records [Array<Ea::Qea::Models::BaseModel>]
|
|
116
116
|
# @return [Array<Ea::Qea::Models::BaseModel>]
|
|
117
117
|
def sorted_by_position(records)
|
|
118
|
-
records.sort_by { |record|
|
|
118
|
+
records.sort_by { |record| Ea::Rules::TreeOrder.key(record) }
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
# Connectors where the object is on either side.
|
|
@@ -100,11 +100,37 @@ module Ea
|
|
|
100
100
|
xrefs_xml("\t\t\t", obj.ea_guid, "element property"),
|
|
101
101
|
attributes_block_for(obj),
|
|
102
102
|
operations_block_for(obj),
|
|
103
|
+
links_block_for(obj),
|
|
103
104
|
"\t\t</element>"
|
|
104
105
|
]
|
|
105
106
|
lines.join("\n")
|
|
106
107
|
end
|
|
107
108
|
|
|
109
|
+
# ---- <links> section --------------------------------------------
|
|
110
|
+
|
|
111
|
+
# One <links> block per element listing the Association
|
|
112
|
+
# connectors that touch it. The XMI route rebuilds a drop's
|
|
113
|
+
# association roles from these links: the id names the <connector>
|
|
114
|
+
# entry that carries the role names, cards and definitions.
|
|
115
|
+
def links_block_for(obj)
|
|
116
|
+
connectors = association_links_for(obj)
|
|
117
|
+
return "" if connectors.empty?
|
|
118
|
+
|
|
119
|
+
inner = connectors.map do |conn|
|
|
120
|
+
%(\t\t\t\t<Association xmi:id="#{@context.xmi_id_for(conn)}" ) +
|
|
121
|
+
%(start="#{@context.xmi_id_for(@database.find_object(conn.start_object_id))}" ) +
|
|
122
|
+
%(end="#{@context.xmi_id_for(@database.find_object(conn.end_object_id))}"/>)
|
|
123
|
+
end.join("\n")
|
|
124
|
+
"\t\t\t<links>\n#{inner}\n\t\t\t</links>"
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def association_links_for(obj)
|
|
128
|
+
(@database.collections[:connectors] || []).select do |conn|
|
|
129
|
+
conn.connector_type == "Association" && conn.ea_guid &&
|
|
130
|
+
[conn.start_object_id, conn.end_object_id].include?(obj.ea_object_id)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
108
134
|
# EA object types that are diagram-only annotations or internal
|
|
109
135
|
# plumbing — they don't get a standalone <element> entry.
|
|
110
136
|
SKIP_OBJECT_TYPES = %w[Note Text ProxyConnector Boundary].freeze
|
|
@@ -185,7 +185,7 @@ module Ea
|
|
|
185
185
|
def root_packages
|
|
186
186
|
@database.packages
|
|
187
187
|
.select(&:root?)
|
|
188
|
-
.sort_by { |p|
|
|
188
|
+
.sort_by { |p| Ea::Rules::TreeOrder.key(p) }
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
# MDG stereotype definitions to include in the model tree.
|
|
@@ -435,6 +435,7 @@ module Ea
|
|
|
435
435
|
id: @context.xmi_id_for(obj),
|
|
436
436
|
name: obj.name,
|
|
437
437
|
visibility: Visibility.from_scope(obj.scope),
|
|
438
|
+
generalization: generalizations_for(obj),
|
|
438
439
|
owned_attribute: attributes_for(obj),
|
|
439
440
|
owned_operation: operations_for(obj)
|
|
440
441
|
)
|
|
@@ -767,7 +768,7 @@ module Ea
|
|
|
767
768
|
def buildable_objects_in(pkg)
|
|
768
769
|
@context.objects_in_package(pkg.package_id)
|
|
769
770
|
.reject { |o| note?(o) || package_object?(o) }
|
|
770
|
-
.sort_by { |o| [
|
|
771
|
+
.sort_by { |o| [*Ea::Rules::TreeOrder.key(o), o.ea_object_id] }
|
|
771
772
|
end
|
|
772
773
|
|
|
773
774
|
# Children nested under a classifier via t_object.ParentID.
|
data/lib/ea/version.rb
CHANGED
data/lib/ea/xmi/parser.rb
CHANGED
|
@@ -171,23 +171,26 @@ module Ea
|
|
|
171
171
|
doc_node = fetch_element(node_id)
|
|
172
172
|
return unless doc_node
|
|
173
173
|
|
|
174
|
-
doc_node.properties&.public_send(
|
|
174
|
+
value = doc_node.properties&.public_send(
|
|
175
175
|
Lutaml::Model::Utils.snake_case(attr_name).to_sym
|
|
176
176
|
)
|
|
177
|
+
return Ea::Rules::NoteText.normalize(value) if attr_name.to_s == "documentation"
|
|
178
|
+
|
|
179
|
+
value
|
|
177
180
|
end
|
|
178
181
|
|
|
179
182
|
def lookup_attribute_documentation(xmi_id)
|
|
180
183
|
attribute_node = fetch_attribute_node(xmi_id)
|
|
181
184
|
return unless attribute_node&.documentation
|
|
182
185
|
|
|
183
|
-
attribute_node.documentation.value
|
|
186
|
+
Ea::Rules::NoteText.normalize(attribute_node.documentation.value)
|
|
184
187
|
end
|
|
185
188
|
|
|
186
189
|
def lookup_element_prop_documentation(xmi_id)
|
|
187
190
|
element_node = xmi_index.find_element(xmi_id)
|
|
188
191
|
return unless element_node&.properties
|
|
189
192
|
|
|
190
|
-
element_node.properties.documentation
|
|
193
|
+
Ea::Rules::NoteText.normalize(element_node.properties.documentation)
|
|
191
194
|
end
|
|
192
195
|
|
|
193
196
|
def lookup_entity_name(xmi_id)
|
|
@@ -717,9 +720,10 @@ module Ea
|
|
|
717
720
|
end
|
|
718
721
|
|
|
719
722
|
def get_uml_general_attribute_definition(attr)
|
|
720
|
-
|
|
723
|
+
definition = Ea::Rules::NoteText.normalize(attr.definition)
|
|
724
|
+
return definition unless attr.association
|
|
721
725
|
|
|
722
|
-
|
|
726
|
+
definition ||
|
|
723
727
|
lookup_assoc_def(attr.association) ||
|
|
724
728
|
lookup_connector_def_by_associationclass(attr.association)
|
|
725
729
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ea
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.186
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -452,8 +452,11 @@ files:
|
|
|
452
452
|
- lib/ea/render/image_converter.rb
|
|
453
453
|
- lib/ea/rtf.rb
|
|
454
454
|
- lib/ea/rules.rb
|
|
455
|
+
- lib/ea/rules/attribute_order.rb
|
|
455
456
|
- lib/ea/rules/general_attribute_mapping.rb
|
|
456
457
|
- lib/ea/rules/namespacing.rb
|
|
458
|
+
- lib/ea/rules/note_text.rb
|
|
459
|
+
- lib/ea/rules/tree_order.rb
|
|
457
460
|
- lib/ea/shapescript.rb
|
|
458
461
|
- lib/ea/shapescript/parser.rb
|
|
459
462
|
- lib/ea/shapescript/renderer.rb
|