Search in sources :

Example 1 with Root_meta_pure_model_unit_ModelUnit

use of org.finos.legend.pure.generated.Root_meta_pure_model_unit_ModelUnit in project legend-engine by finos.

the class BindingCompiler method secondPass.

// Second pass - resolve schemas and model elements
private void secondPass(Binding srcBinding, CompileContext context) {
    String path = context.pureModel.buildPackageString(srcBinding._package, srcBinding.name);
    Root_meta_external_shared_format_binding_Binding compiled = bindingIndex.get(path);
    compiled._contentType(srcBinding.contentType);
    if (srcBinding.schemaSet != null) {
        Root_meta_external_shared_format_metamodel_SchemaSet schemaSet = HelperExternalFormat.getSchemaSet(srcBinding.schemaSet, srcBinding.sourceInformation, context);
        if (srcBinding.schemaId != null && schemaSet._schemas().noneSatisfy(s -> srcBinding.schemaId.equals(s._id()))) {
            throw new EngineException("ID '" + srcBinding.schemaId + "' does not exist in SchemaSet '" + srcBinding.schemaSet + "'", srcBinding.sourceInformation, EngineErrorType.COMPILATION);
        }
        compiled._schemaSet(schemaSet)._schemaId(srcBinding.schemaId);
    }
    Root_meta_pure_model_unit_ModelUnit modelUnit = new Root_meta_pure_model_unit_ModelUnit_Impl("")._classifierGenericType(new Root_meta_pure_metamodel_type_generics_GenericType_Impl("")._rawType(context.pureModel.getType("meta::pure::model::unit::ModelUnit")))._packageableElementIncludes(ListIterate.collect(srcBinding.modelUnit.packageableElementIncludes, pe -> context.pureModel.getPackageableElement(pe, srcBinding.sourceInformation)))._packageableElementExcludes(ListIterate.collect(srcBinding.modelUnit.packageableElementExcludes, pe -> context.pureModel.getPackageableElement(pe, srcBinding.sourceInformation)));
    compiled._modelUnit(modelUnit);
}
Also used : Root_meta_external_shared_format_binding_validation_FailedBindingDetail(org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_validation_FailedBindingDetail) Root_meta_pure_metamodel_type_generics_GenericType_Impl(org.finos.legend.pure.generated.Root_meta_pure_metamodel_type_generics_GenericType_Impl) ExternalFormatExtension(org.finos.legend.engine.external.shared.format.model.ExternalFormatExtension) EngineErrorType(org.finos.legend.engine.protocol.pure.v1.model.context.EngineErrorType) Root_meta_external_shared_format_metamodel_SchemaSet(org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaSet) ListIterate(org.eclipse.collections.impl.utility.ListIterate) Root_meta_pure_model_unit_ModelUnit(org.finos.legend.pure.generated.Root_meta_pure_model_unit_ModelUnit) Root_meta_external_shared_format_binding_Binding(org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_Binding) Root_meta_pure_model_unit_ModelUnit_Impl(org.finos.legend.pure.generated.Root_meta_pure_model_unit_ModelUnit_Impl) Binding(org.finos.legend.engine.protocol.pure.v1.packageableElement.external.shared.Binding) Maps(org.eclipse.collections.api.factory.Maps) Root_meta_external_shared_format_binding_validation_BindingDetail(org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_validation_BindingDetail) ExternalFormatSchemaSet(org.finos.legend.engine.protocol.pure.v1.packageableElement.external.shared.ExternalFormatSchemaSet) MutableMap(org.eclipse.collections.api.map.MutableMap) PackageableElement(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PackageableElement) Processor(org.finos.legend.engine.language.pure.compiler.toPureGraph.extension.Processor) Map(java.util.Map) EngineException(org.finos.legend.engine.shared.core.operational.errorManagement.EngineException) Root_meta_external_shared_format_binding_Binding_Impl(org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_Binding_Impl) Collections(java.util.Collections) Root_meta_pure_model_unit_ModelUnit(org.finos.legend.pure.generated.Root_meta_pure_model_unit_ModelUnit) Root_meta_external_shared_format_binding_Binding(org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_Binding) Root_meta_pure_metamodel_type_generics_GenericType_Impl(org.finos.legend.pure.generated.Root_meta_pure_metamodel_type_generics_GenericType_Impl) EngineException(org.finos.legend.engine.shared.core.operational.errorManagement.EngineException) Root_meta_external_shared_format_metamodel_SchemaSet(org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaSet) Root_meta_pure_model_unit_ModelUnit_Impl(org.finos.legend.pure.generated.Root_meta_pure_model_unit_ModelUnit_Impl)

Aggregations

Collections (java.util.Collections)1 Map (java.util.Map)1 Maps (org.eclipse.collections.api.factory.Maps)1 MutableMap (org.eclipse.collections.api.map.MutableMap)1 ListIterate (org.eclipse.collections.impl.utility.ListIterate)1 ExternalFormatExtension (org.finos.legend.engine.external.shared.format.model.ExternalFormatExtension)1 Processor (org.finos.legend.engine.language.pure.compiler.toPureGraph.extension.Processor)1 EngineErrorType (org.finos.legend.engine.protocol.pure.v1.model.context.EngineErrorType)1 Binding (org.finos.legend.engine.protocol.pure.v1.packageableElement.external.shared.Binding)1 ExternalFormatSchemaSet (org.finos.legend.engine.protocol.pure.v1.packageableElement.external.shared.ExternalFormatSchemaSet)1 EngineException (org.finos.legend.engine.shared.core.operational.errorManagement.EngineException)1 Root_meta_external_shared_format_binding_Binding (org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_Binding)1 Root_meta_external_shared_format_binding_Binding_Impl (org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_Binding_Impl)1 Root_meta_external_shared_format_binding_validation_BindingDetail (org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_validation_BindingDetail)1 Root_meta_external_shared_format_binding_validation_FailedBindingDetail (org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_validation_FailedBindingDetail)1 Root_meta_external_shared_format_metamodel_SchemaSet (org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaSet)1 Root_meta_pure_metamodel_type_generics_GenericType_Impl (org.finos.legend.pure.generated.Root_meta_pure_metamodel_type_generics_GenericType_Impl)1 Root_meta_pure_model_unit_ModelUnit (org.finos.legend.pure.generated.Root_meta_pure_model_unit_ModelUnit)1 Root_meta_pure_model_unit_ModelUnit_Impl (org.finos.legend.pure.generated.Root_meta_pure_model_unit_ModelUnit_Impl)1 PackageableElement (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PackageableElement)1