Commit 8eb6aa43 authored by Matija Obreza's avatar Matija Obreza
Browse files

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

parent 84d358fc
......@@ -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`).
==== 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
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 know if your crop is not yet listed.
==== Institute codes in MCPD
......@@ -98,12 +98,17 @@ public class CropServiceImpl implements CropService {
public List<Crop> listCrops() {
return cropRepository.findAll();
List<Crop> crops = cropRepository.findAll();
// Fetch otherNames list -> { c.getOtherNames().size(); });
return crops;
public List<Crop> list(final Locale locale) {
final List<Crop> crops = cropRepository.findAll();
// Fetch otherNames list -> { c.getOtherNames().size(); });
Collections.sort(crops, new Comparator<Crop>() {
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);
private EntityManager entityManager;
private GenesysService genesysService;
......@@ -81,12 +75,6 @@ public class DownloadServiceImpl implements DownloadService {
private GenesysLowlevelRepository genesysLowlevelRepository;
private MethodRepository methodRepository;
@Autowired(required = false)
private PDCICalculator pdciCalculator;
private String baseUrl;
......@@ -226,7 +214,8 @@ public class DownloadServiceImpl implements DownloadService {
createCell(row, 10, taxonomy.getSubtaxa());
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;
......@@ -43,13 +47,20 @@ public class CropController extends BaseController {
private ContentService contentService;
private GenesysService genesysService;
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";
public String view(ModelMap model, @PathVariable(value = "shortName") String shortName) {
_logger.debug("Viewing crop " + shortName);
......@@ -67,10 +78,10 @@ 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";
......@@ -138,7 +149,7 @@ public class CropController extends BaseController {
return "redirect:/explore";
public String viewOverview(ModelMap model, @PathVariable(value = "shortName") String shortName) {
_logger.warn("Viewing crop " + shortName);
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/init.jsp"%>
<title><spring:message code="crop.croplist" /></title>
<spring:message code="crop.croplist" />
<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 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>
\ No newline at end of file
Supports Markdown
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