Package adql.query.from
Class ADQLJoin
java.lang.Object
adql.query.from.ADQLJoin
- All Implemented Interfaces:
ADQLObject,FromContent
Defines a join between two "tables".
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClauseConstraintsThe join condition.protected ArrayList<ADQLColumn> List of columns on which the join must be done.protected booleanNatural join (use of table keys) ? -
Constructor Summary
ConstructorsConstructorDescriptionBuilds an ADQL join by copying the given one.ADQLJoin(FromContent left, FromContent right) Builds anADQLJoinwith at least twoFromContentobjects: the left and the right part of the join (usually two tables: T1 JOIN T2). -
Method Summary
Modifier and TypeMethodDescriptionstatic final voidaddAllExcept(SearchColumnList itemsToAdd, SearchColumnList target, Map<String, DBCommonColumn> exception) Gets an iterator on the intern ADQL objects.static final DBColumnfindAtMostOneColumn(String columnName, byte caseSensitive, SearchColumnList list, boolean leftList) static final DBColumnfindExactlyOneColumn(String columnName, byte caseSensitive, SearchColumnList list, boolean leftList) abstract ADQLObjectgetCopy()Gets a (deep) copy of this ADQL object.Gets the list of all columns (~ database metadata) available in this FROM part.final ClauseConstraintsGets the condition of this join (that's to say: the condition which follows the keyword ON).final Iterator<ADQLColumn> Gets the list of all columns on which the join is done (that's to say: the list of columns given with the keyword USING).abstract StringGets the type of this join.final FromContentGets the left "table" of this join.getName()Gets the name of this object in ADQL.final TextPositionGets the position of this object/token in the ADQL query.final FromContentGets the right "table" of this join.getTablesByAlias(String alias, boolean caseSensitive) Gets all the table whose the alias is equals to the given one.final booleanTells whether this join has a list of columns to join.static final booleanisCommonColumn(DBColumn col) Tells whether the given column is a common column (that's to say, a unification of several columns of the same name).final booleanIndicates whether this join is natural or not.voidSets the condition of this join (that's to say: the condition which follows the keyword ON).voidsetJoinedColumns(Collection<ADQLColumn> columns) Sets the list of all columns on which the join is done (that's to say: the list of columns given with the keyword USING).voidsetLeftTable(FromContent table) Sets the left "table" of this join.voidsetNatural(boolean natural) Lets indicate that this join is natural (it must use the table keys).final voidsetPosition(TextPosition position) Set the position of thisFromContentin the given ADQL query string.voidsetRightTable(FromContent table) Sets the right "table" of this join.toADQL()Gets the ADQL expression of this object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface adql.query.ADQLObject
getFeatureDescription
-
Field Details
-
natural
protected boolean naturalNatural join (use of table keys) ? -
condition
The join condition. -
lstColumns
List of columns on which the join must be done.
-
-
Constructor Details
-
ADQLJoin
Builds anADQLJoinwith at least twoFromContentobjects: the left and the right part of the join (usually two tables: T1 JOIN T2).- Parameters:
left- Left "table" of the join.right- Right "table" of the join.
-
ADQLJoin
Builds an ADQL join by copying the given one.- Parameters:
toCopy- The ADQLJoin to copy.- Throws:
Exception- If there is an error during the copy.
-
-
Method Details
-
isNatural
public final boolean isNatural()Indicates whether this join is natural or not.- Returns:
truemeans this join is natural,falseelse.
-
setNatural
public void setNatural(boolean natural) Lets indicate that this join is natural (it must use the table keys).- Parameters:
natural-truemeans this join must be natural,falseelse.
-
getLeftTable
Gets the left "table" of this join.- Returns:
- The left part of the join.
-
setLeftTable
Sets the left "table" of this join.- Parameters:
table- The left part of the join.
-
getRightTable
Gets the right "table" of this join.- Returns:
- The right part of the join.
-
setRightTable
Sets the right "table" of this join.- Parameters:
table- The right part of the join.
-
getJoinCondition
Gets the condition of this join (that's to say: the condition which follows the keyword ON).- Returns:
- The join condition.
-
setJoinCondition
Sets the condition of this join (that's to say: the condition which follows the keyword ON).- Parameters:
cond- The join condition (condition following ON).
-
getPosition
Description copied from interface:ADQLObjectGets the position of this object/token in the ADQL query.By default, no position should be set.
- Specified by:
getPositionin interfaceADQLObject- Returns:
- Position of this ADQL item in the ADQL query, or NULL if not written originally in the query (for example, if added afterwards).
-
setPosition
Description copied from interface:FromContentSet the position of thisFromContentin the given ADQL query string.- Specified by:
setPositionin interfaceFromContent- Parameters:
position- New position of thisFromContent.
-
getJoinedColumns
Gets the list of all columns on which the join is done (that's to say: the list of columns given with the keyword USING).- Returns:
- The joined columns (columns listed in USING(...)).
-
hasJoinedColumns
public final boolean hasJoinedColumns()Tells whether this join has a list of columns to join.- Returns:
trueif some columns must be explicitly joined,falseotherwise.
-
setJoinedColumns
Sets the list of all columns on which the join is done (that's to say: the list of columns given with the keyword USING).- Parameters:
columns- The joined columns.
-
getName
Description copied from interface:ADQLObjectGets the name of this object in ADQL.- Specified by:
getNamein interfaceADQLObject- Returns:
- The name of this ADQL object.
-
adqlIterator
Description copied from interface:ADQLObjectGets an iterator on the intern ADQL objects.Note: The returned iterator is particularly used by a
ISearchHandlerextension to browse a whole ADQL tree.- Specified by:
adqlIteratorin interfaceADQLObject- Returns:
- An ADQL objects iterator.
- See Also:
-
toADQL
Description copied from interface:ADQLObjectGets the ADQL expression of this object.- Specified by:
toADQLin interfaceADQLObject- Returns:
- The corresponding ADQL expression.
-
getDBColumns
Description copied from interface:FromContentGets the list of all columns (~ database metadata) available in this FROM part.Note: In the most cases, this list is generated on the fly !
- Specified by:
getDBColumnsin interfaceFromContent- Returns:
- All the available
DBColumns. - Throws:
UnresolvedJoinException- If a join is not possible.
-
addAllExcept
public static final void addAllExcept(SearchColumnList itemsToAdd, SearchColumnList target, Map<String, DBCommonColumn> exception) -
findExactlyOneColumn
public static final DBColumn findExactlyOneColumn(String columnName, byte caseSensitive, SearchColumnList list, boolean leftList) throws UnresolvedJoinException - Throws:
UnresolvedJoinException
-
findAtMostOneColumn
public static final DBColumn findAtMostOneColumn(String columnName, byte caseSensitive, SearchColumnList list, boolean leftList) throws UnresolvedJoinException - Throws:
UnresolvedJoinException
-
isCommonColumn
Tells whether the given column is a common column (that's to say, a unification of several columns of the same name).- Parameters:
col- A DBColumn.- Returns:
trueif the given column is a common column,falseotherwise (particularly if col = null).
-
getTables
Description copied from interface:FromContent- Specified by:
getTablesin interfaceFromContent- Returns:
- The list of all
ADQLTables found.
-
getTablesByAlias
Description copied from interface:FromContentGets all the table whose the alias is equals to the given one.Note: Theoretically, only one table may be returned. But, since this object may be generated without the parser, it is possible that several
ADQLTableobjects exits with the same alias (particularly if there are JOIN).- Specified by:
getTablesByAliasin interfaceFromContent- Parameters:
alias- Alias of the table(s) to get.caseSensitive-trueif the research must be made with case-sensitivity,falseotherwise.- Returns:
- The list of all tables found.
-
getJoinType
Gets the type of this join.- Returns:
- Its join type (i.e. CROSS JOIN, LEFT JOIN, LEFT OUTER JOIN, ...).
-
getCopy
Description copied from interface:ADQLObjectGets a (deep) copy of this ADQL object.- Specified by:
getCopyin interfaceADQLObject- Returns:
- The copy of this ADQL object.
- Throws:
Exception- If there is any error during the copy.
-