Package org.ofbiz.sql

Examples of org.ofbiz.sql.SelectGroup


        DynamicViewEntity dve = new DynamicViewEntity();
        Unioned unioned = selectStatement.getUnioned();
        if (unioned.getOperator() != null || unioned.getNext() != null) {
            throw new IllegalArgumentException("union views not yet supported");
        }
        SelectGroup selectGroup = unioned.getGroup();
        Table table = selectGroup.getTable();
        addMember(dve, table.getTableName());
        addJoined(dve, table.getTableName().getAlias(), table.getJoined());
        for (FieldAll fieldAll: selectGroup.getFieldAlls()) {
            dve.addAliasAll(fieldAll.getAlias(), null);
        }
        for (Relation relation: selectStatement.getRelations().values()) {
            dve.addRelation(relation.getType(), relation.getTitle(), relation.getEntityName(), buildKeyMaps(relation));
        }
        List<String> groupBy = selectGroup.getGroupBy();
        if (groupBy == null) {
            groupBy = Collections.emptyList();
        }
        for (FieldDef fieldDef: selectGroup.getFieldDefs()) {
            addFieldDef(dve, groupBy, fieldDef.getAlias(), fieldDef);
        }
        List<String> orderBy;
        if (selectStatement.getOrderBy() == null) {
            orderBy = null;
        } else {
            orderBy = FastList.newInstance();
            for (OrderByItem orderByItem: selectStatement.getOrderBy()) {
                orderBy.add(orderByItem.toString());
            }
        }
        return new EntitySelectPlan(dve, plan(selectGroup.getWhereCondition()), plan(selectGroup.getHavingCondition()), orderBy);
    }
View Full Code Here


        DynamicViewEntity dve = new DynamicViewEntity();
        Unioned unioned = selectStatement.getUnioned();
        if (unioned != null) {
            throw new IllegalArgumentException("union views not yet supported");
        }
        SelectGroup selectGroup = unioned.getGroup();
        Table table = selectGroup.getTable();
        addMember(dve, table.getTableName());
        addJoined(dve, table.getTableName().getAlias(), table.getJoined());
        if (selectGroup.getFieldAlls() != null) {
            for (FieldAll fieldAll: selectGroup.getFieldAlls()) {
                List<String> excludes = FastList.newInstance();
                for (String exclude: fieldAll) {
                    excludes.add(exclude);
                }
                if (excludes.isEmpty()) {
                    excludes = null;
                }
                dve.addAliasAll(fieldAll.getAlias(), null, excludes);
            }
        }
        if (selectStatement.getRelations() != null) {
            for (Relation relation: selectStatement.getRelations().values()) {
                dve.addRelation(relation.getType(), relation.getTitle(), relation.getEntityName(), buildKeyMaps(relation));
            }
        }
        List<String> groupBy = selectGroup.getGroupBy();
        if (groupBy == null) {
            groupBy = Collections.emptyList();
        }
        if (selectGroup.getFieldDefs() != null) {
            for (FieldDef fieldDef: selectGroup.getFieldDefs()) {
                addFieldDef(dve, groupBy, fieldDef.getAlias(), fieldDef);
            }
        }
        List<String> orderBy;
        if (selectStatement.getOrderBy() == null) {
            orderBy = null;
        } else {
            orderBy = FastList.newInstance();
            for (OrderByItem orderByItem: selectStatement.getOrderBy()) {
                orderBy.add(orderByItem.toString());
            }
        }
        return new EntitySelectPlan(dve, plan(selectGroup.getWhereCondition()), plan(selectGroup.getHavingCondition()), orderBy);
    }
View Full Code Here

TOP

Related Classes of org.ofbiz.sql.SelectGroup

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.