use of org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.DynaFunction in project legend-pure by finos.
the class RelationalOperationElementProcessor method processColumnExpr.
static void processColumnExpr(RelationalOperationElement impl, CoreInstance implementation, CoreInstance mappingOwner, MutableSet<TableAlias> tableAliases, Matcher matcher, ProcessorState state, ModelRepository repository, ProcessorSupport processorSupport) throws PureCompilationException {
if (impl instanceof TableAliasColumn) {
processTableAliasColumn((TableAliasColumn) impl, mappingOwner, tableAliases, processorSupport);
} else if (impl instanceof DynaFunction) {
processDynaFunction((DynaFunction) impl, implementation, mappingOwner, tableAliases, matcher, state, repository, processorSupport);
} else if (impl instanceof RelationalOperationElementWithJoin) {
RelationalOperationElement relationalOperationElement = ((RelationalOperationElementWithJoin) impl)._relationalOperationElement();
if (relationalOperationElement != null) {
if (relationalOperationElement instanceof DynaFunction) {
processDynaFunction((DynaFunction) relationalOperationElement, implementation, mappingOwner, tableAliases, matcher, state, repository, processorSupport);
} else if (relationalOperationElement instanceof TableAliasColumn) {
processTableAliasColumn((TableAliasColumn) relationalOperationElement, mappingOwner, tableAliases, processorSupport);
}
}
JoinTreeNode joinTreeNode = ((RelationalOperationElementWithJoin) impl)._joinTreeNode();
if (joinTreeNode != null) {
processJoinTreeNode(joinTreeNode, mappingOwner, matcher, state, repository, processorSupport);
tableAliases.clear();
}
} else if (impl instanceof Literal) {
// Do nothing
} else {
throw new PureCompilationException(impl.getSourceInformation(), "Not Supported Yet! " + impl);
}
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.DynaFunction in project legend-pure by finos.
the class RelationalOperationElementUnbind method cleanNode.
public static void cleanNode(RelationalOperationElement element, ModelRepository modelRepository, ProcessorSupport processorSupport) throws PureCompilationException {
if (element instanceof TableAliasColumn) {
TableAliasColumn tableAliasColumn = (TableAliasColumn) element;
ImportStub database = (ImportStub) tableAliasColumn._alias()._databaseCoreInstance();
Shared.cleanUpReferenceUsage(database, tableAliasColumn, processorSupport);
Shared.cleanImportStub(database, processorSupport);
tableAliasColumn._columnRemove();
TableAlias alias = tableAliasColumn._alias();
alias._relationalElementRemove();
} else if (element instanceof DynaFunction) {
for (RelationalOperationElement val : ((DynaFunction) element)._parameters()) {
cleanNode(val, modelRepository, processorSupport);
}
} else if (element instanceof RelationalOperationElementWithJoin) {
if (((RelationalOperationElementWithJoin) element)._relationalOperationElement() != null) {
cleanNode(((RelationalOperationElementWithJoin) element)._relationalOperationElement(), modelRepository, processorSupport);
}
if (((RelationalOperationElementWithJoin) element)._joinTreeNode() != null) {
cleanJoinTreeNode(((RelationalOperationElementWithJoin) element)._joinTreeNode(), modelRepository, processorSupport);
}
} else if (element instanceof Literal) {
// Nothing to do
} else {
throw new RuntimeException("TO CODE: clean relational operation element node of type " + PackageableElement.getUserPathForPackageableElement(element.getClassifier()));
}
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.DynaFunction in project legend-pure by finos.
the class RelationalOperationElementProcessor method populateColumnExpressionReferenceUsages.
static void populateColumnExpressionReferenceUsages(CoreInstance columnExpression, ModelRepository repository, ProcessorSupport processorSupport) {
if (columnExpression instanceof TableAliasColumn) {
populateTableAliasColumnReferenceUsages((TableAliasColumn) columnExpression, repository, processorSupport);
} else if (columnExpression instanceof DynaFunction) {
populateDynaFunctionReferenceUsages((DynaFunction) columnExpression, repository, processorSupport);
} else if (columnExpression instanceof RelationalOperationElementWithJoin) {
RelationalOperationElement relationalOperationElement = ((RelationalOperationElementWithJoin) columnExpression)._relationalOperationElement();
if (relationalOperationElement != null) {
if (relationalOperationElement instanceof DynaFunction) {
populateDynaFunctionReferenceUsages((DynaFunction) relationalOperationElement, repository, processorSupport);
} else if (relationalOperationElement instanceof TableAliasColumn) {
populateTableAliasColumnReferenceUsages((TableAliasColumn) relationalOperationElement, repository, processorSupport);
}
}
JoinTreeNode joinTreeNode = ((RelationalOperationElementWithJoin) columnExpression)._joinTreeNode();
if (joinTreeNode != null) {
populateJoinTreeNodeReferenceUsages(joinTreeNode, repository, processorSupport);
}
}
}
Aggregations