From bed83e1f1d448fb1869d33a01336e9b8732fc38e Mon Sep 17 00:00:00 2001 From: mrudula-gs <89876341+mrudula-gs@users.noreply.github.com> Date: Tue, 7 May 2024 16:14:40 -0500 Subject: [PATCH] Port Relational Mapper Post processor protocol change to v1_33_0 (#2834) * Update metamodel_relational.pure * Update connection_relational.pure --- .../v1_33_0/models/metamodel_relational.pure | 39 ++++++++++++++++++- .../transfers/connection_relational.pure | 12 +++--- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/protocols/pure/v1_33_0/models/metamodel_relational.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/protocols/pure/v1_33_0/models/metamodel_relational.pure index 5c37736b853..81655db0a5c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/protocols/pure/v1_33_0/models/metamodel_relational.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/protocols/pure/v1_33_0/models/metamodel_relational.pure @@ -323,6 +323,13 @@ Class meta::protocols::pure::v1_33_0::metamodel::store::relational::element::Tab } +Class meta::protocols::pure::v1_33_0::metamodel::store::relational::element::SchemaPtr extends meta::protocols::pure::v1_33_0::metamodel::store::relational::element::RelationalElement +{ + database : String[1]; + schema : String[1]; + mainTableDb: String[1]; +} + Class meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::Mapper { _type: String[1]; @@ -330,11 +337,41 @@ Class meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcesso to: String[1]; } +Class meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::RelationalMapper +{ + databaseMappers : meta::protocols::pure::v1_33_0::metamodel::store::relational::DatabaseMapper[*]; + schemaMappers : meta::protocols::pure::v1_33_0::metamodel::store::relational::SchemaMapper[*]; + tableMappers : meta::protocols::pure::v1_33_0::metamodel::store::relational::TableMapper[*]; +} + +Class meta::protocols::pure::v1_33_0::metamodel::store::relational::DatabaseMapper +{ + database : String[1]; + schemas: meta::protocols::pure::v1_33_0::metamodel::store::relational::Schema[*]; +} + +Class meta::protocols::pure::v1_33_0::metamodel::store::relational::SchemaMapper +{ + from : meta::protocols::pure::v1_33_0::metamodel::store::relational::Schema[1]; + to : String[1]; +} + +Class meta::protocols::pure::v1_33_0::metamodel::store::relational::TableMapper +{ + from : meta::protocols::pure::v1_33_0::metamodel::store::relational::Table[1]; + to : String[1]; +} + Class <> meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::MapperPostProcessor extends meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::PostProcessor { mappers: meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::Mapper[*]; } +Class <> meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::RelationalMapperPostProcessor extends meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::PostProcessor +{ + relationalMappers: String[*]; +} + Class meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::TableNameMapper extends meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::Mapper { schema: meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::SchemaNameMapper[1]; } @@ -354,4 +391,4 @@ Class meta::protocols::pure::v1_33_0::metamodel::store::relational::SchemaNameMa { in:String[1]; out:String[1]; -} \ No newline at end of file +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/protocols/pure/v1_33_0/transfers/connection_relational.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/protocols/pure/v1_33_0/transfers/connection_relational.pure index b82380e84ab..9c2cb27723c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/protocols/pure/v1_33_0/transfers/connection_relational.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/protocols/pure/v1_33_0/transfers/connection_relational.pure @@ -70,13 +70,11 @@ function meta::protocols::pure::v1_33_0::transformation::fromPureGraph::connecti function meta::protocols::pure::v1_33_0::transformation::fromPureGraph::connection::transformPostProcessors(processors:meta::pure::alloy::connections::PostProcessor[*], extensions:meta::pure::extension::Extension[*]):meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::PostProcessor[*] { - $processors->map(processor | - $processor->match([ - m:meta::pure::alloy::connections::MapperPostProcessor[1] | ^meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::MapperPostProcessor( - _type = 'mapper', - mappers = transformPostProcessorMappers($m.mappers)) - ]->concatenate($extensions.serializerExtension('v1_33_0')->cast(@meta::protocols::pure::v1_33_0::extension::SerializerExtension_v1_33_0).moduleSerializerExtension('relational')->cast(@meta::protocols::pure::v1_33_0::extension::RelationalModuleSerializerExtension).transfers_connection_transformPostProcessors)->toOneMany()) - ); + $processors->map(processor | $processor->match([ + m:meta::pure::alloy::connections::MapperPostProcessor[1] | ^meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::MapperPostProcessor(_type = 'mapper', mappers = transformPostProcessorMappers($m.mappers)), + rm:meta::pure::alloy::connections::RelationalMapperPostProcessor[1] | ^meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::RelationalMapperPostProcessor(_type = 'relationalMapper', relationalMappers = $rm.relationalMappers->map(relationalMapper | $relationalMapper->elementToPath())) + ]->concatenate($extensions.serializerExtension('v1_33_0')->cast(@meta::protocols::pure::v1_33_0::extension::SerializerExtension_v1_33_0).moduleSerializerExtension('relational')->cast(@meta::protocols::pure::v1_33_0::extension::RelationalModuleSerializerExtension).transfers_connection_transformPostProcessors)->toOneMany()) + ); } function meta::protocols::pure::v1_33_0::transformation::fromPureGraph::connection::transformPostProcessorMappers(mappers:meta::pure::alloy::connections::Mapper[*]):meta::protocols::pure::v1_33_0::metamodel::store::relational::postProcessor::Mapper[*]