ea 0.6.177 → 0.6.178
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/lazy_drops/qea_lookup.rb +29 -14
- data/lib/ea/qea/lazy_drops.rb +55 -3
- data/lib/ea/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 33721c4a6706ca5ed8c43f9f73ecfa0a1fdd83294a259f880c0b95b1c5ffd2fb
|
|
4
|
+
data.tar.gz: b3880c8d7ed52f051476795b417ca9891c5cdf829d17728b7aae7c6a706da06f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1e536f9a683b1370df3c3f1100d1cc54a4f0d96876e3baab517c7f343ec9b32044e7ba8e54cf5e3c93a91b853e018ac735a2084596b12a056d2a48c88d9d7e0
|
|
7
|
+
data.tar.gz: 3a57d6ed29830e351f0f7e2cb097122b4ecbb2a24d90e08585112d37f6517897aa24f43d2c2cfca4d74500301e9d70c36ce3b0b6a2f2f9151766dc6a2343ee07
|
|
@@ -22,12 +22,16 @@ module Ea
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
Endpoint = Struct.new(:idref, keyword_init: true)
|
|
26
|
-
|
|
27
25
|
# Read-only dependency reference exposing the name/client/
|
|
28
26
|
# supplier surface DependencyDrop consumes.
|
|
29
27
|
DependencyRef = Struct.new(:name, :client, :supplier, keyword_init: true)
|
|
30
28
|
|
|
29
|
+
# Chain-iterable package reference for KlassDrop#absolute_path:
|
|
30
|
+
# each hop exposes the id the next hop resolves plus the name
|
|
31
|
+
# the path accumulates, mirroring the Sparx packaged-element
|
|
32
|
+
# wrapper the XMI-shaped LookupService returns.
|
|
33
|
+
ParentElement = Struct.new(:id, :name, keyword_init: true)
|
|
34
|
+
|
|
31
35
|
def initialize(database)
|
|
32
36
|
@database = database
|
|
33
37
|
@names = nil
|
|
@@ -42,13 +46,17 @@ module Ea
|
|
|
42
46
|
names[xmi_id]
|
|
43
47
|
end
|
|
44
48
|
|
|
45
|
-
# The
|
|
49
|
+
# The package directly containing the element, as a
|
|
50
|
+
# chain-iterable reference: KlassDrop#absolute_path feeds the
|
|
51
|
+
# returned id back in to walk the full package ancestry.
|
|
46
52
|
def find_upper_level_packaged_element(klass_id)
|
|
47
|
-
|
|
48
|
-
return
|
|
53
|
+
package = parent_package_of(klass_id)
|
|
54
|
+
return nil unless package&.ea_guid
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
ParentElement.new(
|
|
57
|
+
id: Ea::GuidFormat.ea_guid_to_xmi_id(package.ea_guid),
|
|
58
|
+
name: package.name
|
|
59
|
+
)
|
|
52
60
|
end
|
|
53
61
|
|
|
54
62
|
def find_packaged_element_by_id(_id)
|
|
@@ -67,6 +75,16 @@ module Ea
|
|
|
67
75
|
package&.name
|
|
68
76
|
end
|
|
69
77
|
|
|
78
|
+
def parent_package_of(id)
|
|
79
|
+
object = object_by_xmi_id(id)
|
|
80
|
+
if object
|
|
81
|
+
database.find_package(object.package_id)
|
|
82
|
+
else
|
|
83
|
+
package = package_by_xmi_id(id)
|
|
84
|
+
package && database.find_package(package.parent_id)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
70
88
|
# Sparx-shaped connector reference for the drop surface.
|
|
71
89
|
def fetch_connector(link_id)
|
|
72
90
|
conn = database.connectors.find do |c|
|
|
@@ -148,6 +166,10 @@ module Ea
|
|
|
148
166
|
self
|
|
149
167
|
end
|
|
150
168
|
|
|
169
|
+
def object_by_xmi_id(xmi_id)
|
|
170
|
+
database.find_object_by_guid(Ea::GuidFormat.xmi_id_to_ea_guid(xmi_id))
|
|
171
|
+
end
|
|
172
|
+
|
|
151
173
|
private
|
|
152
174
|
|
|
153
175
|
attr_reader :database
|
|
@@ -169,13 +191,6 @@ module Ea
|
|
|
169
191
|
end
|
|
170
192
|
end
|
|
171
193
|
|
|
172
|
-
def object_by_xmi_id(xmi_id)
|
|
173
|
-
database.objects.all.find do |object|
|
|
174
|
-
object.ea_guid &&
|
|
175
|
-
Ea::GuidFormat.ea_guid_to_xmi_id(object.ea_guid) == xmi_id
|
|
176
|
-
end
|
|
177
|
-
end
|
|
178
|
-
|
|
179
194
|
def package_by_xmi_id(xmi_id)
|
|
180
195
|
database.packages.find do |package|
|
|
181
196
|
package.ea_guid &&
|
data/lib/ea/qea/lazy_drops.rb
CHANGED
|
@@ -108,11 +108,14 @@ module Ea
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
# The drop-options contract shared by every drop: the QEA
|
|
111
|
-
# lookup answers the cross-reference surface;
|
|
112
|
-
#
|
|
111
|
+
# lookup answers the cross-reference surface; the root-model
|
|
112
|
+
# stand-in carries the EA XMI export root name so
|
|
113
|
+
# KlassDrop#absolute_path reproduces the path shape the
|
|
114
|
+
# guidance files pin classes by.
|
|
113
115
|
def drop_options
|
|
114
116
|
{
|
|
115
117
|
lookup: lookup,
|
|
118
|
+
xmi_root_model: RootModelFacade.new,
|
|
116
119
|
with_gen: true,
|
|
117
120
|
with_absolute_path: true
|
|
118
121
|
}
|
|
@@ -303,11 +306,15 @@ module Ea
|
|
|
303
306
|
|
|
304
307
|
# Stand-in for the xmi gem's root model: the klass-table cache
|
|
305
308
|
# reads only its model name (to strip a leading path segment).
|
|
309
|
+
# The name must match the EA XMI export convention ("EA_Model"),
|
|
310
|
+
# because guidance files pin classes by the absolute path the
|
|
311
|
+
# XMI-shaped drops produce - e.g.
|
|
312
|
+
# "::EA_Model::Model::CityGML::Building::Building".
|
|
306
313
|
class RootModelFacade
|
|
307
314
|
Model = Struct.new(:name, keyword_init: true)
|
|
308
315
|
|
|
309
316
|
def model
|
|
310
|
-
Model.new(name: "
|
|
317
|
+
Model.new(name: "EA_Model")
|
|
311
318
|
end
|
|
312
319
|
end
|
|
313
320
|
|
|
@@ -378,6 +385,10 @@ module Ea
|
|
|
378
385
|
class IndexShim
|
|
379
386
|
Record = Struct.new(:id, :name, :type, keyword_init: true)
|
|
380
387
|
|
|
388
|
+
MatchedElement = Struct.new(:id, :links, keyword_init: true)
|
|
389
|
+
LinksRef = Struct.new(:generalization, keyword_init: true)
|
|
390
|
+
GeneralizationRef = Struct.new(:id, :start, :end, keyword_init: true)
|
|
391
|
+
|
|
381
392
|
def initialize(context)
|
|
382
393
|
@context = context
|
|
383
394
|
@by_type = nil
|
|
@@ -398,6 +409,34 @@ module Ea
|
|
|
398
409
|
parents[id]
|
|
399
410
|
end
|
|
400
411
|
|
|
412
|
+
# The links-bearing element record LookupService#find_matched_element
|
|
413
|
+
# consumes: KlassDrop#extract_inheritance_ids walks links.generalization
|
|
414
|
+
# entries (id / start / end) and keeps those whose end is the model
|
|
415
|
+
# itself, mirroring the xmi:Extension element-entry <links> shape where
|
|
416
|
+
# each entry restates every relation touching the element with
|
|
417
|
+
# start = child, end = parent.
|
|
418
|
+
def find_element(xmi_id)
|
|
419
|
+
object = @context.lookup.object_by_xmi_id(xmi_id)
|
|
420
|
+
return nil unless object
|
|
421
|
+
|
|
422
|
+
generalizations =
|
|
423
|
+
@context.database.connectors_for_object(object.ea_object_id)
|
|
424
|
+
.filter_map do |conn|
|
|
425
|
+
next unless conn.connector_type == "Generalization"
|
|
426
|
+
|
|
427
|
+
GeneralizationRef.new(
|
|
428
|
+
id: xmi_id_for_guid(conn.ea_guid),
|
|
429
|
+
start: object_xmi_id_for(conn.start_object_id),
|
|
430
|
+
end: object_xmi_id_for(conn.end_object_id)
|
|
431
|
+
)
|
|
432
|
+
end
|
|
433
|
+
.compact
|
|
434
|
+
MatchedElement.new(
|
|
435
|
+
id: xmi_id,
|
|
436
|
+
links: [LinksRef.new(generalization: generalizations)]
|
|
437
|
+
)
|
|
438
|
+
end
|
|
439
|
+
|
|
401
440
|
private
|
|
402
441
|
|
|
403
442
|
def by_type
|
|
@@ -451,6 +490,19 @@ module Ea
|
|
|
451
490
|
map
|
|
452
491
|
end
|
|
453
492
|
end
|
|
493
|
+
|
|
494
|
+
def xmi_id_for_guid(guid)
|
|
495
|
+
return nil unless guid
|
|
496
|
+
|
|
497
|
+
Ea::GuidFormat.ea_guid_to_xmi_id(guid)
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
def object_xmi_id_for(ea_object_id)
|
|
501
|
+
object = ea_object_id && @context.database.find_object(ea_object_id)
|
|
502
|
+
return nil unless object&.ea_guid
|
|
503
|
+
|
|
504
|
+
Ea::GuidFormat.ea_guid_to_xmi_id(object.ea_guid)
|
|
505
|
+
end
|
|
454
506
|
end
|
|
455
507
|
|
|
456
508
|
# xmi_id -> Lutaml::Uml object, constructed on first access.
|
data/lib/ea/version.rb
CHANGED