Search in sources :

Example 1 with Root_meta_pure_model_unit_ResolvedModelUnit

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

the class SchemaToModelGenerator method toPureModelContextData.

private PureModelContextData toPureModelContextData(Root_meta_external_shared_format_binding_Binding binding) {
    PureModelContextData.Builder builder = PureModelContextData.newBuilder().withSerializer(new Protocol("pure", pureVersion));
    Root_meta_pure_model_unit_ResolvedModelUnit resolved = core_pure_model_modelUnit.Root_meta_pure_model_unit_resolve_ModelUnit_1__ResolvedModelUnit_1_(binding._modelUnit(), pureModel.getExecutionSupport());
    LazyIterate.collect(resolved._packageableElements(), e -> {
        if (e instanceof org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class) {
            return transformClass((org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class<?>) e);
        } else if (e instanceof org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Association) {
            return transformAssociation((org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Association) e);
        } else if (e instanceof org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enumeration) {
            return transformEnumeration((org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enumeration<?>) e);
        } else {
            return null;
        }
    }).select(Objects::nonNull).forEach(builder::addElement);
    builder.addElement(transformBinding(binding));
    return builder.build();
}
Also used : Root_meta_pure_model_unit_ResolvedModelUnit(org.finos.legend.pure.generated.Root_meta_pure_model_unit_ResolvedModelUnit) Protocol(org.finos.legend.engine.protocol.Protocol) PureModelContextData(org.finos.legend.engine.protocol.pure.v1.model.context.PureModelContextData)

Aggregations

Protocol (org.finos.legend.engine.protocol.Protocol)1 PureModelContextData (org.finos.legend.engine.protocol.pure.v1.model.context.PureModelContextData)1 Root_meta_pure_model_unit_ResolvedModelUnit (org.finos.legend.pure.generated.Root_meta_pure_model_unit_ResolvedModelUnit)1