Commit 5d66ca13 authored by Matija Obreza's avatar Matija Obreza

Display count of, and link to institute datasets

parent 6e2c385e
......@@ -30,4 +30,7 @@ public interface MetadataRepository extends JpaRepository<Metadata, Long> {
List<Metadata> findByIds(List<Long> oids);
Page<Metadata> findByInstituteCode(String wiewsCode, Pageable pageable);
@Query("select count(m) from Metadata m where m.instituteCode = ?1")
long countByInstituteCode(String instCode);
}
......@@ -132,4 +132,6 @@ public interface GenesysService {
void refreshMetadataMethods();
long countDatasets(FaoInstitute faoInstitute);
}
......@@ -275,6 +275,11 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
public Page<Metadata> listDatasets(FaoInstitute faoInstitute, Pageable pageable) {
return metadataRepository.findByInstituteCode(faoInstitute.getCode(), pageable);
}
@Override
public long countDatasets(FaoInstitute faoInstitute) {
return metadataRepository.countByInstituteCode(faoInstitute.getCode());
}
@Override
public Metadata getMetadata(long metadataId) {
......
......@@ -96,6 +96,7 @@ public class WiewsController extends BaseController {
model.addAttribute("blurp", contentService.getArticle(faoInstitute, "blurp", getLocale()));
model.addAttribute("countByInstitute", genesysService.countByInstitute(faoInstitute));
model.addAttribute("datasetCount", genesysService.countDatasets(faoInstitute));
// model.addAttribute("statisticsCrop",
// genesysService.statisticsCropByInstitute(faoInstitute, new
// PageRequest(0, 30)));
......
......@@ -124,6 +124,7 @@ select-country=Select country
faoInstitutes.page.list.title=WIEWS Institutes
faoInstitutes.page.profile.title=WIEWS {0}
faoInstitutes.stat.accessionCount=Accessions in Genesys: {0}.
faoInstitutes.stat.datasetCount=Additional datasets in Genesys: {0}.
faoInstitute.stat-by-crop=Most represented Crops
faoInstitute.stat-by-genus=Most represented Genera
faoInstitute.stat-by-species=Most represented Species
......@@ -142,6 +143,7 @@ faoInstitute.url=Web link
faoInstitute.member-of-organizations-and-networks=Organizations and Networks:
view.accessions=View accessions...
view.datasets=View datasets...
paged.pageOfPages=Page {0} of {1}
paged.totalElements={0} entries
......
......@@ -24,6 +24,11 @@
<c:if test="${countByInstitute gt 0}">
<a href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}/data" />"><spring:message code="view.accessions" /></a>
</c:if>
<spring:message code="faoInstitutes.stat.datasetCount" arguments="${datasetCount}" />
<c:if test="${datasetCount gt 0}">
<a href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}/datasets" />"><spring:message code="view.datasets" /></a>
</c:if>
</div>
<div class="">
......
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