ea 0.1.0 → 0.1.4
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/CLAUDE.md +125 -0
- data/Rakefile +12 -4
- data/TODO.next/00-publish-blocking-bugs.md +74 -0
- data/TODO.next/01-standalone-ea-gem-identity.md +76 -0
- data/TODO.next/02-optional-lutaml-uml-dependency.md +47 -0
- data/TODO.next/03-slim-lutaml-uml.md +79 -0
- data/TODO.next/04-loader-registry-for-uml-repository.md +49 -0
- data/TODO.next/05-extract-shared-transformer-methods.md +14 -0
- data/TODO.next/06-deduplicate-stereotype-loading.md +17 -0
- data/TODO.next/07-transformer-registry-in-factory.md +20 -0
- data/TODO.next/08-connector-type-registry.md +27 -0
- data/TODO.next/09-element-renderer-registry.md +29 -0
- data/TODO.next/10-connector-renderer-lsp.md +18 -0
- data/TODO.next/11-consolidate-style-knowledge.md +33 -0
- data/TODO.next/12-data-driven-from-db-row.md +24 -0
- data/TODO.next/13-extract-duplicated-methods.md +17 -0
- data/TODO.next/14-remove-dead-code.md +10 -0
- data/TODO.next/15-narrow-exception-handling.md +39 -0
- data/TODO.next/16-repository-indexes.md +28 -0
- data/TODO.next/17-fix-spec-quality-and-coverage.md +32 -0
- data/TODO.next/18-xmi-tool-specific-parser-architecture.md +172 -0
- data/TODO.next/19-fix-ea-gemspec-dependency-declarations.md +56 -0
- data/TODO.next/20-ci-requires-unreleased-lutaml-uml.md +63 -0
- data/TODO.next/21-qeatoxmi-via-xmi-gem.md +340 -0
- data/TODO.next/22-strip-respond-to-from-qeatoxmi-specs.md +32 -0
- data/TODO.next/23-cleanup-idallocator.md +41 -0
- data/TODO.next/24-tighten-parity-specs.md +42 -0
- data/TODO.next/25-sparx-eaid-format-for-synthesized-ids.md +62 -0
- data/TODO.next/26-fix-uppervalue-lowervalue-count-gap.md +51 -0
- data/TODO.next/27-extract-cardinality-module.md +68 -0
- data/TODO.next/28-extract-xml-sanitizer.md +51 -0
- data/TODO.next/29-ocp-registry-for-classifier-builders.md +58 -0
- data/TODO.next/30-struct-return-for-association-end.md +37 -0
- data/TODO.next/31-idallocator-specs.md +27 -0
- data/TODO.next/32-phase2-gap-sentinel-specs.md +53 -0
- data/TODO.next/33-normalize-lower-cleanup.md +30 -0
- data/TODO.next/34-document-member-end-order-rt-prefix.md +29 -0
- data/TODO.next/35-walk-runstate-for-instance-slots.md +76 -0
- data/TODO.next/36-wire-interface-realization.md +50 -0
- data/TODO.next/37-visibility-returns-real-booleans.md +36 -0
- data/config/diagram_styles.yml +200 -0
- data/config/model_transformations.yml +266 -0
- data/config/qea_schema.yml +1024 -0
- data/docs/ea_to_uml_type_mapping.md +89 -0
- data/docs/xmi_qea_conversion_capabilities.md +99 -0
- data/examples/lur/20251010_current_plateau_v5.1.lur +0 -0
- data/examples/lur/basic.lur +0 -0
- data/examples/lur/test-output.lur +0 -0
- data/examples/lur/test.lur +0 -0
- data/examples/lur_basic_usage.rb +221 -0
- data/examples/lur_cli_workflow.rb +263 -0
- data/examples/lur_statistics.rb +326 -0
- data/examples/qea/20251010_current_plateau_v5.1.qea +0 -0
- data/examples/qea/ArcGISWorkspace_template.qea +0 -0
- data/examples/qea/README_qea_parser.adoc +230 -0
- data/examples/qea/UmlModel_template.qea +0 -0
- data/examples/qea/basic.qea +0 -0
- data/examples/qea/simple.qea +0 -0
- data/examples/qea/simple_example.qea +0 -0
- data/examples/qea/test.qea +0 -0
- data/examples/qea_standalone_query.rb +73 -0
- data/examples/qea_to_repository.rb +51 -0
- data/examples/smoke_test_real_qea.rb +81 -0
- data/exe/ea +7 -0
- data/lib/ea/cli/app.rb +72 -0
- data/lib/ea/cli/command/base.rb +80 -0
- data/lib/ea/cli/command/convert.rb +62 -0
- data/lib/ea/cli/command/diagrams.rb +81 -0
- data/lib/ea/cli/command/list.rb +61 -0
- data/lib/ea/cli/command/parse.rb +29 -0
- data/lib/ea/cli/command/stats.rb +20 -0
- data/lib/ea/cli/command/validate.rb +41 -0
- data/lib/ea/cli/command.rb +15 -0
- data/lib/ea/cli/error.rb +34 -0
- data/lib/ea/cli/output/formatter.rb +34 -0
- data/lib/ea/cli/output/json_formatter.rb +20 -0
- data/lib/ea/cli/output/table_formatter.rb +42 -0
- data/lib/ea/cli/output/yaml_formatter.rb +20 -0
- data/lib/ea/cli/output.rb +56 -0
- data/lib/ea/cli.rb +17 -0
- data/lib/ea/diagram/configuration.rb +379 -0
- data/lib/ea/diagram/element_renderers/base_renderer.rb +77 -0
- data/lib/ea/diagram/element_renderers/class_renderer.rb +323 -0
- data/lib/ea/diagram/element_renderers/connector_renderer.rb +41 -0
- data/lib/ea/diagram/element_renderers/package_renderer.rb +61 -0
- data/lib/ea/diagram/element_renderers.rb +43 -0
- data/lib/ea/diagram/extractor.rb +560 -0
- data/lib/ea/diagram/layout_engine.rb +170 -0
- data/lib/ea/diagram/path_builder.rb +202 -0
- data/lib/ea/diagram/style_parser.rb +42 -0
- data/lib/ea/diagram/style_resolver.rb +276 -0
- data/lib/ea/diagram/svg_renderer.rb +274 -0
- data/lib/ea/diagram/util.rb +73 -0
- data/lib/ea/diagram.rb +47 -0
- data/lib/ea/qea/benchmark.rb +210 -0
- data/lib/ea/qea/database.rb +308 -0
- data/lib/ea/qea/factory/association_builder.rb +203 -0
- data/lib/ea/qea/factory/association_transformer.rb +91 -0
- data/lib/ea/qea/factory/attribute_tag_transformer.rb +57 -0
- data/lib/ea/qea/factory/attribute_transformer.rb +93 -0
- data/lib/ea/qea/factory/base_transformer.rb +177 -0
- data/lib/ea/qea/factory/class_transformer.rb +116 -0
- data/lib/ea/qea/factory/constraint_transformer.rb +75 -0
- data/lib/ea/qea/factory/data_type_transformer.rb +77 -0
- data/lib/ea/qea/factory/diagram_transformer.rb +157 -0
- data/lib/ea/qea/factory/document_builder.rb +283 -0
- data/lib/ea/qea/factory/ea_to_uml_factory.rb +229 -0
- data/lib/ea/qea/factory/enum_transformer.rb +74 -0
- data/lib/ea/qea/factory/generalization_builder.rb +227 -0
- data/lib/ea/qea/factory/generalization_transformer.rb +98 -0
- data/lib/ea/qea/factory/instance_transformer.rb +68 -0
- data/lib/ea/qea/factory/object_property_transformer.rb +58 -0
- data/lib/ea/qea/factory/operation_transformer.rb +66 -0
- data/lib/ea/qea/factory/package_transformer.rb +145 -0
- data/lib/ea/qea/factory/reference_resolver.rb +99 -0
- data/lib/ea/qea/factory/stereotype_loader.rb +39 -0
- data/lib/ea/qea/factory/tagged_value_transformer.rb +38 -0
- data/lib/ea/qea/factory/transformer_registry.rb +80 -0
- data/lib/ea/qea/factory.rb +37 -0
- data/lib/ea/qea/file_detector.rb +178 -0
- data/lib/ea/qea/infrastructure/database_connection.rb +100 -0
- data/lib/ea/qea/infrastructure/schema_reader.rb +136 -0
- data/lib/ea/qea/infrastructure/table_reader.rb +224 -0
- data/lib/ea/qea/infrastructure.rb +12 -0
- data/lib/ea/qea/models/base_model.rb +59 -0
- data/lib/ea/qea/models/ea_attribute.rb +109 -0
- data/lib/ea/qea/models/ea_attribute_tag.rb +100 -0
- data/lib/ea/qea/models/ea_complexity_type.rb +79 -0
- data/lib/ea/qea/models/ea_connector.rb +160 -0
- data/lib/ea/qea/models/ea_connector_type.rb +60 -0
- data/lib/ea/qea/models/ea_constraint_type.rb +63 -0
- data/lib/ea/qea/models/ea_datatype.rb +104 -0
- data/lib/ea/qea/models/ea_diagram.rb +115 -0
- data/lib/ea/qea/models/ea_diagram_link.rb +78 -0
- data/lib/ea/qea/models/ea_diagram_object.rb +73 -0
- data/lib/ea/qea/models/ea_diagram_type.rb +56 -0
- data/lib/ea/qea/models/ea_document.rb +63 -0
- data/lib/ea/qea/models/ea_object.rb +223 -0
- data/lib/ea/qea/models/ea_object_constraint.rb +53 -0
- data/lib/ea/qea/models/ea_object_property.rb +87 -0
- data/lib/ea/qea/models/ea_object_type.rb +73 -0
- data/lib/ea/qea/models/ea_operation.rb +127 -0
- data/lib/ea/qea/models/ea_operation_param.rb +76 -0
- data/lib/ea/qea/models/ea_package.rb +78 -0
- data/lib/ea/qea/models/ea_script.rb +62 -0
- data/lib/ea/qea/models/ea_status_type.rb +66 -0
- data/lib/ea/qea/models/ea_stereotype.rb +57 -0
- data/lib/ea/qea/models/ea_tagged_value.rb +99 -0
- data/lib/ea/qea/models/ea_xref.rb +165 -0
- data/lib/ea/qea/models.rb +35 -0
- data/lib/ea/qea/repositories/base_repository.rb +225 -0
- data/lib/ea/qea/repositories/object_repository.rb +219 -0
- data/lib/ea/qea/repositories.rb +10 -0
- data/lib/ea/qea/services/configuration.rb +211 -0
- data/lib/ea/qea/services/database_loader.rb +191 -0
- data/lib/ea/qea/services.rb +10 -0
- data/lib/ea/qea/validation/association_validator.rb +73 -0
- data/lib/ea/qea/validation/attribute_validator.rb +91 -0
- data/lib/ea/qea/validation/base_validator.rb +331 -0
- data/lib/ea/qea/validation/class_validator.rb +121 -0
- data/lib/ea/qea/validation/database/circular_reference_validator.rb +109 -0
- data/lib/ea/qea/validation/database/orphan_validator.rb +153 -0
- data/lib/ea/qea/validation/database/referential_integrity_validator.rb +128 -0
- data/lib/ea/qea/validation/database.rb +16 -0
- data/lib/ea/qea/validation/diagram_validator.rb +112 -0
- data/lib/ea/qea/validation/formatters/json_formatter.rb +137 -0
- data/lib/ea/qea/validation/formatters/text_formatter.rb +235 -0
- data/lib/ea/qea/validation/formatters.rb +12 -0
- data/lib/ea/qea/validation/operation_validator.rb +71 -0
- data/lib/ea/qea/validation/package_validator.rb +111 -0
- data/lib/ea/qea/validation/validation_engine.rb +387 -0
- data/lib/ea/qea/validation/validation_message.rb +144 -0
- data/lib/ea/qea/validation/validation_result.rb +210 -0
- data/lib/ea/qea/validation/validator_registry.rb +134 -0
- data/lib/ea/qea/validation.rb +28 -0
- data/lib/ea/qea/verification/comparison_result.rb +264 -0
- data/lib/ea/qea/verification/document_normalizer.rb +169 -0
- data/lib/ea/qea/verification/document_verifier.rb +322 -0
- data/lib/ea/qea/verification/element_comparator.rb +277 -0
- data/lib/ea/qea/verification/structure_matcher.rb +287 -0
- data/lib/ea/qea/verification.rb +14 -0
- data/lib/ea/qea.rb +185 -0
- data/lib/ea/transformations/configuration.rb +333 -0
- data/lib/ea/transformations/format_registry.rb +366 -0
- data/lib/ea/transformations/parsers/base_parser.rb +482 -0
- data/lib/ea/transformations/parsers/qea_parser.rb +401 -0
- data/lib/ea/transformations/parsers/xmi_parser.rb +243 -0
- data/lib/ea/transformations/transformation_engine.rb +390 -0
- data/lib/ea/transformations.rb +85 -0
- data/lib/ea/transformers/qea_to_xmi/association_end.rb +19 -0
- data/lib/ea/transformers/qea_to_xmi/cardinality.rb +96 -0
- data/lib/ea/transformers/qea_to_xmi/context.rb +106 -0
- data/lib/ea/transformers/qea_to_xmi/guid_format.rb +56 -0
- data/lib/ea/transformers/qea_to_xmi/id_allocator.rb +92 -0
- data/lib/ea/transformers/qea_to_xmi/run_state.rb +107 -0
- data/lib/ea/transformers/qea_to_xmi/transformer.rb +607 -0
- data/lib/ea/transformers/qea_to_xmi/visibility.rb +73 -0
- data/lib/ea/transformers/qea_to_xmi.rb +29 -0
- data/lib/ea/transformers/uml_to_xmi/id_generator.rb +54 -0
- data/lib/ea/transformers/uml_to_xmi/transformer.rb +152 -0
- data/lib/ea/transformers/uml_to_xmi/writer.rb +96 -0
- data/lib/ea/transformers/uml_to_xmi.rb +16 -0
- data/lib/ea/transformers.rb +34 -0
- data/lib/ea/version.rb +1 -1
- data/lib/ea/xmi/liquid_drops/association_drop.rb +56 -0
- data/lib/ea/xmi/liquid_drops/attribute_drop.rb +72 -0
- data/lib/ea/xmi/liquid_drops/cardinality_drop.rb +35 -0
- data/lib/ea/xmi/liquid_drops/connector_drop.rb +54 -0
- data/lib/ea/xmi/liquid_drops/constraint_drop.rb +29 -0
- data/lib/ea/xmi/liquid_drops/data_type_drop.rb +63 -0
- data/lib/ea/xmi/liquid_drops/dependency_drop.rb +36 -0
- data/lib/ea/xmi/liquid_drops/diagram_drop.rb +34 -0
- data/lib/ea/xmi/liquid_drops/enum_drop.rb +49 -0
- data/lib/ea/xmi/liquid_drops/enum_owned_literal_drop.rb +25 -0
- data/lib/ea/xmi/liquid_drops/generalization_attribute_drop.rb +87 -0
- data/lib/ea/xmi/liquid_drops/generalization_drop.rb +127 -0
- data/lib/ea/xmi/liquid_drops/klass_drop.rb +191 -0
- data/lib/ea/xmi/liquid_drops/operation_drop.rb +29 -0
- data/lib/ea/xmi/liquid_drops/package_drop.rb +108 -0
- data/lib/ea/xmi/liquid_drops/root_drop.rb +34 -0
- data/lib/ea/xmi/liquid_drops/source_target_drop.rb +43 -0
- data/lib/ea/xmi/lookup_service.rb +89 -0
- data/lib/ea/xmi/parser.rb +919 -0
- data/lib/ea/xmi.rb +35 -0
- data/lib/ea.rb +10 -1
- metadata +382 -9
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Xmi
|
|
5
|
+
module LiquidDrops
|
|
6
|
+
class DataTypeDrop < Liquid::Drop
|
|
7
|
+
def initialize(model, options = {}) # rubocop:disable Lint/MissingSuper
|
|
8
|
+
@model = model
|
|
9
|
+
@options = options
|
|
10
|
+
@lookup = options[:lookup]
|
|
11
|
+
@xmi_root_model = options[:xmi_root_model]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def xmi_id
|
|
15
|
+
@model.xmi_id
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def name
|
|
19
|
+
@model.name
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def attributes
|
|
23
|
+
Array(@model.attributes).filter_map do |owned_attr|
|
|
24
|
+
if @options[:with_assoc] || owned_attr.association.nil?
|
|
25
|
+
::Ea::Xmi::LiquidDrops::AttributeDrop.new(owned_attr,
|
|
26
|
+
@options)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def operations
|
|
32
|
+
Array(@model.operations).map do |operation|
|
|
33
|
+
::Ea::Xmi::LiquidDrops::OperationDrop.new(operation)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def associations
|
|
38
|
+
Array(@model.associations).filter_map do |assoc|
|
|
39
|
+
::Ea::Xmi::LiquidDrops::AssociationDrop.new(assoc, @options)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def constraints
|
|
44
|
+
Array(@model.constraints).map do |constraint|
|
|
45
|
+
::Ea::Xmi::LiquidDrops::ConstraintDrop.new(constraint)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def is_abstract # rubocop:disable Naming/PredicateName,Naming/PredicatePrefix
|
|
50
|
+
@model.is_abstract
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def definition
|
|
54
|
+
@model.definition
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def stereotype
|
|
58
|
+
@model.stereotype&.first
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Xmi
|
|
5
|
+
module LiquidDrops
|
|
6
|
+
class DependencyDrop < Liquid::Drop
|
|
7
|
+
def initialize(model, options = {}) # rubocop:disable Lint/MissingSuper
|
|
8
|
+
@model = model
|
|
9
|
+
@options = options
|
|
10
|
+
@lookup = options[:lookup]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def id
|
|
14
|
+
@model.id
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def name
|
|
18
|
+
@model.name
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def ea_type
|
|
22
|
+
@model&.properties&.ea_type
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def documentation
|
|
26
|
+
@model&.documentation&.value
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def connector
|
|
30
|
+
connector = @lookup.fetch_connector(@model.id)
|
|
31
|
+
::Ea::Xmi::LiquidDrops::ConnectorDrop.new(connector, @options)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Xmi
|
|
5
|
+
module LiquidDrops
|
|
6
|
+
class DiagramDrop < Liquid::Drop
|
|
7
|
+
def initialize(model, options = {}) # rubocop:disable Lint/MissingSuper
|
|
8
|
+
@model = model
|
|
9
|
+
@options = options
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def xmi_id
|
|
13
|
+
@model.xmi_id
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def name
|
|
17
|
+
@model.name
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def definition
|
|
21
|
+
@model.definition
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def package_id
|
|
25
|
+
@model.package_id if @options[:with_gen]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def package_name
|
|
29
|
+
@model.package_name if @options[:with_gen]
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Xmi
|
|
5
|
+
module LiquidDrops
|
|
6
|
+
class EnumDrop < Liquid::Drop
|
|
7
|
+
def initialize(model, options = {}) # rubocop:disable Lint/MissingSuper
|
|
8
|
+
@model = model
|
|
9
|
+
@options = options
|
|
10
|
+
@lookup = options[:lookup]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def xmi_id
|
|
14
|
+
@model.xmi_id
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def name
|
|
18
|
+
@model.name
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def values
|
|
22
|
+
Array(@model.values).map do |value|
|
|
23
|
+
::Ea::Xmi::LiquidDrops::EnumOwnedLiteralDrop.new(value)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def definition
|
|
28
|
+
@model.definition
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def stereotype
|
|
32
|
+
@model.stereotype&.first
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# @return name of the upper packaged element
|
|
36
|
+
def upper_packaged_element
|
|
37
|
+
if @options[:with_gen]
|
|
38
|
+
e = @lookup.find_upper_level_packaged_element(@model.xmi_id)
|
|
39
|
+
e&.name
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def subtype_of
|
|
44
|
+
@lookup.find_subtype_of_from_owned_attribute_type(@model.xmi_id)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Xmi
|
|
5
|
+
module LiquidDrops
|
|
6
|
+
class EnumOwnedLiteralDrop < Liquid::Drop
|
|
7
|
+
def initialize(model) # rubocop:disable Lint/MissingSuper
|
|
8
|
+
@model = model
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def name
|
|
12
|
+
@model.name
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def type
|
|
16
|
+
@model.type
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def definition
|
|
20
|
+
@model.definition
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Xmi
|
|
5
|
+
module LiquidDrops
|
|
6
|
+
class GeneralizationAttributeDrop < Liquid::Drop
|
|
7
|
+
def initialize(attr, upper_klass, gen_name, guidance = nil) # rubocop:disable Lint/MissingSuper,Metrics/ParameterLists,Layout/LineLength
|
|
8
|
+
@attr = attr
|
|
9
|
+
@upper_klass = upper_klass
|
|
10
|
+
@gen_name = gen_name
|
|
11
|
+
@guidance = guidance
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def id
|
|
15
|
+
@attr.id
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def name
|
|
19
|
+
@attr.name
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def type
|
|
23
|
+
@attr.type
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def xmi_id
|
|
27
|
+
@attr.xmi_id
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def is_derived # rubocop:disable Naming/PredicateName,Naming/PredicatePrefix
|
|
31
|
+
@attr.is_derived
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def cardinality
|
|
35
|
+
::Ea::Xmi::LiquidDrops::CardinalityDrop.new(@attr.cardinality)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def definition
|
|
39
|
+
@attr.definition
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def association
|
|
43
|
+
@attr.association
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def has_association?
|
|
47
|
+
!!@attr.association
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def type_ns
|
|
51
|
+
@attr.type_ns
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def upper_klass
|
|
55
|
+
@upper_klass
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def gen_name
|
|
59
|
+
@gen_name
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def name_ns
|
|
63
|
+
@attr.name_ns
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def used?
|
|
67
|
+
if @guidance
|
|
68
|
+
col_name = "#{name_ns}:#{name}"
|
|
69
|
+
attr = @guidance["attributes"].find { |a| a["name"] == col_name }
|
|
70
|
+
return attr["used"].to_s if attr
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
"true"
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def guidance
|
|
77
|
+
if @guidance
|
|
78
|
+
col_name = "#{name_ns}:#{name}"
|
|
79
|
+
attr = @guidance["attributes"].find { |a| a["name"] == col_name }
|
|
80
|
+
|
|
81
|
+
attr["guidance"] if attr
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Xmi
|
|
5
|
+
module LiquidDrops
|
|
6
|
+
class GeneralizationDrop < Liquid::Drop
|
|
7
|
+
def initialize(gen, guidance = nil, options = {}) # rubocop:disable Lint/MissingSuper
|
|
8
|
+
@gen = gen
|
|
9
|
+
@guidance = guidance
|
|
10
|
+
@options = options
|
|
11
|
+
@xmi_root_model = options[:xmi_root_model]
|
|
12
|
+
@id_name_mapping = options[:id_name_mapping]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def id
|
|
16
|
+
@gen.general_id
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def name
|
|
20
|
+
@gen.general_name
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def upper_klass
|
|
24
|
+
@gen.general_upper_klass
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def general
|
|
28
|
+
if @gen.general
|
|
29
|
+
GeneralizationDrop.new(@gen.general, @guidance, @options)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def has_general?
|
|
34
|
+
!@gen.general.nil?
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def attributes
|
|
38
|
+
@gen.general_attributes
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def type
|
|
42
|
+
@gen.type
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def definition
|
|
46
|
+
@gen.definition
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def stereotype
|
|
50
|
+
@gen.stereotype
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# get attributes without association
|
|
54
|
+
def owned_props(sort: false)
|
|
55
|
+
return [] unless @gen.owned_props
|
|
56
|
+
|
|
57
|
+
props = @gen.owned_props
|
|
58
|
+
props = sort_props(props) if sort
|
|
59
|
+
props_to_liquid(props)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# get attributes with association
|
|
63
|
+
def assoc_props(sort: false)
|
|
64
|
+
return [] unless @gen.assoc_props
|
|
65
|
+
|
|
66
|
+
props = @gen.assoc_props
|
|
67
|
+
props = sort_props(props) if sort
|
|
68
|
+
props_to_liquid(props)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def props_to_liquid(props)
|
|
72
|
+
props.map do |attr|
|
|
73
|
+
GeneralizationAttributeDrop.new(attr, attr.upper_klass,
|
|
74
|
+
attr.gen_name, @guidance)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# get items without association by looping through the generation
|
|
79
|
+
def inherited_props(sort: false)
|
|
80
|
+
return [] unless @gen.inherited_props
|
|
81
|
+
|
|
82
|
+
props = @gen.inherited_props
|
|
83
|
+
props = sort_props_with_level(props) if sort
|
|
84
|
+
props_to_liquid(props)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# get items with association by looping through the generation
|
|
88
|
+
def inherited_assoc_props(sort: false)
|
|
89
|
+
return [] unless @gen.inherited_assoc_props
|
|
90
|
+
|
|
91
|
+
props = @gen.inherited_assoc_props
|
|
92
|
+
props = sort_props_with_level(props) if sort
|
|
93
|
+
props_to_liquid(props)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def sort_props_with_level(arr)
|
|
97
|
+
return [] if arr.nil? || arr.empty?
|
|
98
|
+
|
|
99
|
+
# level desc, name_ns asc, name asc
|
|
100
|
+
arr.sort_by { |i| [-i.level, i.name_ns.to_s, i.name.to_s] }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def sorted_owned_props
|
|
104
|
+
owned_props(sort: true)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def sorted_assoc_props
|
|
108
|
+
assoc_props(sort: true)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def sorted_inherited_props
|
|
112
|
+
inherited_props(sort: true)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def sorted_inherited_assoc_props
|
|
116
|
+
inherited_assoc_props(sort: true)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def sort_props(arr)
|
|
120
|
+
return [] if arr.nil? || arr.empty?
|
|
121
|
+
|
|
122
|
+
arr.sort_by { |i| [i.name_ns.to_s, i.name.to_s] }
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Xmi
|
|
5
|
+
module LiquidDrops
|
|
6
|
+
class KlassDrop < Liquid::Drop
|
|
7
|
+
def initialize(model, guidance = nil, options = {}) # rubocop:disable Lint/MissingSuper
|
|
8
|
+
@model = model
|
|
9
|
+
@guidance = guidance
|
|
10
|
+
@options = options
|
|
11
|
+
@lookup = options[:lookup]
|
|
12
|
+
@xmi_root_model = options[:xmi_root_model]
|
|
13
|
+
@id_name_mapping = options[:id_name_mapping]
|
|
14
|
+
|
|
15
|
+
init_xmi_dependencies if @xmi_root_model
|
|
16
|
+
init_guidance(guidance) if guidance
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def xmi_id
|
|
20
|
+
@model.xmi_id
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def name
|
|
24
|
+
@model.name
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def absolute_path
|
|
28
|
+
absolute_path_arr = [@model.name]
|
|
29
|
+
e = @lookup.find_upper_level_packaged_element(@model.xmi_id)
|
|
30
|
+
absolute_path_arr << e.name if e
|
|
31
|
+
|
|
32
|
+
while e
|
|
33
|
+
e = @lookup.find_upper_level_packaged_element(e.id)
|
|
34
|
+
absolute_path_arr << e.name if e
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
absolute_path_arr << "::#{@xmi_root_model.model.name}"
|
|
38
|
+
absolute_path_arr.reverse.join("::")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
def init_xmi_dependencies
|
|
44
|
+
@clients_dependencies = @lookup.select_dependencies_by_supplier(@model.xmi_id)
|
|
45
|
+
@suppliers_dependencies = @lookup.select_dependencies_by_client(@model.xmi_id)
|
|
46
|
+
|
|
47
|
+
matched_element = @lookup.find_matched_element(@model.xmi_id)
|
|
48
|
+
@inheritance_ids = extract_inheritance_ids(matched_element)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def init_guidance(guidance)
|
|
52
|
+
@klass_guidance = guidance["classes"].find do |klass|
|
|
53
|
+
klass["name"] == name || klass["name"] == absolute_path
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def extract_inheritance_ids(matched_element)
|
|
58
|
+
return [] unless matched_element
|
|
59
|
+
|
|
60
|
+
links = matched_element.links
|
|
61
|
+
return [] unless links
|
|
62
|
+
|
|
63
|
+
links.flat_map do |link|
|
|
64
|
+
link.generalization
|
|
65
|
+
.select { |gen| gen.end == @model.xmi_id }
|
|
66
|
+
.map(&:id)
|
|
67
|
+
end.compact
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
public
|
|
71
|
+
|
|
72
|
+
def package
|
|
73
|
+
xmi_pkg = find_nested_xmi_package
|
|
74
|
+
return unless xmi_pkg
|
|
75
|
+
|
|
76
|
+
::Ea::Xmi::LiquidDrops::PackageDrop.new(
|
|
77
|
+
build_uml_package(xmi_pkg),
|
|
78
|
+
@guidance,
|
|
79
|
+
@options.merge(absolute_path: "#{@options[:absolute_path]}::#{name}"),
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def find_nested_xmi_package
|
|
84
|
+
nested_pkg = @lookup.find_packaged_element_by_id(@model.xmi_id)
|
|
85
|
+
return unless nested_pkg
|
|
86
|
+
|
|
87
|
+
nested_pkg.packaged_element&.find { |e| e.type?("uml:Package") }
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def build_uml_package(xmi_pkg)
|
|
91
|
+
uml_pkg = ::Lutaml::Uml::Package.new
|
|
92
|
+
uml_pkg.xmi_id = xmi_pkg.id
|
|
93
|
+
uml_pkg.name = @lookup.get_package_name(xmi_pkg)
|
|
94
|
+
uml_pkg
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def type
|
|
98
|
+
@model.type
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def attributes
|
|
102
|
+
Array(@model.attributes).filter_map do |owned_attr|
|
|
103
|
+
if @options[:with_assoc] || owned_attr.association.nil?
|
|
104
|
+
::Ea::Xmi::LiquidDrops::AttributeDrop.new(owned_attr,
|
|
105
|
+
@options)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def owned_attributes
|
|
111
|
+
Array(@model.attributes).filter_map do |owned_attr|
|
|
112
|
+
::Ea::Xmi::LiquidDrops::AttributeDrop.new(owned_attr, @options)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def suppliers_dependencies
|
|
117
|
+
Array(@suppliers_dependencies).filter_map do |dependency|
|
|
118
|
+
::Ea::Xmi::LiquidDrops::DependencyDrop.new(dependency, @options)
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def clients_dependencies
|
|
123
|
+
Array(@clients_dependencies).filter_map do |dependency|
|
|
124
|
+
::Ea::Xmi::LiquidDrops::DependencyDrop.new(dependency, @options)
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def inheritances
|
|
129
|
+
Array(@inheritance_ids).filter_map do |inheritance_id|
|
|
130
|
+
connector = @lookup.fetch_connector(inheritance_id)
|
|
131
|
+
::Ea::Xmi::LiquidDrops::ConnectorDrop.new(connector, @options)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def associations
|
|
136
|
+
Array(@model.associations).filter_map do |assoc|
|
|
137
|
+
::Ea::Xmi::LiquidDrops::AssociationDrop.new(assoc, @options)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def operations
|
|
142
|
+
Array(@model.operations).map do |operation|
|
|
143
|
+
::Ea::Xmi::LiquidDrops::OperationDrop.new(operation)
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def constraints
|
|
148
|
+
Array(@model.constraints).map do |constraint|
|
|
149
|
+
::Ea::Xmi::LiquidDrops::ConstraintDrop.new(constraint)
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def generalization
|
|
154
|
+
if @options[:with_gen] && @model.generalization
|
|
155
|
+
::Ea::Xmi::LiquidDrops::GeneralizationDrop.new(
|
|
156
|
+
@model.generalization, @klass_guidance, @options
|
|
157
|
+
)
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def upper_packaged_element
|
|
162
|
+
if @options[:with_gen]
|
|
163
|
+
e = @lookup.find_upper_level_packaged_element(@model.xmi_id)
|
|
164
|
+
e&.name
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def subtype_of
|
|
169
|
+
@lookup.find_subtype_of_from_generalization(@model.xmi_id) ||
|
|
170
|
+
@lookup.find_subtype_of_from_owned_attribute_type(@model.xmi_id)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def has_guidance?
|
|
174
|
+
!!@klass_guidance
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def is_abstract # rubocop:disable Naming/PredicateName,Naming/PredicatePrefix
|
|
178
|
+
@model.is_abstract
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def definition
|
|
182
|
+
@model.definition
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def stereotype
|
|
186
|
+
@model.stereotype&.first
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Xmi
|
|
5
|
+
module LiquidDrops
|
|
6
|
+
class OperationDrop < Liquid::Drop
|
|
7
|
+
def initialize(model) # rubocop:disable Lint/MissingSuper
|
|
8
|
+
@model = model
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def id
|
|
12
|
+
@model.id
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def xmi_id
|
|
16
|
+
@model.xmi_id
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def name
|
|
20
|
+
@model.name
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def definition
|
|
24
|
+
@model.definition
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|