use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.mapping.PropertyPointer in project legend-engine by finos.
the class DiagramParseTreeWalker method visitPropertyView.
private PropertyView visitPropertyView(DiagramParserGrammar.PropertyViewContext ctx) {
PropertyView propertyView = new PropertyView();
propertyView.sourceInformation = walkerSourceInformation.getSourceInformation(ctx);
// Property
PropertyPointer propertyPointer = new PropertyPointer();
DiagramParserGrammar.PropertyHolderViewPropertyPropContext propertyPropContext = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.propertyHolderViewPropertyProp(), "property", propertyView.sourceInformation);
propertyPointer._class = PureGrammarParserUtility.fromQualifiedName(propertyPropContext.qualifiedName().packagePath() == null ? Collections.emptyList() : propertyPropContext.qualifiedName().packagePath().identifier(), propertyPropContext.qualifiedName().identifier());
propertyPointer.property = PureGrammarParserUtility.fromIdentifier(propertyPropContext.identifier());
propertyPointer.sourceInformation = walkerSourceInformation.getSourceInformation(propertyPropContext.qualifiedName());
propertyView.property = propertyPointer;
// Line
Line line = new Line();
DiagramParserGrammar.RelationshipViewPointsPropContext pointsPropContext = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.relationshipViewPointsProp(), "points", propertyView.sourceInformation);
line.points = ListIterate.collect(pointsPropContext.numberPair(), this::visitPoint);
propertyView.line = line;
// Source
DiagramParserGrammar.RelationshipViewSourcePropContext sourcePropContext = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.relationshipViewSourceProp(), "source", propertyView.sourceInformation);
propertyView.sourceView = sourcePropContext.viewId().getText();
propertyView.sourceViewSourceInformation = walkerSourceInformation.getSourceInformation(sourcePropContext.viewId());
// Target
DiagramParserGrammar.RelationshipViewTargetPropContext targetPropContext = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.relationshipViewTargetProp(), "target", propertyView.sourceInformation);
propertyView.targetView = targetPropContext.viewId().getText();
propertyView.targetViewSourceInformation = walkerSourceInformation.getSourceInformation(targetPropContext.viewId());
return propertyView;
}
use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.mapping.PropertyPointer in project legend-engine by finos.
the class RelationalParseTreeWalker method visitOtherwisePropertyMapping.
private RelationalPropertyMapping visitOtherwisePropertyMapping(RelationalParserGrammar.OtherwisePropertyMappingContext ctx, PropertyPointer propertyPointer, ScopeInfo scopeInfo) {
RelationalPropertyMapping relationalPropertyMapping = new RelationalPropertyMapping();
relationalPropertyMapping.sourceInformation = this.walkerSourceInformation.getSourceInformation(ctx);
relationalPropertyMapping.property = propertyPointer;
relationalPropertyMapping.target = PureGrammarParserUtility.fromIdentifier(ctx.identifier());
String database = ctx.databasePointer() != null ? this.visitDatabasePointer(ctx.databasePointer()) : null;
ElementWithJoins operation = new ElementWithJoins();
operation.sourceInformation = this.walkerSourceInformation.getSourceInformation(ctx);
operation.joins = this.visitJoinSequence(ctx.joinSequence(), database, scopeInfo);
relationalPropertyMapping.relationalOperation = operation;
return relationalPropertyMapping;
}
use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.mapping.PropertyPointer in project legend-engine by finos.
the class RelationalParseTreeWalker method visitInlineEmbeddedPropertyMapping.
private PropertyMapping visitInlineEmbeddedPropertyMapping(RelationalParserGrammar.InlineEmbeddedPropertyMappingContext ctx, PropertyPointer propertyPointer, String targetId) {
InlineEmbeddedPropertyMapping inlineEmbeddedPropertyMapping = new InlineEmbeddedPropertyMapping();
inlineEmbeddedPropertyMapping.sourceInformation = this.walkerSourceInformation.getSourceInformation(ctx);
inlineEmbeddedPropertyMapping.id = targetId;
inlineEmbeddedPropertyMapping.target = targetId;
inlineEmbeddedPropertyMapping.property = propertyPointer;
inlineEmbeddedPropertyMapping.setImplementationId = PureGrammarParserUtility.fromIdentifier(ctx.identifier());
return inlineEmbeddedPropertyMapping;
}
use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.mapping.PropertyPointer in project legend-engine by finos.
the class PureInstanceClassMappingParseTreeWalker method visitPurePropertyMapping.
private PurePropertyMapping visitPurePropertyMapping(PureInstanceClassMappingParserGrammar.PropertyMappingContext ctx, MappingParserGrammar.MappingElementContext classMappingContext, PureInstanceClassMapping pureInstanceClassMapping) {
PurePropertyMapping purePropertyMapping = new PurePropertyMapping();
if (ctx.PLUS() != null) {
// Local property mapping
purePropertyMapping.localMappingProperty = new LocalMappingPropertyInfo();
purePropertyMapping.localMappingProperty.type = ctx.type().getText();
purePropertyMapping.localMappingProperty.multiplicity = buildMultiplicity(ctx.multiplicity().multiplicityArgument());
purePropertyMapping.localMappingProperty.sourceInformation = this.walkerSourceInformation.getSourceInformation(ctx.qualifiedName());
}
purePropertyMapping.property = new PropertyPointer();
purePropertyMapping.property._class = ctx.PLUS() != null ? null : PureGrammarParserUtility.fromQualifiedName(classMappingContext.qualifiedName().packagePath() == null ? Collections.emptyList() : classMappingContext.qualifiedName().packagePath().identifier(), classMappingContext.qualifiedName().identifier());
purePropertyMapping.property.property = PureGrammarParserUtility.fromQualifiedName(ctx.qualifiedName().packagePath() == null ? Collections.emptyList() : ctx.qualifiedName().packagePath().identifier(), ctx.qualifiedName().identifier());
purePropertyMapping.source = classMappingContext.mappingElementId() == null ? "" : classMappingContext.mappingElementId().getText();
// This might looks strange but the parser rule looks like: sourceAndTargetMappingId: BRACKET_OPEN sourceId (COMMA targetId)? BRACKET_CLOSE
// so in this case the class mapping ID is `sourceId`
purePropertyMapping.target = ctx.sourceAndTargetMappingId() != null ? PureGrammarParserUtility.fromQualifiedName(ctx.sourceAndTargetMappingId().sourceId().qualifiedName().packagePath() == null ? Collections.emptyList() : ctx.sourceAndTargetMappingId().sourceId().qualifiedName().packagePath().identifier(), ctx.sourceAndTargetMappingId().sourceId().qualifiedName().identifier()) : null;
if (ctx.ENUMERATION_MAPPING() != null) {
purePropertyMapping.enumMappingId = PureGrammarParserUtility.fromIdentifier(ctx.identifier());
}
purePropertyMapping.transform = visitLambda(ctx.combinedExpression(), pureInstanceClassMapping);
purePropertyMapping.property.sourceInformation = this.walkerSourceInformation.getSourceInformation(ctx.qualifiedName());
purePropertyMapping.sourceInformation = this.walkerSourceInformation.getSourceInformation(ctx);
purePropertyMapping.explodeProperty = ctx.STAR() != null;
return purePropertyMapping;
}
use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.mapping.PropertyPointer in project legend-engine by finos.
the class XStoreAssociationMappingParseTreeWalker method visitXStorePropertyMapping.
private XStorePropertyMapping visitXStorePropertyMapping(XStoreAssociationMappingParserGrammar.XStorePropertyMappingContext ctx, String association) {
XStorePropertyMapping xStorePropertyMapping = new XStorePropertyMapping();
xStorePropertyMapping.property = new PropertyPointer();
xStorePropertyMapping.property._class = association;
xStorePropertyMapping.property.property = PureGrammarParserUtility.fromQualifiedName(ctx.qualifiedName().packagePath() == null ? Collections.emptyList() : ctx.qualifiedName().packagePath().identifier(), ctx.qualifiedName().identifier());
xStorePropertyMapping.property.sourceInformation = this.walkerSourceInformation.getSourceInformation(ctx.qualifiedName());
xStorePropertyMapping.source = ctx.sourceAndTargetMappingId() == null ? "" : ctx.sourceAndTargetMappingId().sourceId().getText();
xStorePropertyMapping.target = ctx.sourceAndTargetMappingId() == null ? "" : ctx.sourceAndTargetMappingId().targetId().getText();
xStorePropertyMapping.crossExpression = visitLambda(ctx.combinedExpression());
xStorePropertyMapping.sourceInformation = this.walkerSourceInformation.getSourceInformation(ctx);
return xStorePropertyMapping;
}
Aggregations