if (columns.isEmpty()) {
columns = new LinkedList<Column>();
// SELECT *, so find all of the columns that are available from all the sources ...
for (Map.Entry<SelectorName, Table> entry : selectors.entrySet()) {
SelectorName tableName = entry.getKey();
Table table = entry.getValue();
// Add the selector that is being used ...
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) {
SelectorName tableName = column.getSelectorName();
// Add the selector that is being used ...
projectNode.addSelector(tableName);
// Verify that each column is available in the appropriate source ...
Table table = selectors.get(tableName);
if (table == null) {
context.getProblems().addError(GraphI18n.tableDoesNotExist, tableName);
} else {
// Make sure that the column is in the table ...
String columnName = column.getPropertyName();
String name = columnName;
if (table.getColumn(name) == null) {
context.getProblems().addError(GraphI18n.columnDoesNotExistOnTable, name, tableName);
}
}
}
}