Package org.modeshape.jcr.query.validate.Schemata

Examples of org.modeshape.jcr.query.validate.Schemata.Table


                if (!column.isFullTextSearchable()) {
                    problems.addError(GraphI18n.columnIsNotFullTextSearchable, column.getName(), selectorName);
                }
            }
        } else {
            Table table = verify(selectorName);
            // Don't need to check if the selector is the '__ALLNODES__' selector ...
            if (table != null && !AllNodes.ALL_NODES_NAME.equals(table.getName())) {
                // Make sure there is at least one column on the table that is full-text searchable ...
                boolean searchable = false;
                for (Schemata.Column column : table.getColumns()) {
                    if (column.isFullTextSearchable()) {
                        searchable = true;
                        break;
                    }
                }
View Full Code Here


    public void visit( Query obj ) {
        // Collect the map of columns by alias for this query ...
        this.columnsByAlias.clear();
        for (Column column : obj.columns()) {
            // Find the schemata column ...
            Table table = tableWithNameOrAlias(column.selectorName());
            if (table != null) {
                Schemata.Column tableColumn = table.getColumn(column.getPropertyName());
                if (tableColumn != null) {
                    this.columnsByAlias.put(column.getColumnName(), tableColumn);
                }
            }
        }
View Full Code Here

            }
        }
    }

    protected Table tableWithNameOrAlias( SelectorName tableName ) {
        Table table = selectorsByNameOrAlias.get(tableName);
        if (table == null) {
            // Try looking up the table by it's real name (if an alias were used) ...
            table = selectorsByName.get(tableName);
        }
        return table; // may be null
View Full Code Here

        }
        return table; // may be null
    }

    protected Table verify( SelectorName selectorName ) {
        Table table = tableWithNameOrAlias(selectorName);
        if (table == null) {
            problems.addError(GraphI18n.tableDoesNotExist, selectorName.name());
        }
        return table; // may be null
    }
View Full Code Here

        }
        return table; // may be null
    }

    protected Table verifyTable( SelectorName tableName ) {
        Table table = tableWithNameOrAlias(tableName);
        if (table == null) {
            problems.addError(GraphI18n.tableDoesNotExist, tableName.name());
        }
        return table; // may be null
    }
View Full Code Here

    }

    protected Schemata.Column verify( SelectorName selectorName,
                                      String propertyName,
                                      boolean columnIsRequired ) {
        Table table = tableWithNameOrAlias(selectorName);
        if (table == null) {
            StringBuilder existingSelectors = new StringBuilder();
            boolean first = true;
            for (SelectorName sel : selectorsByNameOrAlias.keySet()) {
                if (first) first = false;
                else existingSelectors.append(", ");
                existingSelectors.append("'").append(sel.getString()).append("'");
            }
            problems.addError(GraphI18n.tableDoesNotExistButMatchesAnotherTable, selectorName.name(), existingSelectors);
            return null;
        }
        Schemata.Column column = table.getColumn(propertyName);
        if (column == null) {
            // Maybe the supplied property name is really an alias ...
            column = this.columnsByAlias.get(propertyName);
            boolean propertyNameIsWildcard = propertyName == null || "*".equals(propertyName);
            if (column == null && !propertyNameIsWildcard && !PseudoColumns.contains(propertyName, true)) {
                if (!table.hasExtraColumns() && columnIsRequired) {
                    problems.addError(GraphI18n.columnDoesNotExistOnTable, propertyName, selectorName.name());
                    checkVariationsOfPropertyName(selectorName, propertyName, table, problems);
                } else {
                    if (!checkVariationsOfPropertyName(selectorName, propertyName, table, problems)) {
                        problems.addWarning(GraphI18n.columnDoesNotExistOnTableAndMayBeResidual, propertyName,
View Full Code Here

        }

        // Look to see if any of these variations can be found on any of the selectors ...
        boolean found = false;
        for (SelectorName selectorName : selectorsByNameOrAlias.keySet()) {
            Table table = tableWithNameOrAlias(selectorName);
            for (String var : vars) {
                if (table != null && table.getColumn(var) != null) {
                    if (table == actualTable) {
                        problems.addWarning(GraphI18n.columnDoesNotExistOnTableAndMayBeTypo, propertyName, selector.name(), var);
                        found = true;
                    } else {
                        problems.addWarning(GraphI18n.columnDoesNotExistOnTableAndMayBeWrongSelector,
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.query.validate.Schemata.Table

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.