List of usage examples for org.apache.commons.collections.map LRUMap containsKey
public boolean containsKey(Object key)
From source file:org.lexevs.dao.database.operation.transitivity.DefaultTransitivityBuilder.java
private boolean insertIntoTransitiveClosure(String associationPredicateId, StringTuple sourceCode, StringTuple targetCode, LRUMap insertedCache, String path, BatchInsertController batchInsertController) { String key = sourceCode.code + ":" + sourceCode.namespace + ":" + targetCode.code + ":" + targetCode.namespace;/* www .j a va 2 s . c o m*/ boolean iInserted = false; if (!insertedCache.containsKey(key)) { // if it is not loaded in the main table, or already loaded // in the transitive table insertedCache.put(key, null); iInserted = true; batchInsertController.insertIntoTransitiveClosure(sourceCode.code, sourceCode.namespace, targetCode.code, targetCode.namespace, associationPredicateId, path); } return iInserted; }
From source file:org.LexGrid.util.sql.lgTables.SQLTableUtilities.java
private boolean insertIntoTransitiveClosure(String codingScheme, PreparedStatement insertTransitiveStmt, StringTriple association, StringTriple sourceCode, StringTriple targetCode, LRUMap insertedCache) { String key = sourceCode.a + ":" + sourceCode.c + ":" + targetCode.a + ":" + targetCode.c; boolean iInserted = false; if (!insertedCache.containsKey(key)) { // if it is not loaded in the main table, or already loaded // in the transitive table try {/*from w w w . j av a 2 s . c om*/ int k = 1; insertTransitiveStmt.setString(k++, codingScheme); insertTransitiveStmt.setString(k++, association.a); insertTransitiveStmt.setString(k++, association.c); insertTransitiveStmt.setString(k++, association.b); insertTransitiveStmt.setString(k++, sourceCode.a); insertTransitiveStmt.setString(k++, sourceCode.c); insertTransitiveStmt.setString(k++, targetCode.a); insertTransitiveStmt.setString(k++, targetCode.c); insertTransitiveStmt.execute(); insertedCache.put(key, null); iInserted = true; } catch (SQLException e) { log.debug(e); // assume an exception means that it is a duplicate // error. ignore. // cheaper to do this (in theory) than check ahead of // time - duplicates should // be abnormal, not the rule. And we have a cache now. } } return iInserted; }