Search in sources :

Example 1 with PostProcessorWithParameter

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;
    });
}
Also used : PostProcessorWithParameter(org.finos.legend.pure.m3.coreinstance.meta.relational.runtime.PostProcessorWithParameter) MapperPostProcessor(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.postprocessor.MapperPostProcessor)

Example 2 with PostProcessorWithParameter

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;
    });
}
Also used : PostProcessorWithParameter(org.finos.legend.pure.m3.coreinstance.meta.relational.runtime.PostProcessorWithParameter) RelationalDatabaseConnection(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.RelationalDatabaseConnection) PostProcessor(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.postprocessor.PostProcessor) MapperPostProcessor(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.postprocessor.MapperPostProcessor) Pair(org.eclipse.collections.api.tuple.Pair)

Aggregations

MapperPostProcessor (org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.postprocessor.MapperPostProcessor)2 PostProcessorWithParameter (org.finos.legend.pure.m3.coreinstance.meta.relational.runtime.PostProcessorWithParameter)2 Pair (org.eclipse.collections.api.tuple.Pair)1 RelationalDatabaseConnection (org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.RelationalDatabaseConnection)1 PostProcessor (org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.postprocessor.PostProcessor)1