Search in sources :

Example 1 with DynaFunction

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);
    }
}
Also used : RelationalOperationElement(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.RelationalOperationElement) Literal(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.Literal) JoinTreeNode(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.join.JoinTreeNode) TableAliasColumn(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.TableAliasColumn) DynaFunction(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.DynaFunction) RelationalOperationElementWithJoin(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.RelationalOperationElementWithJoin) PureCompilationException(org.finos.legend.pure.m4.exception.PureCompilationException)

Example 2 with DynaFunction

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()));
    }
}
Also used : RelationalOperationElement(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.RelationalOperationElement) Literal(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.Literal) TableAlias(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.TableAlias) TableAliasColumn(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.TableAliasColumn) ImportStub(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.ImportStub) DynaFunction(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.DynaFunction) RelationalOperationElementWithJoin(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.RelationalOperationElementWithJoin)

Example 3 with DynaFunction

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);
        }
    }
}
Also used : RelationalOperationElement(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.RelationalOperationElement) JoinTreeNode(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.join.JoinTreeNode) TableAliasColumn(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.TableAliasColumn) DynaFunction(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.DynaFunction) RelationalOperationElementWithJoin(org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.RelationalOperationElementWithJoin)

Aggregations

DynaFunction (org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.DynaFunction)3 RelationalOperationElement (org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.RelationalOperationElement)3 RelationalOperationElementWithJoin (org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.RelationalOperationElementWithJoin)3 TableAliasColumn (org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.TableAliasColumn)3 Literal (org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.Literal)2 JoinTreeNode (org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.join.JoinTreeNode)2 ImportStub (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.ImportStub)1 TableAlias (org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.TableAlias)1 PureCompilationException (org.finos.legend.pure.m4.exception.PureCompilationException)1