Commit ec08038d authored by Matija Obreza's avatar Matija Obreza
Browse files

Browse all accessions

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