Commit ec08038d authored by Matija Obreza's avatar Matija Obreza

Browse all accessions

parent 232de4d2
......@@ -69,4 +69,6 @@ public interface GenesysService {
Page<Accession> listAccessionsByTaxonomy(Taxonomy taxonomy, Pageable pageable);
Page<Accession> listAccessions(Pageable pageable);
}
......@@ -188,4 +188,9 @@ public class GenesysServiceImpl implements GenesysService {
public Page<Accession> listAccessionsByTaxonomy(Taxonomy taxonomy, Pageable pageable) {
return accessionRepository.findByTaxonomy(taxonomy, pageable);
}
@Override
public Page<Accession> listAccessions(Pageable pageable) {
return accessionRepository.findAll(pageable);
}
}
......@@ -32,8 +32,7 @@ public class AccessionController extends BaseController {
@Autowired
private TaxonomyService taxonomyService;
@RequestMapping("/id/{accessionId}")
public String view(ModelMap model, @PathVariable(value = "accessionId") long accessionId) {
_logger.debug("Viewing ACN " + accessionId);
......@@ -76,6 +75,22 @@ public class AccessionController extends BaseController {
return "/accession/resolve";
}
/**
* Browse all
*
* @param model
* @param page
* @return
*/
@RequestMapping("/")
public String viewAll(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
Page<Accession> accessions = genesysService.listAccessions(new PageRequest(page - 1, 50, new Sort("accessionName")));
_logger.info("Got: " + accessions);
model.addAttribute("accessions", accessions);
return "/accession/data";
}
/**
* View by Taxonomy
*
......@@ -87,8 +102,8 @@ public class AccessionController extends BaseController {
* @return
*/
@RequestMapping("/t/{genus}/{species}")
public String viewDataByGenusSpecies(ModelMap model, @PathVariable(value = "genus") String genus,
@PathVariable(value = "species") String species, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
public String viewDataByGenusSpecies(ModelMap model, @PathVariable(value = "genus") String genus, @PathVariable(value = "species") String species,
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
// Taxonomy
Taxonomy taxonomy = taxonomyService.get(genus, species);
......@@ -99,8 +114,7 @@ public class AccessionController extends BaseController {
model.addAttribute("filters", filters);
Page<Accession> accessions = genesysService.listAccessionsByTaxonomy(taxonomy, new PageRequest(page - 1, 50, new Sort(
"accessionName")));
Page<Accession> accessions = genesysService.listAccessionsByTaxonomy(taxonomy, new PageRequest(page - 1, 50, new Sort("accessionName")));
_logger.info("Got: " + accessions);
model.addAttribute("accessions", accessions);
......
......@@ -73,6 +73,7 @@ page.rendertime=Processing this page took {0}ms.
footer.copyright-statement=&copy; 2013 Global Crop Diversity Trust
menu.browse=Browse
menu.about=About
menu.contact=Contact
menu.disclaimer=Disclaimer
......@@ -137,7 +138,7 @@ accession.page.profile.title=Accession profile: {0}
accession.page.resolve.title=Multiple accessions found
accession.resolve=Multiple accessions with the name ''{0}'' found in Genesys. Select one from the list.
accession.page.data.title=Accession browser
accession.taxonomy-at-institute=View {0} at {1}
taxonomy.genus=Genus
taxonomy.species=Species
......
......@@ -84,6 +84,7 @@
<div id="nav-main" class="clearfix">
<ul>
<li><a href="<c:url value="/" />">Home</a></li>
<li><a href="<c:url value="/acn/" />"><spring:message code="menu.browse" /></a></li>
<li><a href="<c:url value="/data/" />">Datasets</a></li>
<li><a href="<c:url value="/geo/" />">Countries</a></li>
<li><a href="<c:url value="/wiews/active" />">Institutes</a></li>
......
......@@ -47,7 +47,7 @@
<td class="idx-col">${status.count + accessions.size * accessions.number}</td>
<td><a href="<c:url value="/acn/id/${accession.id}" />"><b><c:out value="${accession.accessionName}" /></b></a></td>
<td><a href="<c:url value="/geo/${accession.origin.toLowerCase()}" />"><c:out value="${accession.countryOfOrigin.name}" /></a></td>
<td><c:out value="${accession.taxonomy.taxonName}" /></td>
<td><a href="<c:url value="/acn/t/${accession.taxonomy.genus}/${accession.taxonomy.species}" />"><c:out value="${accession.taxonomy.taxonName}" /></a></td>
<td><a href="<c:url value="/wiews/${accession.institute.code.toLowerCase()}" />"><c:out value="${accession.institute.code}" /></a></td>
<td><a href="<c:url value="/geo/${accession.institute.country.code3.toLowerCase()}" />"><c:out value="${accession.institute.country.name}" /></a></td>
</tr>
......
......@@ -65,7 +65,12 @@
</tr>
<tr>
<td><spring:message code="taxonomy.taxonName" /></td>
<td><c:out value="${accession.taxonomy.taxonName}" /></td>
<td><a href="<c:url value="/acn/t/${accession.taxonomy.genus}/${accession.taxonomy.species}" />"><c:out value="${accession.taxonomy.taxonName}" /></a>
<a href="<c:url value="/wiews/${accession.institute.code.toLowerCase()}/t/${accession.taxonomy.genus}/${accession.taxonomy.species}" />"><spring:message code="accession.taxonomy-at-institute" arguments="${accession.taxonomy.taxonName}|||${accession.institute.code}" argumentSeparator="|||" /></a>
</td>
</tr>
<tr>
<td><spring:message code="accession.otherNames" /></td>
......
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