Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
2042311b
Commit
2042311b
authored
Oct 03, 2018
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Download DwCA archive failed
parent
8af0a8d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
45 deletions
+16
-45
src/main/java/org/genesys2/server/persistence/GenesysLowlevelRepository.java
...enesys2/server/persistence/GenesysLowlevelRepository.java
+0
-4
src/main/java/org/genesys2/server/service/impl/GenesysLowlevelRepositoryCustomImpl.java
...ver/service/impl/GenesysLowlevelRepositoryCustomImpl.java
+13
-39
src/main/java/org/genesys2/server/service/impl/GenesysServiceImpl.java
.../org/genesys2/server/service/impl/GenesysServiceImpl.java
+3
-2
No files found.
src/main/java/org/genesys2/server/persistence/GenesysLowlevelRepository.java
View file @
2042311b
...
...
@@ -50,8 +50,6 @@ public interface GenesysLowlevelRepository {
void
listAccessionsAlias
(
AppliedFilters
filter
,
RowCallbackHandler
rowCallbackHandler
);
void
listAccessionsAccenames
(
RowCallbackHandler
rowCallbackHandler
);
void
listAccessionsAlias
(
RowCallbackHandler
rowCallbackHandler
);
int
countAccessions
(
AppliedFilters
filter
);
...
...
@@ -60,6 +58,4 @@ public interface GenesysLowlevelRepository {
void
updateAccessionSequentialNumber
(
List
<
Object
[]>
data
);
void
listFullTextSearchEntitiesIds
(
String
className
,
RowCallbackHandler
rowCallbackHandler
);
}
src/main/java/org/genesys2/server/service/impl/GenesysLowlevelRepositoryCustomImpl.java
View file @
2042311b
...
...
@@ -244,8 +244,8 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
@Override
public
PreparedStatement
createPreparedStatement
(
final
Connection
con
)
throws
SQLException
{
final
PreparedStatement
stmt
=
con
.
prepareStatement
(
directQuery
.
getQuery
(
"a.id, acce.uuid, a.instCode, a.acceNumb, a.doi, t.genus, t.species, t.spAuthor, t.subtaxa, t.subtAuthor, t.taxonName, a.orgCty, "
+
"a.acqSrc, a.acqDate, a.mlsStat, a.available, a.historic, a.storage
, a.sampStat, a.duplSite
, "
+
.
getQuery
(
"a.id, acce.uuid, a.instCode, a.acceNumb, a.doi, t.genus, t.species, t.spAuthor, t.subtaxa, t.subtAuthor, t.taxonName, a.or
i
gCty, "
+
"a.acqSrc, a.acqDate, a.mlsStat, a.available, a.historic, a.storage
Str, a.sampStat, a.duplSiteStr
, "
+
"acce.createdBy, acce.createdDate, acce.lastModifiedBy, acce.lastModifiedDate"
));
final
ArgumentPreparedStatementSetter
apss
=
new
ArgumentPreparedStatementSetter
(
directQuery
.
getParameters
());
...
...
@@ -286,8 +286,9 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
@Override
public
void
listAccessionsGeo
(
final
AppliedFilters
filter
,
final
RowCallbackHandler
rowCallbackHandler
)
{
final
DirectMysqlQuery
directQuery
=
new
DirectMysqlQuery
(
"accessiongeo"
,
"geo"
);
directQuery
.
innerJoin
(
"accession"
,
"a"
,
"a.id=geo.accessionId"
);
final
DirectMysqlQuery
directQuery
=
new
DirectMysqlQuery
(
"acce"
,
"acce"
);
directQuery
.
innerJoin
(
"accession_geo"
,
"geo"
,
"geo.id=acce.geoId"
);
directQuery
.
innerJoin
(
"accession"
,
"a"
,
"a.id=acce.id"
);
directQuery
.
jsonFilter
(
filter
,
new
MethodResolver
()
{
@Override
public
Method
getMethod
(
final
long
methodId
)
{
...
...
@@ -314,7 +315,7 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
@Override
public
void
listAccessionsAlias
(
final
AppliedFilters
filter
,
final
RowCallbackHandler
rowCallbackHandler
)
{
// from n inner join accession a on a.id=n.accessionId
final
DirectMysqlQuery
directQuery
=
new
DirectMysqlQuery
(
"accessionalias"
,
"n"
);
final
DirectMysqlQuery
directQuery
=
new
DirectMysqlQuery
(
"accession
_
alias"
,
"n"
);
directQuery
.
innerJoin
(
"accession"
,
"a"
,
"a.id=n.accessionId"
);
directQuery
.
jsonFilter
(
filter
,
new
MethodResolver
()
{
@Override
...
...
@@ -326,7 +327,7 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
this
.
jdbcTemplate
.
query
(
new
PreparedStatementCreator
()
{
@Override
public
PreparedStatement
createPreparedStatement
(
final
Connection
con
)
throws
SQLException
{
final
PreparedStatement
stmt
=
con
.
prepareStatement
(
directQuery
.
getQuery
(
"a.id, n.
instCode
, n.name, n.aliasType, n.lang, n.version"
));
final
PreparedStatement
stmt
=
con
.
prepareStatement
(
directQuery
.
getQuery
(
"a.id, n.
usedBy
, n.name, n.aliasType, n.lang, n.version"
));
final
ArgumentPreparedStatementSetter
apss
=
new
ArgumentPreparedStatementSetter
(
directQuery
.
getParameters
());
apss
.
setValues
(
stmt
);
...
...
@@ -344,7 +345,7 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
@Override
public
PreparedStatement
createPreparedStatement
(
final
Connection
con
)
throws
SQLException
{
final
PreparedStatement
stmt
=
con
.
prepareStatement
(
"select n.accessionId, n.instCode, n.name, n.aliasType, n.lang, n.version, n.id from accessionalias n order by n.accessionId"
);
.
prepareStatement
(
"select n.accessionId, n.instCode, n.name, n.aliasType, n.lang, n.version, n.id from accession
_
alias n order by n.accessionId"
);
// Set mysql JConnector to stream results
stmt
.
setFetchSize
(
Integer
.
MIN_VALUE
);
return
stmt
;
...
...
@@ -354,10 +355,9 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
@Override
public
void
listAccessionsColl
(
final
AppliedFilters
filter
,
final
RowCallbackHandler
rowCallbackHandler
)
{
// from accessioncollect coll inner join accession a on
// a.id=coll.accessionId
final
DirectMysqlQuery
directQuery
=
new
DirectMysqlQuery
(
"accessioncollect"
,
"coll"
);
directQuery
.
innerJoin
(
"accession"
,
"a"
,
"a.id=coll.accessionId"
);
final
DirectMysqlQuery
directQuery
=
new
DirectMysqlQuery
(
"acce"
,
"acce"
);
directQuery
.
innerJoin
(
"accession_collect"
,
"coll"
,
"coll.id=acce.collId"
);
directQuery
.
innerJoin
(
"accession"
,
"a"
,
"a.id=acce.id"
);
directQuery
.
jsonFilter
(
filter
,
new
MethodResolver
()
{
@Override
public
Method
getMethod
(
final
long
methodId
)
{
...
...
@@ -369,7 +369,8 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
@Override
public
PreparedStatement
createPreparedStatement
(
final
Connection
con
)
throws
SQLException
{
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"
));
//.getQuery("a.id, coll.collMissId, coll.collNumb, coll.collDate, coll.collSrc, coll.collSite, coll.collCode, coll.collName, coll.collInstAddress, coll.version"));
.
getQuery
(
"a.id, coll.collMissId, coll.collNumb, coll.collDate, coll.collSrc, coll.collSite, coll.version"
));
final
ArgumentPreparedStatementSetter
apss
=
new
ArgumentPreparedStatementSetter
(
directQuery
.
getParameters
());
apss
.
setValues
(
stmt
);
...
...
@@ -396,19 +397,6 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
},
rowCallbackHandler
);
}
@Override
public
void
listAccessionsAccenames
(
final
RowCallbackHandler
rowCallbackHandler
)
{
this
.
jdbcTemplate
.
query
(
new
PreparedStatementCreator
()
{
@Override
public
PreparedStatement
createPreparedStatement
(
final
Connection
con
)
throws
SQLException
{
final
PreparedStatement
stmt
=
con
.
prepareStatement
(
"select accessionId, names, otherIds from accessionname"
);
// Set mysql JConnector to stream results
stmt
.
setFetchSize
(
Integer
.
MIN_VALUE
);
return
stmt
;
}
},
rowCallbackHandler
);
}
/**
* Data[] = accessionId, acceNumb and seqNo
*/
...
...
@@ -431,18 +419,4 @@ public class GenesysLowlevelRepositoryCustomImpl implements GenesysLowlevelRepos
}
});
}
@Override
public
void
listFullTextSearchEntitiesIds
(
String
className
,
RowCallbackHandler
rowCallbackHandler
)
{
this
.
jdbcTemplate
.
query
(
new
PreparedStatementCreator
()
{
@Override
public
PreparedStatement
createPreparedStatement
(
final
Connection
con
)
throws
SQLException
{
String
query
=
"select * from "
+
className
.
toLowerCase
();
// Set mysql JConnector to stream results
// stmt.setFetchSize(Integer.MIN_VALUE);
return
con
.
prepareStatement
(
query
);
}
},
rowCallbackHandler
);
}
}
src/main/java/org/genesys2/server/service/impl/GenesysServiceImpl.java
View file @
2042311b
...
...
@@ -1124,7 +1124,7 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
private
void
writeAccessionsCore
(
final
AppliedFilters
filters
,
ZipOutputStream
zos
)
throws
IOException
{
@SuppressWarnings
(
"resource"
)
final
CSVWriter
csv
=
new
CSVWriter
(
new
BufferedWriter
(
new
OutputStreamWriter
(
zos
)),
','
,
'"'
,
'\\'
,
"\n"
);
csv
.
writeNext
(
new
String
[]
{
"genesysId"
,
"uuid"
,
"instCode"
,
"acceNumb"
,
"doi"
,
"genus"
,
"species"
,
"spAuthor"
,
"subtaxa"
,
"subtAuthor"
,
"fullTaxa"
,
"orgCty"
,
"acqSrc"
,
"acqDate"
,
"mlsStat"
,
"available"
,
"historic"
,
csv
.
writeNext
(
new
String
[]
{
"genesysId"
,
"uuid"
,
"instCode"
,
"acceNumb"
,
"doi"
,
"genus"
,
"species"
,
"spAuthor"
,
"subtaxa"
,
"subtAuthor"
,
"fullTaxa"
,
"or
i
gCty"
,
"acqSrc"
,
"acqDate"
,
"mlsStat"
,
"available"
,
"historic"
,
"storage"
,
"sampStat"
,
"duplSite"
,
"createdBy"
,
"createdDate"
,
"lastModifiedBy"
,
"lastModifiedDate"
});
final
ResultSetHelper
csvResultsetHelper
=
new
CSVResultSetHelper
();
...
...
@@ -1215,7 +1215,8 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
private
void
writeAccessionsColl
(
final
AppliedFilters
filters
,
ZipOutputStream
zos
)
throws
IOException
{
@SuppressWarnings
(
"resource"
)
final
CSVWriter
csv
=
new
CSVWriter
(
new
BufferedWriter
(
new
OutputStreamWriter
(
zos
)),
','
,
'"'
,
'\\'
,
"\n"
);
csv
.
writeNext
(
new
String
[]
{
"genesysId"
,
"collMissId"
,
"collNumb"
,
"collDate"
,
"collSrc"
,
"collSite"
,
"collCode"
,
"collName"
,
"collInstAddress"
,
"version"
});
// csv.writeNext(new String[] { "genesysId", "collMissId", "collNumb", "collDate", "collSrc", "collSite", "collCode", "collName", "collInstAddress", "version" });
csv
.
writeNext
(
new
String
[]
{
"genesysId"
,
"collMissId"
,
"collNumb"
,
"collDate"
,
"collSrc"
,
"collSite"
,
"version"
});
final
ResultSetHelper
csvResultsetHelper
=
new
ResultSetHelperService
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment