Package org.jboss.dna.graph.query.model

Examples of org.jboss.dna.graph.query.model.Column


                                                         Map<SelectorName, SelectorName> rewrittenSelectors ) {
        switch (planNode.getType()) {
            case PROJECT:
                List<Column> columns = planNode.getPropertyAsList(Property.PROJECT_COLUMNS, Column.class);
                for (int i = 0; i != columns.size(); ++i) {
                    Column column = columns.get(i);
                    SelectorName replacement = rewrittenSelectors.get(column.getSelectorName());
                    if (replacement != null) {
                        columns.set(i, new Column(replacement, column.getPropertyName(), column.getColumnName()));
                    }
                }
                break;
            case SELECT:
                Constraint constraint = planNode.getProperty(Property.SELECT_CRITERIA, Constraint.class);
View Full Code Here


                    case PROJECT:
                        // Adjust the columns ...
                        List<Column> columns = node.getPropertyAsList(Property.PROJECT_COLUMNS, Column.class);
                        if (columns != null) {
                            for (int i = 0; i != columns.size(); ++i) {
                                Column column = columns.get(i);
                                if (column.getSelectorName().equals(viewName)) {
                                    // This column references the view ...
                                    String columnName = column.getPropertyName();
                                    String columnAlias = column.getColumnName();
                                    // Find the source column that this view column corresponds to ...
                                    Column sourceColumn = mappings.getMappedColumn(columnName);
                                    if (sourceColumn != null) {
                                        SelectorName sourceName = sourceColumn.getSelectorName();
                                        // Replace the view column with one that uses the same alias but that references the
                                        // source
                                        // column ...
                                        columns.set(i, new Column(sourceName, sourceColumn.getPropertyName(), columnAlias));
                                        node.addSelector(sourceName);
                                    } else {
                                        node.addSelector(column.getSelectorName());
                                    }
                                } else {
View Full Code Here

            return new DescendantNode(selector, descendantNode.getAncestorPath());
        }
        if (constraint instanceof PropertyExistence) {
            PropertyExistence existence = (PropertyExistence)constraint;
            if (!mapping.getOriginalName().equals(existence.getSelectorName())) return existence;
            Column sourceColumn = mapping.getMappedColumn(existence.getPropertyName());
            if (sourceColumn == null) return existence;
            node.addSelector(sourceColumn.getSelectorName());
            return new PropertyExistence(sourceColumn.getSelectorName(), sourceColumn.getPropertyName());
        }
        if (constraint instanceof FullTextSearch) {
            FullTextSearch search = (FullTextSearch)constraint;
            if (!mapping.getOriginalName().equals(search.getSelectorName())) return search;
            Column sourceColumn = mapping.getMappedColumn(search.getPropertyName());
            if (sourceColumn == null) return search;
            node.addSelector(sourceColumn.getSelectorName());
            return new FullTextSearch(sourceColumn.getSelectorName(), sourceColumn.getPropertyName(),
                                      search.getFullTextSearchExpression());
        }
        if (constraint instanceof Between) {
            Between between = (Between)constraint;
            DynamicOperand lhs = between.getOperand();
View Full Code Here

            return new NodeLocalName(mapping.getSingleMappedSelectorName());
        }
        if (operand instanceof PropertyValue) {
            PropertyValue value = (PropertyValue)operand;
            if (!mapping.getOriginalName().equals(value.getSelectorName())) return value;
            Column sourceColumn = mapping.getMappedColumn(value.getPropertyName());
            if (sourceColumn == null) return value;
            node.addSelector(sourceColumn.getSelectorName());
            return new PropertyValue(sourceColumn.getSelectorName(), sourceColumn.getPropertyName());
        }
        if (operand instanceof NodeDepth) {
            NodeDepth depth = (NodeDepth)operand;
            if (!mapping.getOriginalName().equals(depth.getSelectorName())) return depth;
            if (!mapping.isMappedToSingleSelector()) return depth;
View Full Code Here

            SelectorName replacement1 = condition.getSelector1Name();
            SelectorName replacement2 = condition.getSelector2Name();
            String property1 = condition.getProperty1Name();
            String property2 = condition.getProperty2Name();
            if (replacement1.equals(mapping.getOriginalName())) {
                Column sourceColumn = mapping.getMappedColumn(property1);
                if (sourceColumn != null) {
                    replacement1 = sourceColumn.getSelectorName();
                    property1 = sourceColumn.getPropertyName();
                }
            }
            if (replacement2.equals(mapping.getOriginalName())) {
                Column sourceColumn = mapping.getMappedColumn(property2);
                if (sourceColumn != null) {
                    replacement2 = sourceColumn.getSelectorName();
                    property2 = sourceColumn.getPropertyName();
                }
            }
            if (replacement1 == condition.getSelector1Name() && replacement2 == condition.getSelector2Name()) return condition;
            node.addSelector(replacement1, replacement2);
            return new EquiJoinCondition(replacement1, property1, replacement2, property2);
View Full Code Here

        // Get the Schemata columns defined by the view ...
        List<org.jboss.dna.graph.query.validate.Schemata.Column> viewColumns = view.getColumns();
        assert viewColumns.size() == projectedColumns.size();

        for (int i = 0; i != viewColumns.size(); ++i) {
            Column projectedColunn = projectedColumns.get(i);
            String viewColumnName = viewColumns.get(i).getName();
            mapping.map(viewColumnName, projectedColunn);
        }
        return mapping;
    }
View Full Code Here

        // Get the Schemata columns defined by the view ...
        List<org.jboss.dna.graph.query.validate.Schemata.Column> viewColumns = view.getColumns();
        assert viewColumns.size() == projectedColumns.size();

        for (int i = 0; i != viewColumns.size(); ++i) {
            Column projectedColunn = projectedColumns.get(i);
            String viewColumnName = viewColumns.get(i).getName();
            mapping.map(viewColumnName, projectedColunn);
        }
        return mapping;
    }
View Full Code Here

        // Get the Columns from the PROJECT in the plan node ...
        List<Column> projectedColumns = project.getPropertyAsList(Property.PROJECT_COLUMNS, Column.class);

        for (int i = 0; i != projectedColumns.size(); ++i) {
            Column projectedColumn = projectedColumns.get(i);
            Column projectedColumnInTable = projectedColumns.get(i).with(table.getName());
            org.jboss.dna.graph.query.validate.Schemata.Column column = table.getColumn(projectedColumnInTable.getPropertyName());
            mapping.map(column.getName(), projectedColumnInTable);
            if (projectedColumn.getColumnName() != null) {
                // The projected column has an alias, so add a mapping for it, too
                mapping.map(projectedColumn.getColumnName(), projectedColumnInTable);
            }
View Full Code Here

                                      String alias ) {
            if (names.contains(selector)) {
                // The column is part of the table we're interested in ...
                if (alias != null && !alias.equals(propertyName)) {
                    if (requiredColumnNames.add(propertyName) && requiredColumnNames.add(alias)) {
                        columns.add(new Column(selector, propertyName, alias));
                    }
                } else {
                    if (requiredColumnNames.add(propertyName)) {
                        alias = propertyName;
                        columns.add(new Column(selector, propertyName, alias));
                    }
                }
            }
        }
View Full Code Here

                projectNode.addSelector(tableName);
                // Compute the columns from this selector ...
                for (Schemata.Column column : table.getColumns()) {
                    String columnName = column.getName();
                    String propertyName = columnName;
                    columns.add(new Column(tableName, propertyName, columnName));
                }
            }
        } else {
            // Add the selector used by each column ...
            for (Column column : columns) {
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.query.model.Column

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.