Package com.jengine.utils.commons.expression

Examples of com.jengine.utils.commons.expression.ExpressionNode


    /* SQL methods*/

    public SQLQuery.Table getMultiTable() {
        List<SQLQuery.TableItem> tableItems = getTableItems();
        ExpressionNode expressionNode  = makeSQLExpression();
        return new SQLQuery.Table(tableItems, expressionNode);
    }
View Full Code Here


            String modelClassName = tree.getChild(0).getText();
            ModelClassBase modelClass = getDB().getModelClass(modelClassName);
            MultiModelItem item = add(new MultiModelItem(this, modelClass, makeItemName(modelClass)));
            return new MultiModelNode(item);
        } else if (tree.getType() == ExprParser.RIGHT_JOIN) {
            ExpressionNode operand1 = visit(tree.getChild(0));
            ExpressionNode operand2 = visit(tree.getChild(1));
            String[] keys = calcRestrictionKeys(getMultiModelItems(operand2), getMultiModelItems(operand1));
            keys = keys != null ?  keys : calcRestrictionKeys(getMultiModelItems(operand1), getMultiModelItems(operand2));
            RightJoin join = new RightJoin(operand1, operand2, fields.get(keys[0]), fields.get(keys[1]));
            operations.add(join);
            return join;
        } else if (tree.getType() == ExprParser.LEFT_JOIN) {
            ExpressionNode operand1 = visit(tree.getChild(0));
            ExpressionNode operand2 = visit(tree.getChild(1));
            String[] keys = calcRestrictionKeys(getMultiModelItems(operand1), getMultiModelItems(operand2));
            keys = keys != null ?  keys : calcRestrictionKeys(getMultiModelItems(operand2), getMultiModelItems(operand1));
            LeftJoin join = new LeftJoin(operand1, operand2, fields.get(keys[0]), fields.get(keys[1]));
            operations.add(join);
            return join;
        } else if (tree.getType() == ExprParser.FULL_JOIN) {
            ExpressionNode operand1 = visit(tree.getChild(0));
            ExpressionNode operand2 = visit(tree.getChild(1));
            String[] keys = calcRestrictionKeys(getMultiModelItems(operand1), getMultiModelItems(operand2));
            keys = keys != null ?  keys : calcRestrictionKeys(getMultiModelItems(operand2), getMultiModelItems(operand1));
            FullJoin join = new FullJoin(operand1, operand2, fields.get(keys[0]), fields.get(keys[1]));
            operations.add(join);
            return join;
        } else if (tree.getType() == ExprParser.INNER_JOIN) {
            ExpressionNode operand1 = visit(tree.getChild(0));
            ExpressionNode operand2 = visit(tree.getChild(1));
            String[] keys = calcRestrictionKeys(getMultiModelItems(operand1), getMultiModelItems(operand2));
            keys = keys != null ?  keys : calcRestrictionKeys(getMultiModelItems(operand2), getMultiModelItems(operand1));
            InnerJoin join = new InnerJoin(operand1, operand2, fields.get(keys[0]), fields.get(keys[1]));
            operations.add(join);
            return join;
        } else if (tree.getType() == ExprParser.AND) {
            ExpressionNode operand1 = visit(tree.getChild(0));
            ExpressionNode operand2 = visit(tree.getChild(1));
            return new And(operand1, operand2);
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of com.jengine.utils.commons.expression.ExpressionNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.