use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Profile in project legend-engine by finos.
the class DomainParseTreeWalker method visitProfile.
// ----------------------------------------------- PROFILE -----------------------------------------------
private Profile visitProfile(DomainParserGrammar.ProfileContext ctx) {
Profile profile = new Profile();
profile.name = PureGrammarParserUtility.fromIdentifier(ctx.qualifiedName().identifier());
profile._package = ctx.qualifiedName().packagePath() == null ? "" : PureGrammarParserUtility.fromPath(ctx.qualifiedName().packagePath().identifier());
profile.stereotypes = ctx.stereotypeDefinitions() == null ? Lists.mutable.empty() : ListIterate.collect(ctx.stereotypeDefinitions().identifier(), PureGrammarParserUtility::fromIdentifier);
profile.tags = ctx.tagDefinitions() == null ? Lists.mutable.empty() : ListIterate.collect(ctx.tagDefinitions().identifier(), PureGrammarParserUtility::fromIdentifier);
profile.sourceInformation = this.walkerSourceInformation.getSourceInformation(ctx);
return profile;
}
use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Profile in project legend-engine by finos.
the class QueryStoreManager method documentToQuery.
private static Query documentToQuery(Document document) {
Query query = new Query();
query.id = document.getString("id");
query.name = document.getString("name");
query.description = document.getString("description");
query.groupId = document.getString("groupId");
query.artifactId = document.getString("artifactId");
query.versionId = document.getString("versionId");
query.mapping = document.getString("mapping");
query.runtime = document.getString("runtime");
query.content = document.getString("content");
query.owner = document.getString("owner");
if (document.get("taggedValues") != null) {
query.taggedValues = ListIterate.collect(document.getList("taggedValues", Document.class), _doc -> {
TaggedValue taggedValue = new TaggedValue();
taggedValue.tag = new TagPtr();
taggedValue.tag.profile = _doc.getEmbedded(Lists.fixedSize.of("tag", "profile"), String.class);
taggedValue.tag.value = _doc.getEmbedded(Lists.fixedSize.of("tag", "value"), String.class);
taggedValue.value = _doc.getString("value");
return taggedValue;
});
}
if (document.get("stereotypes") != null) {
query.stereotypes = ListIterate.collect(document.getList("stereotypes", Document.class), _doc -> {
StereotypePtr stereotypePtr = new StereotypePtr();
stereotypePtr.profile = _doc.getString("profile");
stereotypePtr.value = _doc.getString("value");
return stereotypePtr;
});
}
return query;
}
use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Profile in project legend-engine by finos.
the class TestQueryStoreManager method createTestTaggedValue.
private static TaggedValue createTestTaggedValue(String profile, String tag, String value) {
TaggedValue taggedValue = new TaggedValue();
taggedValue.tag = new TagPtr();
taggedValue.tag.profile = profile;
taggedValue.tag.value = tag;
taggedValue.value = value;
return taggedValue;
}
use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Profile in project legend-engine by finos.
the class TestQueryStoreManager method createTestStereotype.
private static StereotypePtr createTestStereotype(String profile, String stereotype) {
StereotypePtr taggedValue = new StereotypePtr();
taggedValue.profile = profile;
taggedValue.value = stereotype;
return taggedValue;
}
use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Profile in project legend-engine by finos.
the class PureModelContextDataGenerator method generatePureModelContextDataFromProfile.
public static PureModelContextData generatePureModelContextDataFromProfile(RichIterable<org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Profile> pureProfiles, String pureVersion, CompiledExecutionSupport compiledExecutionSupport) throws RuntimeException {
Method transformMethod = profileTransforms.getIfAbsentPut(pureVersion, () -> {
try {
if ("vX_X_X".equals(pureVersion) || PureClientVersions.versionAGreaterThanOrEqualsVersionB(pureVersion, "v1_18_0")) {
return java.lang.Class.forName("org.finos.legend.pure.generated.core_pure_protocol_" + pureVersion + "_transfers_metamodel").getMethod("Root_meta_protocols_pure_" + pureVersion + "_transformation_fromPureGraph_transformProfile_Profile_1__RouterExtension_MANY__Profile_1_", org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Profile.class, RichIterable.class, ExecutionSupport.class);
} else {
return loadTransClass(pureVersion).getMethod("Root_meta_protocols_pure_" + pureVersion + "_transformation_fromPureGraph_transformProfile_Profile_1__RouterExtension_MANY__Profile_1_", org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Profile.class, ExecutionSupport.class);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
});
PureModelContextData.Builder builder = PureModelContextData.newBuilder();
pureProfiles.forEach(f -> {
try {
Object profile;
if ("vX_X_X".equals(pureVersion) || PureClientVersions.versionAGreaterThanOrEqualsVersionB(pureVersion, "v1_18_0")) {
profile = transformMethod.invoke(null, f, core_pure_extensions_extension.Root_meta_pure_router_extension_defaultExtensions__RouterExtension_MANY_(compiledExecutionSupport), compiledExecutionSupport);
} else {
profile = transformMethod.invoke(null, f, compiledExecutionSupport);
}
org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Profile p = objectMapper.readValue(org.finos.legend.pure.generated.core_pure_protocol_protocol.Root_meta_alloy_metadataServer_alloyToJSON_Any_1__String_1_(profile, compiledExecutionSupport), org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Profile.class);
builder.addElement(p);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
return builder.build();
}
Aggregations