| java.lang.Object org.compass.gps.device.jdbc.mapping.AbstractColumnMapping org.compass.gps.device.jdbc.mapping.AbstractColumnToPropertyMapping org.compass.gps.device.jdbc.mapping.AbstractConstantColumnToPropertyMapping org.compass.gps.device.jdbc.mapping.IdColumnToPropertyMapping
IdColumnToPropertyMapping | public class IdColumnToPropertyMapping extends AbstractConstantColumnToPropertyMapping (Code) | | Maps an id column to Resource Property . The id column is the column that identifies
or is part of columns that identifies the ResultSet . In a
table, it is the table primary keys.
The PropertyIndex is Property.Index.UN_TOKENIZED .
the PropertyStore is Property.Store.YES , the
PropertyTermVector is Property.TermVector.NO
and the Boost is 1.0f .
The id mapping also holds an additional mapping, the
columnNameForVersion mapping. When performing the mirror
operation (if enabled), it is the id column name that is added to the select
query in order to filter by the specified ids. For example, if the select
query is (for a PARENT and CHILD table relationship):
select p.id as parent_id, p.first_name as parent_first_name, p.last_name as parent_last_name, p.version as parent_version, COALESCE(c.id, 0) as child_id, c.first_name as child_first_name, c.last_name child_last_name, COALESCE(c.version, 0) as child_version from parent p left join child c on p.id = c.parent_id
than when performing the query to get the values for certain values of ids
(the parent and child ids), the column names that will be used are:
p.id and COALESCE(c.id, 0) . And the actual
where clause will be: where p.id = ? and COALESCE(c.id, 0) = ? .
Note, that the id column name is parent_id , and
child_id . They are used for reading the id values, not
constructing queries.
author: kimchy |
Constructor Summary | |
public | IdColumnToPropertyMapping() Creates an empty id column to property mapping. | public | IdColumnToPropertyMapping(String columnName, String propertyName) Creates a new Id column to propery mapping given the column name and the
property name. | public | IdColumnToPropertyMapping(String columnName, String propertyName, String columnNameForVersion) Creates a new Id column to property mapping given the column name, the
property name, and the column name for the versioning (the mirror
operation). | public | IdColumnToPropertyMapping(int columnIndex, String propertyName) Creates a new Id Column to property mapping given the column index and
the property name. | public | IdColumnToPropertyMapping(int columnIndex, String propertyName, String columnNameForVersion) Creates a new Id Column to property mapping given the column index, the
property name, and the column name for the versioning (the mirror
operation). |
Method Summary | |
public String | getColumnNameForVersion() Returns the id column name that will be used in the dynamically created
where clause with the original select query. | public void | setColumnNameForVersion(String columnNameForVersion) Sets the id column name that will be used in the dynamically created
where clause with the original select query. |
IdColumnToPropertyMapping | public IdColumnToPropertyMapping()(Code) | | Creates an empty id column to property mapping. Must set at least the
colum index or colum name, and the property name. If using mirroring,
must set the column name for version as well.
|
IdColumnToPropertyMapping | public IdColumnToPropertyMapping(String columnName, String propertyName)(Code) | | Creates a new Id column to propery mapping given the column name and the
property name. The column name will also be used as the
columnNameForVersion value.
Parameters: columnName - The id column name that will be used to look up the id value(also acts as the columnNameForVersion). Parameters: propertyName - The Compass Resource Property name. |
IdColumnToPropertyMapping | public IdColumnToPropertyMapping(String columnName, String propertyName, String columnNameForVersion)(Code) | | Creates a new Id column to property mapping given the column name, the
property name, and the column name for the versioning (the mirror
operation).
Parameters: columnName - The id column name that will be used to look up the id value. Parameters: propertyName - The Compass Resource Property name. Parameters: columnNameForVersion - The id column name that will be used in the dynamicallycreated where clause with the original select query. |
IdColumnToPropertyMapping | public IdColumnToPropertyMapping(int columnIndex, String propertyName)(Code) | | Creates a new Id Column to property mapping given the column index and
the property name. Note that the column name for versioning will be null,
so if mirroring will be enabled, it must be set.
Parameters: columnIndex - The id column index that will be used to look up the id value. Parameters: propertyName - The Compass Resource Property name. |
IdColumnToPropertyMapping | public IdColumnToPropertyMapping(int columnIndex, String propertyName, String columnNameForVersion)(Code) | | Creates a new Id Column to property mapping given the column index, the
property name, and the column name for the versioning (the mirror
operation).
Parameters: columnIndex - The id column index that will be used to look up the id value. Parameters: propertyName - The Compass Resource Property name. Parameters: columnNameForVersion - The id column name that will be used in the dynamicallycreated where clause with the original select query. |
getColumnNameForVersion | public String getColumnNameForVersion()(Code) | | Returns the id column name that will be used in the dynamically created
where clause with the original select query.
|
setColumnNameForVersion | public void setColumnNameForVersion(String columnNameForVersion)(Code) | | Sets the id column name that will be used in the dynamically created
where clause with the original select query.
Parameters: columnNameForVersion - The id column name that will be used in the dynamicallycreated where clause with the original select query. |
|
|