Commit 0af852b0 authored by Matija Obreza's avatar Matija Obreza

Added /c/ to list all crops and included CROPNAME in Excel MCPD export

parent 459a51bf
......@@ -55,6 +55,7 @@ All other fields are optional.
{
"instCode": "XYZ111",
"acceNumb": "M12345",
"cropName": "banana",
"genus": "Musa",
"species": "acuminata",
"spauthor": "Colla",
......
......@@ -61,7 +61,7 @@ consistent manner.
are allowed: `subsp.` (for subspecies); `convar.` (for convariety); `var.` (for variety); `f.` (for form); `Group` (for 'cultivar group').
|SUBTAUTHOR|Provide the subtaxon authority at the most detailed taxonomic level.
|CROPNAME|Common name of the crop. Example: `malting barley`, `macadamia`, `maize`.
|<<mcpd-cropname,CROPNAME>>|Common name of the crop. Example: `malting barley`, `macadamia`, `maize`.
|ACCENAME|Either a registered or other designation given to the material received, other than the donor's
accession number (DONORNUMB) or collecting number (COLLNUMB). First letter upper case.
......@@ -155,6 +155,24 @@ use, the concatenation of INSTCODE, ACCENUMB, and GENUS as a globally unique ide
similar in most respects to the PUID whenever they exchange information on accessions with
third parties (e.g. `NOR017:NGB17773:ALLIUM`).
[[mcpd-cropname]]
==== Crop name
Genesys will read the CROPNAME as provided and attempt to link the name with an existing crop
record in Genesys. Genesys currently supports the following crop names:
apple, banana, barley, beans, breadfruit, cassava, chickpea, coconut, cowpea, eggplant, fababean,
fingermillet, grasspea, lentil, lettuce, maize, pearlmillet, pigeonpea, potato, rice, sorghum,
sunflower, sweetpotato, taro, tomato, wheat, yam
The up-to-date list of crops and their coded names is available at https://www.genesys-pgr.org/c/
As more data is uploaded to Genesys we will add aliases to crops, making sure that future uploads
properly link the accession with the specified crop.
You are encouraged to use the crop names listed above, but more importantly, let
helpdesk@genesys-pgr.org know if your crop is not yet listed.
[[mcpd-wiews]]
==== Institute codes in MCPD
......
......@@ -98,12 +98,17 @@ public class CropServiceImpl implements CropService {
@Override
public List<Crop> listCrops() {
return cropRepository.findAll();
List<Crop> crops = cropRepository.findAll();
// Fetch otherNames list
crops.stream().forEach(c -> { c.getOtherNames().size(); });
return crops;
}
@Override
public List<Crop> list(final Locale locale) {
final List<Crop> crops = cropRepository.findAll();
// Fetch otherNames list
crops.stream().forEach(c -> { c.getOtherNames().size(); });
Collections.sort(crops, new Comparator<Crop>() {
@Override
public int compare(Crop o1, Crop o2) {
......
......@@ -27,8 +27,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.persistence.EntityManager;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
......@@ -53,7 +51,6 @@ import org.genesys2.server.model.genesys.PDCI;
import org.genesys2.server.model.genesys.Taxonomy2;
import org.genesys2.server.model.impl.Country;
import org.genesys2.server.persistence.domain.GenesysLowlevelRepository;
import org.genesys2.server.persistence.domain.MethodRepository;
import org.genesys2.server.service.DownloadService;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.GenesysService.AllStuff;
......@@ -71,9 +68,6 @@ public class DownloadServiceImpl implements DownloadService {
public static final Log LOG = LogFactory.getLog(DownloadServiceImpl.class);
@Autowired
private EntityManager entityManager;
@Autowired
private GenesysService genesysService;
......@@ -81,12 +75,6 @@ public class DownloadServiceImpl implements DownloadService {
@Qualifier("genesysLowlevelRepositoryCustomImpl")
private GenesysLowlevelRepository genesysLowlevelRepository;
@Autowired
private MethodRepository methodRepository;
@Autowired(required = false)
private PDCICalculator pdciCalculator;
@Value("${base.url}")
private String baseUrl;
......@@ -227,6 +215,7 @@ public class DownloadServiceImpl implements DownloadService {
createCell(row, 11, taxonomy.getSubtAuthor());
}
createCell(row, 12, accession.getCropName());
createCell(row, 14, accession.getAcquisitionDate());
Country origin = accession.getCountryOfOrigin();
......
......@@ -18,7 +18,11 @@ package org.genesys2.server.servlet.controller;
import org.genesys2.server.model.impl.Crop;
import org.genesys2.server.model.impl.CropTaxonomy;
import org.genesys2.server.service.*;
import org.genesys2.server.service.ContentService;
import org.genesys2.server.service.CropService;
import org.genesys2.server.service.FilterConstants;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.TraitService;
import org.genesys2.server.service.impl.FilterHandler;
import org.genesys2.server.service.impl.FilterHandler.AppliedFilter;
import org.genesys2.server.service.impl.FilterHandler.AppliedFilters;
......@@ -50,6 +54,13 @@ public class CropController extends BaseController {
@Autowired
private TraitService traitService;
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index(ModelMap model) {
_logger.debug("Viewing all crops");
model.addAttribute("crops", cropService.list(getLocale()));
return "/crop/list";
}
@RequestMapping("/{shortName}")
public String view(ModelMap model, @PathVariable(value = "shortName") String shortName) {
_logger.debug("Viewing crop " + shortName);
......@@ -67,9 +78,9 @@ public class CropController extends BaseController {
model.addAttribute("cropTaxonomies", cropService.getCropTaxonomies(crop, new PageRequest(0, 20, new Sort("taxonomy.genus", "taxonomy.species"))));
model.addAttribute("blurp", contentService.getArticle(crop, "blurp", getLocale()));
// model.addAttribute("statsGenus", elasticService.termStatisticsAuto(appliedFilters, FilterConstants.TAXONOMY_GENUS, 5));
// model.addAttribute("statsGenus",
// elasticService.termStatisticsAuto(appliedFilters,
// FilterConstants.TAXONOMY_GENUS, 5));
return "/crop/index";
}
......
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/init.jsp"%>
<html>
<head>
<title><spring:message code="crop.croplist" /></title>
</head>
<body>
<h1>
<spring:message code="crop.croplist" />
</h1>
<ul class="funny-list">
<c:forEach items="${crops}" var="crop" varStatus="status">
<li class="clearfix ${status.count % 2 == 0 ? 'even' : 'odd'}">
<div class="row">
<div class="col-xs-4">
<a class="show pull-left" href="<c:url value="/c/${crop.shortName}" />"><c:out value="${crop.getName(pageContext.response.locale)}" /></a>
</div>
<div class="col-xs-8">
<span style="margin: 0 1em; white-space: nowrap;"><c:out value="${crop.shortName}" /></span>
<c:forEach items="${crop.otherNames}" var="otherName">
<span style="margin: 0 1em; white-space: nowrap;"><c:out value="${otherName}" /></span>
</c:forEach>
</div>
</div>
</li>
</c:forEach>
</ul>
</body>
</html>
\ No newline at end of file
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