Search in sources :

Example 1 with IdBuilder

use of org.finos.legend.pure.runtime.java.compiled.generation.processors.IdBuilder in project legend-pure by finos.

the class TestDistributedBinaryGraphSerialization method getExpectedObjsFromRuntime.

private ListIterable<Obj> getExpectedObjsFromRuntime(String metadataName) {
    MutableSet<CoreInstance> ignoredClassifiers = PrimitiveUtilities.getPrimitiveTypes(repository).toSet();
    ArrayAdapter.adapt(M3Paths.EnumStub, M3Paths.ImportStub, M3Paths.PropertyStub, M3Paths.RouteNodePropertyStub).collect(processorSupport::package_getByUserPath, ignoredClassifiers);
    IdBuilder idBuilder = IdBuilder.newIdBuilder(DistributedMetadataHelper.getMetadataIdPrefix(metadataName), processorSupport);
    GraphSerializer.ClassifierCaches classifierCaches = new GraphSerializer.ClassifierCaches(processorSupport);
    return GraphNodeIterable.fromModelRepository(repository).reject(i -> ignoredClassifiers.contains(i.getClassifier())).collect(i -> GraphSerializer.buildObj(i, idBuilder, classifierCaches, processorSupport), Lists.mutable.empty());
}
Also used : GraphNodeIterable(org.finos.legend.pure.m4.tools.GraphNodeIterable) ArrayAdapter(org.eclipse.collections.impl.list.fixed.ArrayAdapter) BeforeClass(org.junit.BeforeClass) AbstractPureTestWithCoreCompiled(org.finos.legend.pure.m3.AbstractPureTestWithCoreCompiled) Lists(org.eclipse.collections.api.factory.Lists) IdBuilder(org.finos.legend.pure.runtime.java.compiled.generation.processors.IdBuilder) Test(org.junit.Test) IOException(java.io.IOException) CoreInstance(org.finos.legend.pure.m4.coreinstance.CoreInstance) MutableList(org.eclipse.collections.api.list.MutableList) Obj(org.finos.legend.pure.runtime.java.compiled.serialization.model.Obj) Function(java.util.function.Function) M3Paths(org.finos.legend.pure.m3.navigation.M3Paths) MutableSet(org.eclipse.collections.api.set.MutableSet) ListMultimap(org.eclipse.collections.api.multimap.list.ListMultimap) GraphSerializer(org.finos.legend.pure.runtime.java.compiled.serialization.GraphSerializer) PrimitiveUtilities(org.finos.legend.pure.m3.navigation.PrimitiveUtilities) ListIterable(org.eclipse.collections.api.list.ListIterable) Assert(org.junit.Assert) GraphSerializer(org.finos.legend.pure.runtime.java.compiled.serialization.GraphSerializer) IdBuilder(org.finos.legend.pure.runtime.java.compiled.generation.processors.IdBuilder) CoreInstance(org.finos.legend.pure.m4.coreinstance.CoreInstance)

Example 2 with IdBuilder

use of org.finos.legend.pure.runtime.java.compiled.generation.processors.IdBuilder in project legend-pure by finos.

the class MetadataEager method invalidateCoreInstances.

@Deprecated
public void invalidateCoreInstances(RichIterable<? extends CoreInstance> instances, ProcessorSupport processorSupport) {
    IdBuilder idBuilder = IdBuilder.newIdBuilder(processorSupport);
    for (CoreInstance coreInstance : instances) {
        String identifier = idBuilder.buildId(coreInstance);
        String classifier = MetadataJavaPaths.buildMetadataKeyFromType(coreInstance.getClassifier()).intern();
        CoreInstance pack = coreInstance.getValueForMetaPropertyToOne(M3Properties._package);
        if (pack != null) {
            String packIdentifier = idBuilder.buildId(pack);
            String packClassifier = MetadataJavaPaths.buildMetadataKeyFromType(pack.getClassifier()).intern();
            this.getMetamodel().remove(classifier, identifier, packClassifier, packIdentifier);
        }
    }
}
Also used : IdBuilder(org.finos.legend.pure.runtime.java.compiled.generation.processors.IdBuilder) CoreInstance(org.finos.legend.pure.m4.coreinstance.CoreInstance) ReflectiveCoreInstance(org.finos.legend.pure.runtime.java.compiled.generation.processors.support.coreinstance.ReflectiveCoreInstance)

Aggregations

CoreInstance (org.finos.legend.pure.m4.coreinstance.CoreInstance)2 IdBuilder (org.finos.legend.pure.runtime.java.compiled.generation.processors.IdBuilder)2 IOException (java.io.IOException)1 Function (java.util.function.Function)1 Lists (org.eclipse.collections.api.factory.Lists)1 ListIterable (org.eclipse.collections.api.list.ListIterable)1 MutableList (org.eclipse.collections.api.list.MutableList)1 ListMultimap (org.eclipse.collections.api.multimap.list.ListMultimap)1 MutableSet (org.eclipse.collections.api.set.MutableSet)1 ArrayAdapter (org.eclipse.collections.impl.list.fixed.ArrayAdapter)1 AbstractPureTestWithCoreCompiled (org.finos.legend.pure.m3.AbstractPureTestWithCoreCompiled)1 M3Paths (org.finos.legend.pure.m3.navigation.M3Paths)1 PrimitiveUtilities (org.finos.legend.pure.m3.navigation.PrimitiveUtilities)1 GraphNodeIterable (org.finos.legend.pure.m4.tools.GraphNodeIterable)1 ReflectiveCoreInstance (org.finos.legend.pure.runtime.java.compiled.generation.processors.support.coreinstance.ReflectiveCoreInstance)1 GraphSerializer (org.finos.legend.pure.runtime.java.compiled.serialization.GraphSerializer)1 Obj (org.finos.legend.pure.runtime.java.compiled.serialization.model.Obj)1 Assert (org.junit.Assert)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1