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
12
Issues
12
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
ff0767f5
Commit
ff0767f5
authored
Oct 22, 2018
by
Maxym Borodenko
Committed by
Matija Obreza
Oct 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Institute numbers
parent
d05dc06f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
23 deletions
+55
-23
src/main/java/org/genesys2/server/mvc/WiewsController.java
src/main/java/org/genesys2/server/mvc/WiewsController.java
+5
-3
src/main/java/org/genesys2/server/service/GenesysService.java
...main/java/org/genesys2/server/service/GenesysService.java
+2
-0
src/main/java/org/genesys2/server/service/impl/GenesysServiceImpl.java
.../org/genesys2/server/service/impl/GenesysServiceImpl.java
+31
-2
src/main/webapp/WEB-INF/jsp/wiews/details.jsp
src/main/webapp/WEB-INF/jsp/wiews/details.jsp
+17
-18
No files found.
src/main/java/org/genesys2/server/mvc/WiewsController.java
View file @
ff0767f5
...
...
@@ -192,13 +192,15 @@ public class WiewsController extends BaseController {
try
{
model
.
addAttribute
(
"statisticsCrops"
,
elasticService
.
termStatisticsAuto
(
Accession
.
class
,
af
,
5
,
AppliedFiltersConverter
.
convertTerm
(
FilterConstants
.
CROPS
)));
model
.
addAttribute
(
"statisticsCropName"
,
elasticService
.
termStatisticsAuto
(
Accession
.
class
,
af
,
5
,
AppliedFiltersConverter
.
convertTerm
(
FilterConstants
.
CROPNAME
)));
model
.
addAttribute
(
"statisticsGenus"
,
elasticService
.
termStatisticsAuto
(
Accession
.
class
,
af
,
5
,
AppliedFiltersConverter
.
convertTerm
(
FilterConstants
.
TAXONOMY_GENUS
)));
}
catch
(
SearchException
e
)
{
LOG
.
warn
(
e
.
getMessage
());
}
}
model
.
addAttribute
(
"statisticsCropName"
,
genesysService
.
statisticsCropNameByInstitute
(
faoInstitute
,
new
PageRequest
(
0
,
5
)));
model
.
addAttribute
(
"statisticsGenus"
,
genesysService
.
statisticsGenusByInstitute
(
faoInstitute
,
new
PageRequest
(
0
,
5
)));
model
.
addAttribute
(
"statisticsTaxonomy"
,
genesysService
.
statisticsSpeciesByInstitute
(
faoInstitute
,
new
PageRequest
(
0
,
5
)));
model
.
addAttribute
(
"statisticsTaxonomy"
,
genesysService
.
statisticsSpeciesByInstituteES
(
faoInstitute
,
5
));
model
.
addAttribute
(
"statisticsPDCI"
,
faoInstitute
.
getStatisticsPDCI
());
model
.
addAttribute
(
"updates"
,
genesysService
.
getLastUpdatedStatistics
(
faoInstitute
));
...
...
src/main/java/org/genesys2/server/service/GenesysService.java
View file @
ff0767f5
...
...
@@ -121,6 +121,8 @@ public interface GenesysService {
Page
<
Object
[]>
statisticsSpeciesByInstitute
(
FaoInstitute
faoInstitute
,
Pageable
pageable
);
List
<
Object
[]>
statisticsSpeciesByInstituteES
(
FaoInstitute
faoInstitute
,
int
size
);
// Page<Object[]> statisticsCropByInstitute(FaoInstitute faoInstitute,
// Pageable pageable);
...
...
src/main/java/org/genesys2/server/service/impl/GenesysServiceImpl.java
View file @
ff0767f5
...
...
@@ -29,8 +29,7 @@ import java.util.zip.ZipOutputStream;
import
javax.persistence.EntityManager
;
import
com.querydsl.core.BooleanBuilder
;
import
com.querydsl.jpa.impl.JPAQuery
;
import
com.google.common.collect.Sets
;
import
com.querydsl.jpa.impl.JPAQueryFactory
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.genesys.blocks.security.SecurityContextUtil
;
...
...
@@ -63,11 +62,13 @@ import org.genesys2.server.persistence.SvalbardRepository;
import
org.genesys2.server.persistence.TraitValueRepository
;
import
org.genesys2.server.service.CropService
;
import
org.genesys2.server.service.DatasetService
;
import
org.genesys2.server.service.ElasticsearchService
;
import
org.genesys2.server.service.GenesysFilterService
;
import
org.genesys2.server.service.GenesysService
;
import
org.genesys2.server.service.HtmlSanitizer
;
import
org.genesys2.server.service.OrganizationService
;
import
org.genesys2.server.service.TaxonomyService
;
import
org.genesys2.server.service.filter.AccessionFilter
;
import
org.genesys2.server.service.impl.FilterHandler.AppliedFilters
;
import
org.genesys2.util.NumberUtils
;
import
org.slf4j.Logger
;
...
...
@@ -157,6 +158,9 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
@Autowired
private
GenesysFilterService
filterService
;
@Autowired
private
ElasticsearchService
elasticService
;
private
List
<
String
>
availableDisplayColumns
;
private
List
<
String
>
defaultDisplayColumns
;
...
...
@@ -647,6 +651,31 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
return
page
;
}
@Override
public
List
<
Object
[]>
statisticsSpeciesByInstituteES
(
FaoInstitute
institute
,
int
size
)
{
AccessionFilter
af
=
new
AccessionFilter
();
af
.
holder
().
code
=
Sets
.
newHashSet
(
institute
.
getCode
());
af
.
historic
=
false
;
ElasticsearchService
.
TermResult
result
=
null
;
try
{
result
=
elasticService
.
termStatisticsAuto
(
Accession
.
class
,
af
,
size
,
"taxonomy.taxSpecies"
);
}
catch
(
SearchException
e
)
{
LOG
.
warn
(
e
.
getMessage
());
}
List
<
Object
[]>
statistics
=
new
ArrayList
<>(
size
);
if
(
result
!=
null
)
{
for
(
ElasticsearchService
.
Term
term:
result
.
getTerms
())
{
Object
[]
statItem
=
new
Object
[
2
];
statItem
[
0
]
=
taxonomyService
.
get
(
Long
.
valueOf
(
term
.
getTerm
()));
statItem
[
1
]
=
term
.
getCount
();
statistics
.
add
(
statItem
);
}
}
return
statistics
;
}
@Override
public
List
<
Long
>
listAccessionsIds
(
Pageable
pageable
)
{
return
accessionRepository
.
listAccessionsIds
(
pageable
);
...
...
src/main/webapp/WEB-INF/jsp/wiews/details.jsp
View file @
ff0767f5
...
...
@@ -334,16 +334,16 @@
</div>
</c:if>
<c:if
test=
"
${
statisticsCropName
ne
null
and
statisticsCropName
.
numberOfElements
gt
0
}
"
>
<c:if
test=
"
${
statisticsCropName
ne
null
and
statisticsCropName
.
terms
.
size
()
gt
0
}
"
>
<div
class=
"collect-info col-lg-6 col-md-12 col-sm-12 col-xs-12 stat-by-genus"
>
<h4
class=
"row section-heading"
><span><spring:message
code=
"faoInstitute.stat-by-cropName"
arguments=
"
${
statisticsGenus
.
numberOfElements
}
"
/></span></h4>
<h4
class=
"row section-heading"
><span><spring:message
code=
"faoInstitute.stat-by-cropName"
arguments=
"
${
statisticsGenus
.
terms
.
size
()
}
"
/></span></h4>
<div
class=
"section-inner-content clearfix ${cssClass}"
>
<div
class=
"col-lg-8 col-md-8 col-sm-8 col-xs-12 statistics"
>
<c:forEach
items=
"
${
statisticsCropName
.
content
}
"
var=
"stat"
varStatus=
"status"
>
<c:forEach
items=
"
${
statisticsCropName
.
terms
}
"
var=
"stat"
varStatus=
"status"
>
<div
class=
"row"
>
<div
class=
"col-lg-8 col-md-6 col-sm-6 col-xs-6 ${status.count % 2 == 0 ? 'even' : 'odd'}"
>
<c:choose>
<c:when
test=
"
${
stat
[
0
]
eq
null
}
"
>
<c:when
test=
"
${
stat
.
term
eq
null
}
"
>
<span>
<em>
<spring:message
code=
"data-overview.missingCount"
/>
...
...
@@ -351,17 +351,17 @@
</span>
</c:when>
<c:otherwise>
<a
title=
"
<spring:message
code=
"faoInstitute.link-species-data"
arguments=
"
${
faoInstitute
.
fullName
}
|${faoInstitute.acronym}|${stat
[0]
}"
argumentSeparator=
"|"
/>
"
href=
"
<c:url
value=
"/wiews/${faoInstitute.code}/cropName/${stat
[0]
}"
/>
"
>
<a
title=
"
<spring:message
code=
"faoInstitute.link-species-data"
arguments=
"
${
faoInstitute
.
fullName
}
|${faoInstitute.acronym}|${stat
.term
}"
argumentSeparator=
"|"
/>
"
href=
"
<c:url
value=
"/wiews/${faoInstitute.code}/cropName/${stat
.term
}"
/>
"
>
<span
dir=
"ltr"
>
<c:out
value=
"
${
stat
[
0
]
}
"
/>
<c:out
value=
"
${
stat
.
term
}
"
/>
</span>
</a>
</c:otherwise>
</c:choose>
</div>
<div
class=
"col-lg-4 col-md-6 col-sm-6 col-xs-6 ${status.count % 2 == 0 ? 'even' : 'odd'}"
>
<span
class=
"stats-number"
><fmt:formatNumber
value=
"
${
stat
[
1
]
}
"
/></span>
<span
class=
"stats-number"
><fmt:formatNumber
value=
"
${
stat
.
count
}
"
/></span>
</div>
</div>
</c:forEach>
...
...
@@ -375,22 +375,21 @@
</div>
</c:if>
<c:if
test=
"
${
statisticsGenus
ne
null
and
statisticsGenus
.
numberOfElements
gt
0
}
"
>
<c:if
test=
"
${
statisticsGenus
ne
null
and
statisticsGenus
.
terms
.
size
()
gt
0
}
"
>
<div
class=
"collect-info col-lg-6 col-md-12 col-sm-12 col-xs-12 stat-by-genus"
>
<h4
class=
"row section-heading"
><span><spring:message
code=
"faoInstitute.stat-by-genus"
arguments=
"
${
statisticsGenus
.
numberOfElements
}
"
/></span></h4>
<h4
class=
"row section-heading"
><span><spring:message
code=
"faoInstitute.stat-by-genus"
arguments=
"
${
statisticsGenus
.
terms
.
size
()
}
"
/></span></h4>
<div
class=
"section-inner-content clearfix ${cssClass}"
>
<div
class=
"col-lg-8 col-md-8 col-sm-8 col-xs-12 statistics"
>
<c:forEach
items=
"
${
statisticsGenus
.
content
}
"
var=
"stat"
varStatus=
"status"
>
<c:forEach
items=
"
${
statisticsGenus
.
terms
}
"
var=
"stat"
varStatus=
"status"
>
<div
class=
"row"
>
<div
class=
"col-lg-8 col-md-6 col-sm-6 col-xs-6 ${status.count % 2 == 0 ? 'even' : 'odd'}"
>
<%-- <span class="index-number">${status.count + pagedData.size * pagedData.number}</span> --%>
<a
title=
"
<spring:message
code=
"faoInstitute.link-species-data"
arguments=
"
${
faoInstitute
.
fullName
}
|${faoInstitute.acronym}|${stat
[0]}"
argumentSeparator=
"|"
/>
"
href=
"
<c:url
value=
"/wiews/${faoInstitute.code}/t/${stat[0]
}"
/>
"
>
<span
dir=
"ltr"
class=
"sci-name"
><i><c:out
value=
"
${
stat
[
0
]
}
"
/></i></span>
<a
title=
"
<spring:message
code=
"faoInstitute.link-species-data"
arguments=
"
${
faoInstitute
.
fullName
}
|${faoInstitute.acronym}|${stat
.term}"
argumentSeparator=
"|"
/>
"
href=
"
<c:url
value=
"/wiews/${faoInstitute.code}/t/${stat.term
}"
/>
"
>
<span
dir=
"ltr"
class=
"sci-name"
><i><c:out
value=
"
${
stat
.
term
}
"
/></i></span>
</a>
</div>
<div
class=
"col-lg-4 col-md-6 col-sm-6 col-xs-6 ${status.count % 2 == 0 ? 'even' : 'odd'}"
>
<span
class=
"stats-number"
><fmt:formatNumber
value=
"
${
stat
[
1
]
}
"
/></span>
<span
class=
"stats-number"
><fmt:formatNumber
value=
"
${
stat
.
count
}
"
/></span>
</div>
</div>
</c:forEach>
...
...
@@ -404,12 +403,12 @@
</div>
</c:if>
<c:if
test=
"
${
statisticsTaxonomy
ne
null
and
statisticsTaxonomy
.
numberOfElements
gt
0
}
"
>
<c:if
test=
"
${
statisticsTaxonomy
ne
null
and
statisticsTaxonomy
.
size
()
gt
0
}
"
>
<div
class=
"collect-info col-lg-6 col-md-12 col-sm-12 col-xs-12 stat-by-species"
>
<h4
class=
"row section-heading"
><span><spring:message
code=
"faoInstitute.stat-by-species"
arguments=
"
${
statisticsTaxonomy
.
numberOfElements
}
"
/></span></h4>
<h4
class=
"row section-heading"
><span><spring:message
code=
"faoInstitute.stat-by-species"
arguments=
"
${
statisticsTaxonomy
.
size
()
}
"
/></span></h4>
<div
class=
"section-inner-content clearfix ${cssClass}"
>
<div
class=
"col-lg-8 col-md-8 col-sm-8 col-xs-12 statistics"
>
<c:forEach
items=
"
${
statisticsTaxonomy
.
content
}
"
var=
"stat"
varStatus=
"status"
>
<c:forEach
items=
"
${
statisticsTaxonomy
}
"
var=
"stat"
varStatus=
"status"
>
<div
class=
"row"
>
<div
class=
"col-lg-8 col-md-6 col-sm-6 col-xs-6 ${status.count % 2 == 0 ? 'even' : 'odd'}"
>
<%-- <span class="index-number">${status.count + pagedData.size * pagedData.number}</span> --%>
...
...
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