use of org.finos.legend.pure.m3.coreinstance.meta.relational.runtime.PostProcessorWithParameter in project legend-engine by finos.
the class RelationalCompilerExtension method getExtraConnectionPostProcessor.
@Override
public List<Function2<PostProcessor, CompileContext, Pair<Root_meta_pure_alloy_connections_PostProcessor, PostProcessorWithParameter>>> getExtraConnectionPostProcessor() {
return Lists.mutable.with((processor, context) -> {
if (processor instanceof MapperPostProcessor) {
MapperPostProcessor mapper = (MapperPostProcessor) processor;
Root_meta_pure_alloy_connections_MapperPostProcessor p = HelperRelationalDatabaseConnectionBuilder.createMapperPostProcessor(mapper);
PostProcessorWithParameter f = core_relational_relational_runtime_connection_postprocessor.Root_meta_pure_alloy_connections_tableMapperPostProcessor_MapperPostProcessor_1__PostProcessorWithParameter_1_(p, context.pureModel.getExecutionSupport());
return Tuples.pair(p, f);
}
return null;
});
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.runtime.PostProcessorWithParameter in project legend-engine by finos.
the class RelationalCompilerExtension method getExtraConnectionValueProcessors.
@Override
public List<Function2<Connection, CompileContext, org.finos.legend.pure.m3.coreinstance.meta.pure.runtime.Connection>> getExtraConnectionValueProcessors() {
return Lists.mutable.with((connectionValue, context) -> {
if (connectionValue instanceof RelationalDatabaseConnection) {
RelationalDatabaseConnection relationalDatabaseConnection = (RelationalDatabaseConnection) connectionValue;
Root_meta_pure_alloy_connections_RelationalDatabaseConnection relational = new Root_meta_pure_alloy_connections_RelationalDatabaseConnection_Impl("");
HelperRelationalDatabaseConnectionBuilder.addDatabaseConnectionProperties(relational, relationalDatabaseConnection.element, relationalDatabaseConnection.elementSourceInformation, relationalDatabaseConnection.type.name(), relationalDatabaseConnection.timeZone, relationalDatabaseConnection.quoteIdentifiers, context);
List<IRelationalCompilerExtension> extensions = IRelationalCompilerExtension.getExtensions(context);
Root_meta_pure_alloy_connections_alloy_authentication_AuthenticationStrategy authenticationStrategy = IRelationalCompilerExtension.process(relationalDatabaseConnection.authenticationStrategy, ListIterate.flatCollect(extensions, IRelationalCompilerExtension::getExtraAuthenticationStrategyProcessors), context);
Root_meta_pure_alloy_connections_alloy_specification_DatasourceSpecification datasource = IRelationalCompilerExtension.process(relationalDatabaseConnection.datasourceSpecification, ListIterate.flatCollect(extensions, IRelationalCompilerExtension::getExtraDataSourceSpecificationProcessors), context);
List<PostProcessor> postProcessors = relationalDatabaseConnection.postProcessors == null ? FastList.newList() : relationalDatabaseConnection.postProcessors;
MutableList<Pair<Root_meta_pure_alloy_connections_PostProcessor, PostProcessorWithParameter>> pp = ListIterate.collect(postProcessors, p -> IRelationalCompilerExtension.process(p, ListIterate.flatCollect(extensions, IRelationalCompilerExtension::getExtraConnectionPostProcessor), context));
// we currently need to add both as __queryPostProcessorsWithParameter is used for plan generation
// and _postProcessors is used for serialization of plan to protocol
relational._datasourceSpecification(datasource);
relational._authenticationStrategy(authenticationStrategy);
List<PostProcessorWithParameter> postProcessorWithParameters = ListIterate.collect(relationalDatabaseConnection.postProcessorWithParameter, p -> IRelationalCompilerExtension.process(p, ListIterate.flatCollect(extensions, IRelationalCompilerExtension::getExtraLegacyPostProcessors), context));
List<PostProcessorWithParameter> translatedForPlanGeneration = ListIterate.collect(pp, Pair::getTwo);
relational._queryPostProcessorsWithParameter(Lists.mutable.withAll(postProcessorWithParameters).withAll(translatedForPlanGeneration));
relational._postProcessors(ListIterate.collect(pp, Pair::getOne));
return relational;
}
return null;
});
}
Aggregations