protected final ReadableVisitor append(SelectorName name) { sb.append(name.getName()); return this; }
/** * {@inheritDoc} * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof SelectorName) { SelectorName that = (SelectorName)obj; return this.name.equals(that.getName()); } return false; }
/** * Check if selector exists in list of selectors. * @param selectorName * @return */ public Table checkSelectorExistance(SelectorName selectorName) { Table table = selectorsByNameOrAlias.get(selectorName); if (table == null) { // Try looking up the table by it's real name (if an alias were used) ... table = selectorsByName.get(selectorName); } if (table == null) { problems.addException(new TableDoesntExistException("Table " + selectorName.getName() + " doesnt exist")); } return table; }
/** * Check if selector exists in list of selectors. * @param selectorName * @param propertyName * @param columnIsRequired */ public Schema.Column checkTableAndColumnExistance(SelectorName selectorName, String propertyName, boolean columnIsRequired) { Table table = checkSelectorExistance(selectorName); //no need to check select ALL properties. if (table != null && !propertyName.equals("*")) { Schema.Column column = table.getColumn(propertyName); if (column == null) { // Maybe the supplied property name is really an alias ... column = this.columnsByAlias.get(propertyName); if (column == null && columnIsRequired) { problems.addException(new InvalidQueryException("Column " + propertyName + " doesnt exist on table " + selectorName.getName() + " or not allowed for search")); } } return column; } return null; }