public class SQLIdMapper extends SQLListener implements IDMapper, IDMapperCapabilities
| Modifier and Type | Field and Description |
|---|---|
protected CodeMapper |
codeMapper
Map between IdSysCodePair and Xref or DataSources
|
protected static int |
DEFAULT_LIMIT |
autoIncrement, FULLNAME_LENGTH, ID_COLUMN_NAME, ID_LENGTH, MAPPING_SET_ID_COLUMN_NAME, MAPPING_SET_TABLE_NAME, MAPPING_URI_LENGTH, SOURCE_DATASOURCE_COLUMN_NAME, SQL_COMPAT_VERSION, SYSCODE_LENGTH, TARGET_DATASOURCE_COLUMN_NAMEpossibleOpenConnection, sqlAccess| Constructor and Description |
|---|
SQLIdMapper(boolean dropTables,
CodeMapper codeMapper) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendLimitConditions(StringBuilder query,
Integer position,
Integer limit)
Adds the limit condition if this is the support method for limitng the number of results.
|
protected void |
appendMappingJoinMapping(StringBuilder query) |
protected void |
appendSourceIdSysCodePair(StringBuilder query,
IdSysCodePair ref)
Add a condition to the query that only mappings with a specific source IdSysCodePair should be used.
|
protected void |
appendSourceXref(StringBuilder query,
String id,
String sysCode)
Add a condition to the query that only mappings with a specific source Xref should be used.
|
protected void |
appendTopConditions(StringBuilder query,
Integer position,
Integer limit)
Adds the top condition if this is the support method for limitng the number of results.
|
protected boolean |
badXref(Xref ref)
Check if the Xref is invalid in some way.
|
void |
close() |
Set<Xref> |
freeSearch(String text,
int limit) |
IDMapperCapabilities |
getCapabilities() |
Set<String> |
getKeys() |
String |
getProperty(String key) |
Set<DataSource> |
getSupportedSrcDataSources() |
Set<DataSource> |
getSupportedTgtDataSources() |
protected boolean |
IdSysCodePairExists(IdSysCodePair ref) |
boolean |
isConnected() |
boolean |
isFreeSearchSupported() |
boolean |
isMappingSupported(DataSource src,
DataSource tgt) |
Map<Xref,Set<Xref>> |
mapID(Collection<Xref> srcXrefs,
DataSource... tgtDataSources) |
Set<Xref> |
mapID(Xref xref,
DataSource... tgtDataSources) |
Set<Xref> |
mapID(Xref xref,
DataSource tgtDataSource)
Get all cross-references for the given entity, restricting the
result to contain only references from the given set of data sources.
|
protected String |
toCode(DataSource tgtDataSource) |
protected String[] |
toCodes(DataSource[] tgtDataSources) |
protected IdSysCodePair |
toIdSysCodePair(Xref xref) |
protected Set<Xref> |
toXrefs(Set<IdSysCodePair> pairs) |
boolean |
xrefExists(Xref xref) |
closeInput, createMappingSetTable, createSQLTables, dropSQLTables, dropTable, getAutoInc, getDataSourceKey, insertLink, putProperty, registerMappingSetclose, closeConnection, commitTransaction, createPreparedStatement, createStatement, insertEscpaeCharacters, rollbackTransaction, startTransactionprotected static final int DEFAULT_LIMIT
protected final CodeMapper codeMapper
public SQLIdMapper(boolean dropTables,
CodeMapper codeMapper)
throws BridgeDBException
BridgeDBExceptionpublic Map<Xref,Set<Xref>> mapID(Collection<Xref> srcXrefs, DataSource... tgtDataSources) throws IDMapperException
mapID in interface IDMapperIDMapperExceptionpublic Set<Xref> mapID(Xref xref, DataSource... tgtDataSources) throws BridgeDBException
mapID in interface IDMapperBridgeDBExceptionpublic Set<Xref> mapID(Xref xref, DataSource tgtDataSource) throws BridgeDBException
ref - the entity to get cross-references for.tgtDataSources - target ID types/data source. Can not be nullIDMapperException - if the mapping service is (temporarily) unavailableBridgeDBExceptionpublic boolean xrefExists(Xref xref) throws BridgeDBException
xrefExists in interface IDMapperBridgeDBExceptionprotected boolean IdSysCodePairExists(IdSysCodePair ref) throws BridgeDBException
BridgeDBExceptionpublic Set<Xref> freeSearch(String text, int limit) throws BridgeDBException
freeSearch in interface IDMapperBridgeDBExceptionpublic IDMapperCapabilities getCapabilities()
getCapabilities in interface IDMapperpublic boolean isConnected()
isConnected in interface IDMapperpublic boolean isFreeSearchSupported()
isFreeSearchSupported in interface IDMapperCapabilitiespublic Set<DataSource> getSupportedSrcDataSources() throws BridgeDBException
getSupportedSrcDataSources in interface IDMapperCapabilitiesBridgeDBExceptionpublic Set<DataSource> getSupportedTgtDataSources() throws BridgeDBException
getSupportedTgtDataSources in interface IDMapperCapabilitiesBridgeDBExceptionpublic boolean isMappingSupported(DataSource src, DataSource tgt) throws BridgeDBException
isMappingSupported in interface IDMapperCapabilitiesBridgeDBExceptionpublic String getProperty(String key)
getProperty in interface IDMapperCapabilitiespublic Set<String> getKeys()
getKeys in interface IDMapperCapabilitiesprotected final boolean badXref(Xref ref)
For example if it is null or if either the Id or DataSource part is null.
ref - protected final void appendSourceIdSysCodePair(StringBuilder query, IdSysCodePair ref)
query - Query to add to.ref - IdSysCodePair that forms the base of the condition.protected final void appendSourceXref(StringBuilder query, String id, String sysCode)
query - Query to add to.ref - Xref that forms the base of the condition.protected void appendLimitConditions(StringBuilder query, Integer position, Integer limit)
System such as MYSQL use a Limit clause at the end of the query. Where applicable this is added here.
query - Query to add Limit toposition - The offset of the fragment of results to returnlimit - The size of the fragment of results to returnprotected void appendTopConditions(StringBuilder query, Integer position, Integer limit)
System such as Virtuosos use a Top clause directly after the select. Where applicable this is added here.
query - Query to add TOP toposition - The offset of the fragment of results to returnlimit - The size of the fragment of results to returnprotected final void appendMappingJoinMapping(StringBuilder query)
protected final String[] toCodes(DataSource[] tgtDataSources)
protected final IdSysCodePair toIdSysCodePair(Xref xref) throws BridgeDBException
BridgeDBExceptionprotected final Set<Xref> toXrefs(Set<IdSysCodePair> pairs) throws BridgeDBException
BridgeDBExceptionprotected final String toCode(DataSource tgtDataSource)
Copyright © 2006–2017 BridgeDb project. All rights reserved.