Commit 13d4b2f1 authored by Matija Obreza's avatar Matija Obreza

Fixed dataset accession display

parent 7bda3986
......@@ -18,9 +18,11 @@ package org.genesys2.server.servlet.controller;
import java.io.IOException;
import java.io.OutputStream;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.genesys2.server.model.elastic.AccessionDetails;
import org.genesys2.server.model.genesys.AccessionData;
import org.genesys2.server.model.genesys.Metadata;
import org.genesys2.server.model.impl.FaoInstitute;
......@@ -30,6 +32,7 @@ import org.genesys2.server.service.InstituteService;
import org.genesys2.spring.ResourceNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
......@@ -52,9 +55,6 @@ public class DatasetController extends BaseController {
@Autowired
private DatasetService datasetService;
@Autowired
private Validator validator;
@Autowired
private InstituteService instituteService;
......@@ -79,7 +79,7 @@ public class DatasetController extends BaseController {
model.addAttribute("faoInstitute", faoInstitute);
final Page<AccessionData> accessions = genesysService.listMetadataAccessions(metadata.getId(), new PageRequest(page - 1, 50));
model.addAttribute("pagedData", accessions);
model.addAttribute("pagedData", new PageImpl<AccessionDetails>(genesysService.getAccessionDetails(accessions.getContent().stream().map(a -> a.getId()).collect(Collectors.toList())), new PageRequest(page - 1, 50), accessions.getTotalElements()));
// Map[accession.id][method.id]
model.addAttribute("accessionMethods", genesysService.getMetadataTraitValues(metadata, accessions.getContent()));
......
......@@ -127,7 +127,7 @@
<td><local:accession-details-link accession="${accession}" /></td>
<%-- <td><a href="<c:url value="/geo/${accession.origin}" />"><c:out value="${accession.countryOfOrigin.getName(pageContext.response.locale)}" /></a></td>
--%>
<td><span dir="ltr" class="sci-name"><c:out escapeXml="false" value="${accession.taxonomy.taxonNameHtml}" /></span></td>
<td><span dir="ltr" class="sci-name"><c:out escapeXml="false" value="${accession.taxonomy.sciNameHtml}" /></span></td>
<%-- <td><a href="<c:url value="/wiews/${accession.institute.code}" />"><c:out value="${accession.institute.code}" /></a></td>
<td><a href="<c:url value="/geo/${accession.institute.country.code3}" />"><c:out value="${accession.institute.country.getName(pageContext.response.locale)}" /></a></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