Commit 0e214101 authored by Maxym Borodenko's avatar Maxym Borodenko

New implementation with AccessionProcessor

parent c0fa285b
......@@ -442,7 +442,7 @@
<dependency>
<groupId>com.healthmarketscience.jackcess</groupId>
<artifactId>jackcess</artifactId>
<version>2.1.6</version>
<version>2.2.2</version>
</dependency>
......
......@@ -258,27 +258,6 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
}, rowCallbackHandler);
}
@Override
public ResultSet resultSetOfAccessions(final AppliedFilters filter) throws SQLException {
final DirectMysqlQuery directQuery = new DirectMysqlQuery("accession", "a");
directQuery.innerJoin("acce", "acce", "acce.id=a.id");
directQuery.outerJoin("taxonomy2", "t", "t.id=a.taxonomyId2");
directQuery.jsonFilter(filter, new MethodResolver() {
@Override
public Method getMethod(final long methodId) {
return GenesysLowlevelRepositoryCustomImpl.this.methodRepository.findOne(methodId);
}
});
final Connection con = this.jdbcTemplate.getDataSource().getConnection();
final PreparedStatement stmt = con.prepareStatement(directQuery
.getQuery("a.id, acce.uuid, a.instCode, a.acceNumb, t.genus, t.species, t.taxonName, a.orgCty, a.acqSrc, a.acqDate, a.mlsStat, a.available, a.historic, a.storage, a.sampStat, a.duplSite, acce.createdBy, acce.createdDate, acce.lastModifiedBy, acce.lastModifiedDate, a.doi"));
final ArgumentPreparedStatementSetter apss = new ArgumentPreparedStatementSetter(directQuery.getParameters());
apss.setValues(stmt);
final ResultSet rs = stmt.executeQuery();
return rs;
}
@Override
public void listAccessionIds(final AppliedFilters filter, final Sort sort, final RowCallbackHandler rowCallbackHandler) {
final DirectMysqlQuery directQuery = new DirectMysqlQuery("accession", "a");
......@@ -333,25 +312,6 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
}, rowCallbackHandler);
}
@Override
public ResultSet resultSetOfAccessionsGeo(final AppliedFilters filter) throws SQLException {
final DirectMysqlQuery directQuery = new DirectMysqlQuery("accessiongeo", "geo");
directQuery.innerJoin("accession", "a", "a.id=geo.accessionId");
directQuery.jsonFilter(filter, new MethodResolver() {
@Override
public Method getMethod(final long methodId) {
return GenesysLowlevelRepositoryCustomImpl.this.methodRepository.findOne(methodId);
}
});
final Connection con = this.jdbcTemplate.getDataSource().getConnection();
final PreparedStatement stmt = con.prepareStatement(directQuery.getQuery("a.id, geo.latitude, geo.longitude, geo.elevation, geo.datum, geo.uncertainty, geo.method, geo.version"));
final ArgumentPreparedStatementSetter apss = new ArgumentPreparedStatementSetter(directQuery.getParameters());
apss.setValues(stmt);
final ResultSet rs = stmt.executeQuery();
return rs;
}
@Override
public void listAccessionsAlias(final AppliedFilters filter, final RowCallbackHandler rowCallbackHandler) {
// from n inner join accession a on a.id=n.accessionId
......@@ -379,25 +339,6 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
}, rowCallbackHandler);
}
@Override
public ResultSet resultSetOfAccessionsAlias(final AppliedFilters filter) throws SQLException {
final DirectMysqlQuery directQuery = new DirectMysqlQuery("accessionalias", "n");
directQuery.innerJoin("accession", "a", "a.id=n.accessionId");
directQuery.jsonFilter(filter, new MethodResolver() {
@Override
public Method getMethod(final long methodId) {
return GenesysLowlevelRepositoryCustomImpl.this.methodRepository.findOne(methodId);
}
});
final Connection con = this.jdbcTemplate.getDataSource().getConnection();
final PreparedStatement stmt = con.prepareStatement(directQuery.getQuery("a.id, n.instCode, n.name, n.aliasType, n.lang, n.version"));
final ArgumentPreparedStatementSetter apss = new ArgumentPreparedStatementSetter(directQuery.getParameters());
apss.setValues(stmt);
final ResultSet rs = stmt.executeQuery();
return rs;
}
@Override
public void listAccessionsAlias(final RowCallbackHandler rowCallbackHandler) {
this.jdbcTemplate.query(new PreparedStatementCreator() {
......@@ -441,26 +382,6 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
}, rowCallbackHandler);
}
@Override
public ResultSet resultSetOfAccessionsColl(final AppliedFilters filter) throws SQLException {
final DirectMysqlQuery directQuery = new DirectMysqlQuery("accessioncollect", "coll");
directQuery.innerJoin("accession", "a", "a.id=coll.accessionId");
directQuery.jsonFilter(filter, new MethodResolver() {
@Override
public Method getMethod(final long methodId) {
return GenesysLowlevelRepositoryCustomImpl.this.methodRepository.findOne(methodId);
}
});
final Connection con = this.jdbcTemplate.getDataSource().getConnection();
final PreparedStatement stmt = con.prepareStatement(directQuery
.getQuery("a.id, coll.collMissId, coll.collNumb, coll.collDate, coll.collSrc, coll.collSite, coll.collCode, coll.collName, coll.collInstAddress, coll.version"));
final ArgumentPreparedStatementSetter apss = new ArgumentPreparedStatementSetter(directQuery.getParameters());
apss.setValues(stmt);
final ResultSet rs = stmt.executeQuery();
return rs;
}
@Override
public void listMetadataAccessions(final long id, final RowCallbackHandler rowCallbackHandler) {
this.jdbcTemplate.query(new PreparedStatementCreator() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment