Search in sources :

Example 1 with Root_meta_external_shared_format_metamodel_SchemaSet_Impl

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

the class SchemaSetCompiler method firstPass.

// First pass - create and index schemas
private PackageableElement firstPass(ExternalFormatSchemaSet srcSchemaSet, CompileContext context) {
    if (externalFormatExtensions.get(srcSchemaSet.format) == null) {
        throw new EngineException("Unknown schema format: " + srcSchemaSet.format, srcSchemaSet.formatSourceInformation, EngineErrorType.COMPILATION);
    }
    Root_meta_external_shared_format_metamodel_SchemaSet schemaSet = new Root_meta_external_shared_format_metamodel_SchemaSet_Impl(srcSchemaSet.name)._name(srcSchemaSet.name)._classifierGenericType(new Root_meta_pure_metamodel_type_generics_GenericType_Impl("")._rawType(context.pureModel.getType("meta::external::shared::format::metamodel::SchemaSet")))._format(srcSchemaSet.format);
    Set<String> ids = Sets.mutable.empty();
    Set<String> locations = Sets.mutable.empty();
    for (ExternalFormatSchema srcSchema : srcSchemaSet.schemas) {
        if (srcSchema.id != null) {
            if (!ids.add(srcSchema.id)) {
                throw new EngineException("Schema id '" + srcSchema.id + "' is duplicated", srcSchema.sourceInformation, EngineErrorType.COMPILATION);
            }
        }
        if (srcSchema.location != null) {
            if (!locations.add(srcSchema.location)) {
                throw new EngineException("Schema location '" + srcSchema.location + "' is duplicated", srcSchema.sourceInformation, EngineErrorType.COMPILATION);
            }
        }
        Root_meta_external_shared_format_metamodel_Schema schema = new Root_meta_external_shared_format_metamodel_Schema_Impl("")._id(srcSchema.id)._location(srcSchema.location);
        schemaSet._schemasAdd(schema);
    }
    String path = context.pureModel.buildPackageString(srcSchemaSet._package, srcSchemaSet.name);
    this.schemaSetIndex.put(path, schemaSet);
    return schemaSet;
}
Also used : ExternalFormatSchema(org.finos.legend.engine.protocol.pure.v1.packageableElement.external.shared.ExternalFormatSchema) 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_Schema(org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_Schema) Root_meta_external_shared_format_metamodel_SchemaSet(org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaSet) Root_meta_external_shared_format_metamodel_SchemaSet_Impl(org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaSet_Impl) Root_meta_external_shared_format_metamodel_Schema_Impl(org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_Schema_Impl)

Aggregations

ExternalFormatSchema (org.finos.legend.engine.protocol.pure.v1.packageableElement.external.shared.ExternalFormatSchema)1 EngineException (org.finos.legend.engine.shared.core.operational.errorManagement.EngineException)1 Root_meta_external_shared_format_metamodel_Schema (org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_Schema)1 Root_meta_external_shared_format_metamodel_SchemaSet (org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaSet)1 Root_meta_external_shared_format_metamodel_SchemaSet_Impl (org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaSet_Impl)1 Root_meta_external_shared_format_metamodel_Schema_Impl (org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_Schema_Impl)1 Root_meta_pure_metamodel_type_generics_GenericType_Impl (org.finos.legend.pure.generated.Root_meta_pure_metamodel_type_generics_GenericType_Impl)1