Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
33f36d56
Commit
33f36d56
authored
Jan 02, 2015
by
Matija Obreza
Browse files
Don't join FaoInstitute if not needed, avoid NPE in #sort
parent
1896e3d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/service/impl/DirectMysqlQuery.java
View file @
33f36d56
...
...
@@ -99,28 +99,28 @@ public class DirectMysqlQuery {
protected
DirectMysqlQuery
join
(
AppliedFilters
filters
)
{
if
(
hasFilter
(
filters
,
FilterConstants
.
CROPS
)
||
hasFilter
(
filters
,
FilterConstants
.
TAXONOMY_GENUS
)
||
hasFilter
(
filters
,
FilterConstants
.
TAXONOMY_SPECIES
)
||
hasFilter
(
filters
,
FilterConstants
.
TAXONOMY_SCINAME
))
{
innerJoin
(
"taxonomy2"
,
"t"
,
"t.id=a.taxonomyId2"
);
if
(
hasFilter
(
filters
,
FilterConstants
.
CROPS
))
{
innerJoin
(
"croptaxonomy"
,
"ct"
,
"ct.taxonomyId=t.id"
);
innerJoin
(
"crop"
,
null
,
"crop.id=ct.cropId"
);
}
}
//
if (hasFilter(filters, FilterConstants.ORGCTY_ISO3)) {
//
innerJoin("country", "cty", "cty.id=a.orgCtyId");
//
}
if
(
hasFilter
(
filters
,
FilterConstants
.
INSTCODE
)
||
hasFilter
(
filters
,
FilterConstants
.
INSTITUTE_COUNTRY_ISO3
)
//
if (hasFilter(filters, FilterConstants.ORGCTY_ISO3)) {
//
innerJoin("country", "cty", "cty.id=a.orgCtyId");
//
}
if
(
/*
hasFilter(filters, FilterConstants.INSTCODE) ||
*/
hasFilter
(
filters
,
FilterConstants
.
INSTITUTE_COUNTRY_ISO3
)
||
hasFilter
(
filters
,
FilterConstants
.
INSTITUTE_NETWORK
))
{
innerJoin
(
"faoinstitute"
,
"fao"
,
"fao.id=a.instituteId"
);
if
(
hasFilter
(
filters
,
FilterConstants
.
INSTITUTE_COUNTRY_ISO3
))
{
innerJoin
(
"country"
,
"faocty"
,
"faocty.id=fao.countryId"
);
}
if
(
hasFilter
(
filters
,
FilterConstants
.
INSTITUTE_NETWORK
))
{
innerJoin
(
"organizationinstitute"
,
"oi"
,
"oi.instituteId=fao.id"
);
innerJoin
(
"organization"
,
"org"
,
"org.id=oi.organizationId"
);
...
...
@@ -421,6 +421,10 @@ public class DirectMysqlQuery {
}
public
DirectMysqlQuery
sort
(
Sort
sort
)
{
if
(
sort
==
null
)
{
return
this
;
}
if
(
sortBuffer
.
length
()
!=
0
)
{
throw
new
RuntimeException
(
"sortBuffer is not blank, invalid use of #pageable(Pageable)"
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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