public abstract class ADQLJoin extends java.lang.Object implements ADQLObject, FromContent
Modifier and Type | Field and Description |
---|---|
protected ClauseConstraints |
condition
The join condition.
|
protected java.util.ArrayList<ADQLColumn> |
lstColumns
List of columns on which the join must be done.
|
protected boolean |
natural
Natural join (use of table keys) ?
|
Constructor and Description |
---|
ADQLJoin(ADQLJoin toCopy)
Builds an ADQL join by copying the given one.
|
ADQLJoin(FromContent left,
FromContent right)
Builds an
ADQLJoin with at least two FromContent objects:
the left and the right part of the join (usually two tables: T1 JOIN T2). |
Modifier and Type | Method and Description |
---|---|
static void |
addAllExcept(SearchColumnList itemsToAdd,
SearchColumnList target,
java.util.Map<java.lang.String,DBCommonColumn> exception) |
ADQLIterator |
adqlIterator()
Gets an iterator on the intern ADQL objects.
|
static DBColumn |
findAtMostOneColumn(java.lang.String columnName,
byte caseSensitive,
SearchColumnList list,
boolean leftList) |
static DBColumn |
findExactlyOneColumn(java.lang.String columnName,
byte caseSensitive,
SearchColumnList list,
boolean leftList) |
abstract ADQLObject |
getCopy()
Gets a (deep) copy of this ADQL object.
|
SearchColumnList |
getDBColumns()
Gets the list of all columns (~ database metadata) available in this FROM part.
|
ClauseConstraints |
getJoinCondition()
Gets the condition of this join (that's to say: the condition which follows the keyword ON).
|
java.util.Iterator<ADQLColumn> |
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).
|
abstract java.lang.String |
getJoinType()
Gets the type of this join.
|
FromContent |
getLeftTable()
Gets the left "table" of this join.
|
java.lang.String |
getName()
Gets the name of this object in ADQL.
|
TextPosition |
getPosition()
Gets the position of this object/token in the ADQL query.
|
FromContent |
getRightTable()
Gets the right "table" of this join.
|
java.util.List<ADQLTable> |
getTables()
|
java.util.List<ADQLTable> |
getTablesByAlias(java.lang.String alias,
boolean caseSensitive)
Gets all the table whose the alias is equals to the given one.
|
boolean |
hasJoinedColumns()
Tells whether this join has a list of columns to join.
|
static boolean |
isCommonColumn(DBColumn col)
Tells whether the given column is a common column (that's to say, a unification of several columns of the same name).
|
boolean |
isNatural()
Indicates whether this join is natural or not.
|
void |
setJoinCondition(ClauseConstraints cond)
Sets the condition of this join (that's to say: the condition which follows the keyword ON).
|
void |
setJoinedColumns(java.util.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).
|
void |
setLeftTable(FromContent table)
Sets the left "table" of this join.
|
void |
setNatural(boolean natural)
Lets indicate that this join is natural (it must use the table keys).
|
void |
setPosition(TextPosition position)
Set the position of this
FromContent in the given ADQL query string. |
void |
setRightTable(FromContent table)
Sets the right "table" of this join.
|
java.lang.String |
toADQL()
Gets the ADQL expression of this object.
|
protected boolean natural
protected ClauseConstraints condition
protected java.util.ArrayList<ADQLColumn> lstColumns
public ADQLJoin(FromContent left, FromContent right)
ADQLJoin
with at least two FromContent
objects:
the left and the right part of the join (usually two tables: T1 JOIN T2).left
- Left "table" of the join.right
- Right "table" of the join.public ADQLJoin(ADQLJoin toCopy) throws java.lang.Exception
toCopy
- The ADQLJoin to copy.java.lang.Exception
- If there is an error during the copy.public final boolean isNatural()
public void setNatural(boolean natural)
natural
- true means this join must be natural, false else.public final FromContent getLeftTable()
public void setLeftTable(FromContent table)
table
- The left part of the join.public final FromContent getRightTable()
public void setRightTable(FromContent table)
table
- The right part of the join.public final ClauseConstraints getJoinCondition()
public void setJoinCondition(ClauseConstraints cond)
cond
- The join condition (condition following ON).public final TextPosition getPosition()
ADQLObject
Gets the position of this object/token in the ADQL query.
By default, no position should be set.
getPosition
in interface ADQLObject
public final void setPosition(TextPosition position)
FromContent
FromContent
in the given ADQL query string.setPosition
in interface FromContent
position
- New position of this FromContent
.public final java.util.Iterator<ADQLColumn> getJoinedColumns()
public final boolean hasJoinedColumns()
public void setJoinedColumns(java.util.Collection<ADQLColumn> columns)
columns
- The joined columns.public java.lang.String getName()
ADQLObject
getName
in interface ADQLObject
public ADQLIterator adqlIterator()
ADQLObject
Gets an iterator on the intern ADQL objects.
Note:The returned iterator is particularly used by a ISearchHandler
extension to browse a whole ADQL tree.
adqlIterator
in interface ADQLObject
ADQLIterator
,
ISearchHandler
public java.lang.String toADQL()
ADQLObject
toADQL
in interface ADQLObject
public SearchColumnList getDBColumns() throws UnresolvedJoinException
FromContent
Gets the list of all columns (~ database metadata) available in this FROM part.
Note: In the most cases, this list is generated on the fly !
getDBColumns
in interface FromContent
DBColumn
s.UnresolvedJoinException
- If a join is not possible.public static final void addAllExcept(SearchColumnList itemsToAdd, SearchColumnList target, java.util.Map<java.lang.String,DBCommonColumn> exception)
public static final DBColumn findExactlyOneColumn(java.lang.String columnName, byte caseSensitive, SearchColumnList list, boolean leftList) throws UnresolvedJoinException
UnresolvedJoinException
public static final DBColumn findAtMostOneColumn(java.lang.String columnName, byte caseSensitive, SearchColumnList list, boolean leftList) throws UnresolvedJoinException
UnresolvedJoinException
public static final boolean isCommonColumn(DBColumn col)
col
- A DBColumn.public java.util.List<ADQLTable> getTables()
FromContent
getTables
in interface FromContent
ADQLTable
s found.public java.util.List<ADQLTable> getTablesByAlias(java.lang.String alias, boolean caseSensitive)
FromContent
Gets 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 ADQLTable
objects exits with the same alias (particularly if there are JOIN).
getTablesByAlias
in interface FromContent
alias
- Alias of the table(s) to get.caseSensitive
- true if the research must be made with case-sensitivity, false otherwise.public abstract java.lang.String getJoinType()
public abstract ADQLObject getCopy() throws java.lang.Exception
ADQLObject
getCopy
in interface ADQLObject
java.lang.Exception
- If there is any error during the copy.