Class TableLink
- java.lang.Object
-
- org.castor.cpa.persistence.sql.engine.info.TableLink
-
public final class TableLink extends java.lang.Object
Class representing relations between tables. There are 3 possible types of tableLinks: SIMPLE: Used for 1:1 relations. No join will be added to the query. Just the startColumns will be added to the query. MANY_KEY: Used to express 1:m relations. Join will be added to the query. MANY_TABLE: Used to express n:m relations. Join will be added to the query.- Version:
- $Revision: 8469 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
- Author:
- Dennis Butterstein, Ralf Joachim
-
-
Field Summary
Fields Modifier and Type Field Description static int
MANY_TO_MANY
Constant defining many table relation (n:m).static int
REFERED_BY
Constant defining many key relation (1:m).static int
REFERS_TO
Constant defining simple table-link (1:1).
-
Constructor Summary
Constructors Modifier Constructor Description protected
TableLink(TableInfo targetTable, int relationType, java.lang.String tableAlias, java.util.List<ColumnInfo> startColumns, int fieldIndex)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTargetCol(ColumnInfo col)
Method adding a single targetCol.void
addTargetCols(java.util.List<ColumnInfo> cols)
Method adding a list of targetCols.int
getFieldIndex()
Method returning fieldIndex currently set.java.util.List<java.lang.String>
getManyKey()
Method returning many key.int
getRelationType()
Method returning relation type currently set.java.util.List<ColumnInfo>
getStartCols()
Method returning a list of start columns.java.lang.String
getTableAlias()
Method returning the table alias to be used for a potential join.java.util.List<ColumnInfo>
getTargetCols()
Method returning a list of target columns.TableInfo
getTargetTable()
Method returning the right table of the join.void
setManyKey(java.util.List<java.lang.String> manyKey)
Method given setting many key.
-
-
-
Field Detail
-
REFERS_TO
public static final int REFERS_TO
Constant defining simple table-link (1:1).- See Also:
- Constant Field Values
-
REFERED_BY
public static final int REFERED_BY
Constant defining many key relation (1:m).- See Also:
- Constant Field Values
-
MANY_TO_MANY
public static final int MANY_TO_MANY
Constant defining many table relation (n:m).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TableLink
protected TableLink(TableInfo targetTable, int relationType, java.lang.String tableAlias, java.util.List<ColumnInfo> startColumns, int fieldIndex)
Constructor.- Parameters:
targetTable
- The right table of the join.relationType
- The type of the relation.tableAlias
- Alias of the table.startColumns
- Columns of the left table needed for joins.fieldIndex
- Index of the startColumns.
-
-
Method Detail
-
getStartCols
public java.util.List<ColumnInfo> getStartCols()
Method returning a list of start columns.- Returns:
- List of start columns.
-
addTargetCol
public void addTargetCol(ColumnInfo col)
Method adding a single targetCol.- Parameters:
col
- Column to be added as a target column.
-
addTargetCols
public void addTargetCols(java.util.List<ColumnInfo> cols)
Method adding a list of targetCols.- Parameters:
cols
- List of columns to be added as target columns.
-
getTargetCols
public java.util.List<ColumnInfo> getTargetCols()
Method returning a list of target columns.- Returns:
- List of target columns of the join.
-
getTargetTable
public TableInfo getTargetTable()
Method returning the right table of the join.- Returns:
- TargetTable of the join.
-
getTableAlias
public java.lang.String getTableAlias()
Method returning the table alias to be used for a potential join.- Returns:
- The tableAlias to be used for a join.
-
getRelationType
public int getRelationType()
Method returning relation type currently set.- Returns:
- Relation type currently set.
-
setManyKey
public void setManyKey(java.util.List<java.lang.String> manyKey)
Method given setting many key.- Parameters:
manyKey
- The many key to be set.
-
getManyKey
public java.util.List<java.lang.String> getManyKey()
Method returning many key.- Returns:
- Many key currently set.
-
getFieldIndex
public int getFieldIndex()
Method returning fieldIndex currently set.- Returns:
- FieldIndex currently set.
-
-